-
Notifications
You must be signed in to change notification settings - Fork 14
118 lines (97 loc) · 3.08 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
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/cancel-workflow-action@0.11.0
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 +nightly fmt --all -- --check,
cargo clippy -- -D warnings
]
steps:
- uses: actions/checkout@v3
- name: Install nightly toolchain
run: rustup toolchain install nightly --profile minimal --component rustfmt
# 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.6.1"
- 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-zepter:
name: Cargo Zepter
runs-on: ubuntu-latest
steps:
- name: Install stable Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: Install Zepter
run: cargo install --locked -q zepter && zepter --version
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Don't clone historic commits.
- name: Check features
run: zepter run check
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/cancel-action@0.2