-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (80 loc) · 2.58 KB
/
check-pull-request.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
name: "Check Pull Request"
on:
pull_request:
branches:
- develop
paths:
- "**/*.rs"
- "**/Cargo.toml"
- "**/Cargo.lock"
- "rust-toolchain.toml"
- "rustfmt.toml"
- ".github/workflows/*.yml"
push:
branches:
- develop
# Ensures only one build is run per branch, unless pushing to develop
concurrency:
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/develop' && github.run_number || github.ref }}
cancel-in-progress: true
env:
CARGO_ARGS: ${{ github.ref == 'refs/heads/develop' && '--release' || '' }}
CARGO_TERM_COLOR: always
SKIP_WASM_BUILD: 1
jobs:
fmt:
if: ${{ !startsWith(github.head_ref, 'release/') }}
name: Rustfmt
runs-on: ubuntu-latest
container:
# contains the nightly-toolchain
image: docker.io/paritytech/ci-unified:bullseye-1.75.0-2024-01-22-v20240109
continue-on-error: false
steps:
- uses: actions/checkout@v4
# some settings are only available in nightly.
- run: cargo +nightly fmt --all -- --check
lint:
if: ${{ !startsWith(github.head_ref, 'release/') }}
name: Clippy
runs-on: ubuntu-latest
continue-on-error: false
steps:
- uses: actions/checkout@v4
- run: ./.github/scripts/free_disk_space.sh
- run: sudo apt-get install -y protobuf-compiler
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-lint-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-lint-
- run: cargo clippy --workspace --all-features --all-targets ${{ env.CARGO_ARGS }} -- -D warnings
test:
if: ${{ !startsWith(github.head_ref, 'release/') }}
name: Test
runs-on: ubuntu-latest
continue-on-error: false
strategy:
matrix:
runtime:
- bajun-runtime
steps:
- uses: actions/checkout@v4
- run: ./.github/scripts/free_disk_space.sh
- run: sudo apt-get install -y protobuf-compiler
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-test-${{ matrix.runtime }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-test-${{ matrix.runtime }}-
- run: cargo test --all-features --all-targets ${{ env.CARGO_ARGS }} -p ${{ matrix.runtime }}