-
Notifications
You must be signed in to change notification settings - Fork 18
114 lines (108 loc) · 3.44 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
on:
pull_request:
branches:
- main
push:
branches:
- main
name: Continuous integration
jobs:
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Rustfmt
run: cargo fmt --all -- --check
toml-sort:
name: TOML Sort check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Off-Narrative-Labs/toml_sort@v1
with:
all: true
match: "Cargo.toml"
test:
name: Test and code coverage
needs: [fmt, toml-sort]
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Install tooling
run: |
sudo apt-get install -y protobuf-compiler
protoc --version
- name: Install latest nextest release
uses: taiki-e/install-action@nextest
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
cache-targets: true
cache-on-failure: true
- name: Run tests and print coverage data
run: |
cargo llvm-cov nextest --release --workspace \
--exclude node-template --exclude parachain-template-node \
--exclude derive-no-bound \
--json --output-path lcov.json --summary-only &&
perc=`jq ".data[0].totals.lines.percent" lcov.json` &&
echo Lines coverage: ${perc:0:5}%
# if the PR is on the same repo, the coverage data can be reported as a comment
- if: github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository
name: Generate lcov report
run: cargo llvm-cov report --lcov --output-path lcov.info
--ignore-filename-regex "node" --release
- if: github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository
name: Report code coverage
uses: romeovs/lcov-reporter-action@master
with:
lcov-file: lcov.info
pr-number: ${{ github.event.pull_request.number }}
delete-old-comments: true
clippy:
name: Clippy
needs: [fmt, toml-sort]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install tooling
run: |
sudo apt-get install -y protobuf-compiler
protoc --version
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
cache-targets: true
cache-on-failure: true
- name: Run Clippy
run: cargo clippy --no-deps -- -D warnings
wallet:
name: Wallet end-to-end test
needs: [fmt, toml-sort]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install tooling
run: |
sudo apt-get install -y protobuf-compiler
protoc --version
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
cache-targets: true
cache-on-failure: true
- name: Build
# We do not need the parachain node for the wallet test.
# However, this is more than merely an optimization.
# If we just `cargo build` the runtime will be incorrectly built with the parachain feature.
run: cargo build -p node-template -p tuxedo-template-wallet
- name: Run wallet test
run: ./wallet/test.sh