1- name : Check Set-Up & Build
1+ name : Check Build and Tests
22
33# Controls when the action will run.
44on :
55 # Triggers the workflow on push or pull request events but only for the master branch
66 push :
77 branches : [ main ]
88 pull_request :
9- branches : [ main ]
109
1110 # Allows you to run this workflow manually from the Actions tab
1211 workflow_dispatch :
1312
14- # A workflow run is made up of one or more jobs that can run sequentially or in parallel
1513jobs :
16- check :
17- # The type of runner that the job will run on
18- runs-on : ubuntu-20.04
19- env :
20- NIGHTLY : nightly-2022-11-02 # Fix version to prevent cache misses with nightly changes
21-
22- # Steps represent a sequence of tasks that will be executed as part of the job
14+ lint :
15+ runs-on : ubuntu-latest
2316 steps :
24- # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
2517 - uses : actions/checkout@v3
2618
27- - name : Set-Up
28- run : sudo apt update && sudo apt install -y git clang curl libssl-dev llvm libudev-dev cmake protobuf-compiler
29-
30- - name : Install Rust
31- uses : actions-rs/toolchain@v1
19+ - name : Setup worker
20+ uses : " ./.github/templates/setup-worker"
3221 with :
33- profile : minimal
34- toolchain : stable
22+ rust-components : rustfmt
3523
36- - name : Install Nightly
37- uses : actions-rs/toolchain@v1
38- with :
39- profile : minimal
40- toolchain : ${{ env.NIGHTLY }}
41- override : true
42- target : wasm32-unknown-unknown
43- components : rustfmt
44-
45- # Fail fast: check formatting first as it doesn't require compilation
4624 - name : Check formatting
47- uses : actions-rs/cargo@v1
48- with :
49- command : fmt
50- args : --all --check
25+ run : cargo fmt --all -- --check
26+
27+ check :
28+ needs : lint
29+ runs-on : ubuntu-latest
30+ steps :
31+ - uses : actions/checkout@v3
32+
33+ - name : Setup worker
34+ uses : " ./.github/templates/setup-worker"
5135
5236 - name : Cache Build artefacts
5337 uses : actions/cache@v3
5842 ~/.cargo/registry/cache/
5943 ~/.cargo/git/db/
6044 target/
61- key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
62- restore-keys : ${{ runner.os }}-cargo-
45+ key : ${{ runner.os }}-cargo-release- ${{ hashFiles('**/Cargo.lock') }}
46+ restore-keys : ${{ runner.os }}-cargo-release
6347
6448 - name : Check Build Trappist Runtime
6549 run : |
@@ -69,12 +53,37 @@ jobs:
6953 run : |
7054 SKIP_WASM_BUILD=1 cargo check --release --no-default-features --features with-stout-runtime
7155
72- - name : Check Build for Benchmarking Trappist Runtime
73- run : >
74- pushd node &&
75- cargo check --features=runtime-benchmarks,with-trappist-runtime --release
56+ test :
57+ needs : lint
58+ runs-on : ubuntu-latest
59+ steps :
60+ # Tests with benchmarks require a lot of disk space
61+ - name : Free Disk Space (Ubuntu)
62+ uses : jlumbroso/free-disk-space@main
63+ with :
64+ android : true
65+ dotnet : false
66+ haskell : false
67+ large-packages : false
68+ swap-storage : false
69+
70+ - uses : actions/checkout@v3
71+
72+ - name : Setup worker
73+ uses : " ./.github/templates/setup-worker"
74+
75+ - name : Cache Build artefacts
76+ uses : actions/cache@v3
77+ with :
78+ path : |
79+ ~/.cargo/bin/
80+ ~/.cargo/registry/index/
81+ ~/.cargo/registry/cache/
82+ ~/.cargo/git/db/
83+ target/
84+ key : ${{ runner.os }}-cargo-debug-${{ hashFiles('**/Cargo.lock') }}
85+ restore-keys : ${{ runner.os }}-cargo-debug
7686
77- - name : Check Build for Benchmarking stout Runtime
78- run : >
79- pushd node &&
80- cargo check --no-default-features --features=runtime-benchmarks,with-stout-runtime --release
87+ - name : Run tests
88+ run : |
89+ cargo test --features runtime-benchmarks --jobs 2
0 commit comments