1717 required : false
1818 default : x86_64-unknown-linux-gnu
1919 description : Rust target for the build step. Clippy and tests are still executed with the default target.
20+ features :
21+ type : string
22+ required : false
23+ # Make sure we always an empty string to "--features <FEATURES>"
24+ default : ' ""'
25+ description : Comma-separated String with additional Rust features relevant for a certain job.
2026 do-style-check :
2127 type : boolean
2228 required : false
2329 default : true
24- description : Whether style checks should be done .
30+ description : Perform code and doc style checks .
2531 do-test :
2632 type : boolean
2733 required : false
2834 default : true
29- description : Whether tests should be executed .
35+ description : Execute tests.
3036
3137jobs :
32- build :
38+ check_rust :
3339 runs-on : ubuntu-latest
3440 steps :
3541 - name : Check out
3642 uses : actions/checkout@v3
37- - name : Install Rust
43+ - name : Set up rustup cache
44+ uses : actions/cache@v3
45+ continue-on-error : false
46+ with :
47+ path : |
48+ ~/.rustup/downloads
49+ ~/.rustup/toolchains
50+ # key: ${{ runner.os }}-rustup-${{ inputs.rust-version }}-${{ inputs.rust-target }}-${{ hashFiles('**/rustup-toolchain.toml') }}
51+ key : ${{ runner.os }}-rustup-${{ inputs.rust-version }}-${{ inputs.rust-target }}
52+ # The effect of this is must smaller than the cache for Cargo. However, it
53+ # still saves a few seconds. Note that many CI runs within a week may
54+ # quickly bring you close to the 10GB limit:
55+ # https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#managing-caches
56+ - name : Install Rust Toolchain via Rustup
3857 uses : actions-rs/toolchain@v1
3958 with :
4059 profile : minimal
4160 toolchain : ${{ inputs.rust-version }}
4261 override : true
4362 components : clippy, rustfmt
4463 target : ${{ inputs.rust-target }}
45- - name : Set up cargo cache
64+ - name : Set up Cargo cache
4665 uses : actions/cache@v3
4766 continue-on-error : false
4867 with :
@@ -54,23 +73,22 @@ jobs:
5473 target/
5574 # We do not have a Cargo.lock here, so I hash Cargo.toml
5675 key : ${{ runner.os }}-rust-${{ inputs.rust-version }}-cargo-${{ hashFiles('**/Cargo.toml') }}
57- restore-keys : ${{ runner.os }}-cargo-${{ inputs.rust-version }}
5876 - run : cargo version
77+ - name : Build (library)
78+ run : cargo build --target ${{ inputs.rust-target }} --features ${{ inputs.features }}
79+ - name : Build (all targets)
80+ run : cargo build --all-targets --features ${{ inputs.features }}
5981 - name : Code Formatting
6082 if : ${{ inputs.do-style-check }}
6183 run : cargo fmt --all -- --check
62- - name : Build (library)
63- run : cargo build --target ${{ inputs.rust-target }}
64- - name : Build (all targets)
65- run : cargo build --all-targets
6684 - name : Code Style and Doc Style
6785 if : ${{ inputs.do-style-check }}
6886 run : |
69- cargo doc --document-private-items
70- cargo clippy --all-targets
87+ cargo doc --document-private-items --features ${{ inputs.features }}
88+ cargo clippy --all-targets --features ${{ inputs.features }}
7189 - name : Unit Test
7290 if : ${{ inputs.do-test }}
7391 run : |
7492 curl -LsSf https://get.nexte.st/latest/linux | tar zxf -
7593 chmod u+x cargo-nextest
76- ./cargo-nextest nextest run
94+ ./cargo-nextest nextest run --features ${{ inputs.features }}
0 commit comments