108 lines (101 loc) · 3.05 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Rust
on:
push:
branches:
# two reserved branches for bors the bot
- staging
- trying
pull_request:
branches:
- master
release:
types:
- created
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
env:
RUST_BACKTRACE: 1
steps:
- uses: actions/checkout@v2
- run: cargo build --all-targets --workspace
- run: cargo test --all-targets --workspace
redox_check:
runs-on: ubuntu-latest
env:
RUST_BACKTRACE: 1
steps:
- uses: actions/checkout@v2
- run: |
rustup default nightly
rustup target add x86_64-unknown-redox
- run: cargo check --all-targets --workspace --target x86_64-unknown-redox
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: rustup component add rustfmt
- run: cargo fmt -- --check
minimum-rust-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
rustup toolchain install 1.34.0
rustup default 1.34.0
rustup target add \
x86_64-pc-windows-gnu \
x86_64-apple-darwin \
x86_64-pc-windows-msvc
- run: |
for target in x86_64-pc-windows-gnu x86_64-apple-darwin x86_64-pc-windows-msvc; do
echo "== checking $target =="
cargo check --all-targets --all --target "$target"
done
shell: bash
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
rustup component add clippy
rustup target add \
x86_64-pc-windows-gnu \
x86_64-apple-darwin \
x86_64-pc-windows-msvc
- run: |
for target in x86_64-pc-windows-gnu x86_64-apple-darwin x86_64-pc-windows-msvc; do
echo "== checking $target =="
cargo check --all-targets --all --target "$target"
git ls-files '*lib.rs' | xargs touch
# FIXME: Remove `-- -A clippy::option_as_ref_deref` when MSRV is bumped past 1.40.0
cargo clippy --all-targets --all --target "$target" \
-- \
-A clippy::option_as_ref_deref \
-A clippy::redundant_field_names
done
shell: bash
# These jobs doesn't actually test anything, but they're only used to tell
# bors the build completed, as there is no practical way to detect when a
# workflow is successful listening to webhooks only.
#
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
end-success:
name: bors build finished
runs-on: ubuntu-latest
needs: [build]
if: github.event.pusher.name == 'bors' && success()
steps:
- name: mark the job as a success
run: exit 0
end-failure:
name: bors build finished
runs-on: ubuntu-latest
needs: [build]
if: github.event.pusher.name == 'bors' && (failure() || cancelled())
steps:
- name: mark the job as a failure
run: exit 1