@@ -3,28 +3,58 @@ name: Rust
3
3
on : [push]
4
4
5
5
jobs :
6
- build :
6
+
7
+ codestyle :
8
+ runs-on : ubuntu-latest
9
+ steps :
10
+ - name : Set up Rust
11
+ uses : hecrj/setup-rust-action@v1
12
+ with :
13
+ components : rustfmt
14
+ rust-version : nightly
15
+ - uses : actions/checkout@v2
16
+ - run : cargo fmt -- --check --config-path <(echo 'license_template_path = "HEADER"')
17
+
18
+ lint :
19
+ runs-on : ubuntu-latest
20
+ steps :
21
+ - name : Set up Rust
22
+ uses : hecrj/setup-rust-action@v1
23
+ with :
24
+ components : clippy
25
+ - uses : actions/checkout@v2
26
+ - run : cargo clippy --all-targets -- -D clippy::all
27
+
28
+ compile :
7
29
runs-on : ubuntu-latest
30
+ steps :
31
+ - name : Set up Rust
32
+ uses : hecrj/setup-rust-action@v1
33
+ - uses : actions/checkout@master
34
+ - run : cargo check --all
8
35
36
+ test :
37
+ needs : [codestyle, lint, compile]
38
+ strategy :
39
+ matrix :
40
+ rust : [stable, beta, nightly]
41
+ runs-on : ubuntu-latest
9
42
steps :
10
- - uses : actions/checkout@v1
11
43
- name : Setup Rust
44
+ uses : hecrj/setup-rust-action@v1
45
+ with :
46
+ rust-version : ${{ matrix.rust }}
47
+ - name : Checkout
48
+ uses : actions/checkout@v2
49
+ - name : Test
50
+ run : cargo test
51
+ - name : Coverage
52
+ if : matrix.rust == 'stable'
12
53
run : |
13
- rustup toolchain install nightly --profile default
14
- rustup toolchain install stable
15
- rustup override set stable
16
- # Clippy must be run first, as its lints are only triggered during
17
- # compilation. Put another way: after a successful `cargo build`, `cargo
18
- # clippy` is guaranteed to produce no results. This bug is known upstream:
19
- # https://github.com/rust-lang/rust-clippy/issues/2604.
20
- # - name: Clippy
21
- # run: cargo clippy -- --all-targets --all-features -- -D warnings
22
- - name : Check formatting
23
- run : |
24
- cargo +nightly fmt -- --check --config-path <(echo 'license_template_path = "HEADER"')
25
- - name : Build
26
- run : cargo build --verbose
27
- - name : Run tests
28
- run : cargo test --verbose
29
- - name : Run tests for all features
30
- run : cargo test --verbose -- all-features
54
+ # Tarpaulin interoperates with CI services, however Actions is not
55
+ # currently supported. As a workaround, we can pretend to be Travis.
56
+ export TRAVIS_JOB_ID=${GITHUB_SHA}
57
+ export TRAVIS_PULL_REQUEST=false
58
+ export TRAVIS_BRANCH=${GITHUB_REF##*/}
59
+ cargo install cargo-tarpaulin
60
+ cargo tarpaulin --ciserver travis-ci --coveralls $TRAVIS_JOB_ID
0 commit comments