This repository has been archived by the owner on May 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
162 lines (153 loc) · 5.21 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
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
name: Build
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
continue-on-error: false
steps:
- uses: actions/checkout@v3
- run: cargo fmt --all -- --check
lint:
if: ${{ !startsWith(github.head_ref, 'release/') }}
name: Clippy
runs-on: ubuntu-latest
continue-on-error: false
steps:
- uses: actions/checkout@v3
- run: ./.github/scripts/free_disk_space.sh
- run: sudo apt-get install -y protobuf-compiler
- uses: actions/cache@v3
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 --all-features --all-targets ${{ env.CARGO_ARGS }} -- -D warnings
test-pallets:
if: ${{ !startsWith(github.head_ref, 'release/') }}
name: Test-Pallets
runs-on: ubuntu-latest
continue-on-error: false
strategy:
matrix:
pallet:
- pallet-ajuna-awesome-avatars
- pallet-ajuna-awesome-avatars-benchmarking
- pallet-ajuna-nft-staking
- pallet-ajuna-nft-staking-benchmarking
- pallet-ajuna-nft-transfer
steps:
- uses: actions/checkout@v3
- run: ./.github/scripts/free_disk_space.sh
- run: sudo apt-get install -y protobuf-compiler
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-test-${{ matrix.pallet }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-test-${{ matrix.pallet }}-
- run: cargo test --all-features --all-targets ${{ env.CARGO_ARGS }} -p ${{ matrix.pallet }}
test-runtime:
if: ${{ !startsWith(github.head_ref, 'release/') }}
name: Test-Runtime
runs-on: ubuntu-latest
continue-on-error: false
strategy:
matrix:
runtime:
- ajuna-solo-runtime
- ajuna-runtime
- bajun-runtime
steps:
- uses: actions/checkout@v3
- run: ./.github/scripts/free_disk_space.sh
- run: sudo apt-get install -y protobuf-compiler
- uses: actions/cache@v3
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 }}
test-full:
if: github.ref == 'refs/heads/develop'
name: Test-Full
runs-on: ubuntu-latest
continue-on-error: false
steps:
- uses: actions/checkout@v3
- run: ./.github/scripts/free_disk_space.sh
- run: sudo apt-get install -y protobuf-compiler
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-test-full-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-test-full-
- run: cargo test --workspace --all-features --all-targets ${{ env.CARGO_ARGS }}
coverage:
if: ${{ !startsWith(github.head_ref, 'release/') }}
name: Coverage
runs-on: ubuntu-latest
container:
image: xd009642/tarpaulin:0.22.0
options: --security-opt seccomp=unconfined
steps:
- uses: actions/checkout@v3
- name: Generate code coverage
run: |
cargo tarpaulin --timeout 120 --no-fail-fast --workspace --out Xml \
--exclude \
ajuna-cli ajuna-node ajuna-primitives ajuna-rpc ajuna-service \
ajuna-runtime ajuna-solo-runtime bajun-runtime \
pallet-ajuna-awesome-avatars-benchmarking \
pallet-ajuna-nft-staking-benchmarking \
--exclude-files \
node/* rpc/* runtime/* \
pallets/ajuna-awesome-avatars/benchmarking/* \
pallets/ajuna-nft-staking-benchmarking/* \
benchmarking.rs weights.rs
- name: Upload to codecov.io
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true