-
Notifications
You must be signed in to change notification settings - Fork 14
93 lines (78 loc) · 2.46 KB
/
ci.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
name: Build and Test
on:
push:
branches:
- master
- 'sdk-v[0-9]+.[0-9]+.[0-9]+-*'
- 'polkadot-v[0-9]+.[0-9]+.[0-9]+-*'
tags:
- '[0-9]+.[0-9]+.[0-9]+'
pull_request:
branches:
- master
- 'sdk-v[0-9]+.[0-9]+.[0-9]+-*'
- 'polkadot-v[0-9]+.[0-9]+.[0-9]+-*'
env:
CARGO_TERM_COLOR: always
jobs:
cancel_previous_runs:
name: Cancel Previous Runs
runs-on: ubuntu-20.04
steps:
- uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
check:
name: Rust check ${{ matrix.check }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
check: [ cargo build --release,
cargo build --release --features dot,
cargo build --release --features ksm,
cargo test --all --features runtime-benchmarks,
cargo test --all --features dot,
cargo test --all --features ksm,
cargo fmt --all -- --check,
cargo clippy -- -D warnings
]
steps:
- uses: actions/checkout@v3
# With rustup's nice new toml format, we just need to run rustup show to install the toolchain
# https://github.com/actions-rs/toolchain/issues/126#issuecomment-782989659
- name: Setup Rust toolchain
run: rustup show
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.rust-target }}-${{ matrix.check }}
- name: ${{ matrix.check }}
run: ${{ matrix.check }}
license-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install cargo-about
uses: baptiste0928/cargo-install@v2
with:
crate: cargo-about
version: "0.5.6"
- name: Run license check
# Explicitly use stable because otherwise cargo will trigger a download of
# the nightly version specified in rust-toolchain.toml
run: cargo +stable about generate about.hbs > license.html
- name: Archive license file
uses: actions/upload-artifact@v3
with:
name: license
path: license.html
cargo-toml-fmt:
runs-on: ubuntu-latest
container: "tamasfe/taplo:0.7.0-alpine"
steps:
- uses: actions/checkout@v3
- name: Run Taplo fmt
run: taplo fmt --check
- name: Fail-fast; cancel other jobs
if: failure()
uses: andymckay/[email protected]