-
Notifications
You must be signed in to change notification settings - Fork 12
200 lines (172 loc) · 6.38 KB
/
check.yml
File metadata and controls
200 lines (172 loc) · 6.38 KB
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
changes:
uses: ./.github/workflows/check-changed-files.yml
permissions:
contents: read
pull-requests: read
set-image:
if: needs.changes.outputs.should-run == 'true'
needs: [changes]
uses: ./.github/workflows/set-image.yml
check-fmt:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Load common environment variables via env file
run: cat .github/env >> $GITHUB_ENV
- name: Install Rust toolchains
uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 # master
with:
toolchain: nightly
components: rustfmt
- name: Install Rust stable
uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 # master
with:
toolchain: ${{ env.RUST_STABLE_VERSION }}
- name: Cargo fmt
run: cargo +nightly fmt --all -- --check
- name: Cache taplo
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
id: cache-taplo
with:
path: ~/.cargo/bin/taplo
key: taplo-${{ runner.os }}-${{ env.TAPLO_VERSION }}
- name: Install taplo
if: steps.cache-taplo.outputs.cache-hit != 'true'
run: cargo install taplo-cli --version ${{ env.TAPLO_VERSION }}
- name: Cache zepter
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
id: cache-zepter
with:
path: ~/.cargo/bin/zepter
key: zepter-${{ runner.os }}-${{ env.ZEPTER_VERSION }}
- name: Install zepter
if: steps.cache-zepter.outputs.cache-hit != 'true'
run: cargo install zepter --locked --version ${{ env.ZEPTER_VERSION }}
- name: Check TOML format
run: |
taplo --version
zepter --version
if ! taplo format --check --config .config/taplo.toml; then
echo "Please run 'taplo format --config .config/taplo.toml' to fix any TOML formatting issues"
exit 1
fi
if ! zepter run check --config .config/zepter.yaml; then
echo "Please run 'zepter run --config .config/zepter.yaml' to fix any TOML formatting issues"
exit 1
fi
clippy:
name: Cargo clippy
runs-on: parity-default
needs: [set-image, check-fmt]
container:
image: ${{ needs.set-image.outputs.CI_IMAGE }}
env:
RUSTFLAGS: "-D warnings"
SKIP_WASM_BUILD: 1
steps:
- name: Checkout sources
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Rust cache
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
shared-key: "bulletin-cache-clippy"
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Cargo clippy
run: |
cargo clippy --all-targets --locked --workspace --quiet
cargo clippy --all-targets --all-features --locked --workspace --quiet
test:
name: Test (${{ matrix.target.name }})
runs-on: parity-large
timeout-minutes: 30
needs: [set-image, check-fmt]
container:
image: ${{ needs.set-image.outputs.CI_IMAGE }}
strategy:
fail-fast: false
matrix:
target:
- name: pallets
cmd: |
SKIP_WASM_BUILD=1 cargo test -p pallet-bulletin-transaction-storage
SKIP_WASM_BUILD=1 cargo test -p pallet-bulletin-transaction-storage --features=runtime-benchmarks
- name: bulletin-westend-runtime
cmd: SKIP_WASM_BUILD=1 cargo test -p bulletin-westend-runtime
- name: bulletin-paseo-runtime
cmd: SKIP_WASM_BUILD=1 cargo test -p bulletin-paseo-runtime
- name: xcm-integration
cmd: cargo test -p bulletin-westend-integration-tests
steps:
- name: Checkout sources
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Rust cache
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
shared-key: "bulletin-cache-tests-${{ matrix.target.name }}"
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Run tests
run: ${{ matrix.target.cmd }}
prepare-bencher:
name: Prepare frame-omni-bencher
needs: [set-image, check-fmt]
uses: ./.github/workflows/prepare-polkadot-binaries.yml
with:
groups: frame-omni-bencher
image: ${{ needs.set-image.outputs.CI_IMAGE }}
benchmarks:
name: Check Benchmarks (${{ matrix.runtime.name }})
runs-on: parity-large
timeout-minutes: 60
needs: [set-image, check-fmt, prepare-bencher]
container:
image: ${{ needs.set-image.outputs.CI_IMAGE }}
strategy:
fail-fast: false
matrix:
runtime:
- name: bulletin-westend
package: bulletin-westend-runtime
- name: bulletin-paseo
package: bulletin-paseo-runtime
steps:
- name: Checkout sources
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Rust cache
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
shared-key: "bulletin-cache-benchmarks-${{ matrix.runtime.name }}"
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Set up Polkadot binaries
uses: ./.github/actions/use-polkadot-binaries
with:
groups: frame-omni-bencher
mode: consume
- name: Run benchmarks (${{ matrix.runtime.name }})
run: |
python3 ./scripts/cmd/cmd.py bench --runtime ${{ matrix.runtime.name }} --steps 2 --repeat 1 --profile release
- name: Run release check (${{ matrix.runtime.name }})
run: |
cargo check --profile release -p ${{ matrix.runtime.package }}
all-tests-passed:
name: All tests passed
if: always()
needs: [changes, check-fmt, clippy, test, prepare-bencher, benchmarks]
runs-on: ubuntu-latest
steps:
- name: Decide outcome
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: exit 1