-
Notifications
You must be signed in to change notification settings - Fork 67
168 lines (151 loc) · 5.08 KB
/
build+test.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
163
164
165
166
167
168
name: Build + Test
on:
push:
branches:
- albatross
- testnet
pull_request:
merge_group:
workflow_dispatch:
jobs:
rustfmt:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- run: cargo fmt --all -- --check
check:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/[email protected] # Also test our Rust MSRV here.
- uses: Swatinem/rust-cache@v2
- run: cargo check --all-features --tests --benches
test:
runs-on: ubuntu-22.04
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
large-packages: false
- uses: actions/checkout@v4
- name: "Check for duplicate message IDs"
run: "! grep -rEoh --exclude-dir tests --exclude-dir target 'TYPE_ID: u16 = [^;]+;' | sort | uniq -d | grep '^'"
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: Swatinem/rust-cache@v2
- name: Install cargo-nextest
run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
# Coverage is disabled for now since at the moment it has a considerable performance impact in the CI
#- name: Install cargo-llvm-cov
# run: cargo install cargo-llvm-cov
#- name: Remove possible stale artifacts
# run: cargo llvm-cov clean --workspace
#- name: Run test with coverage instrumentation
# run: cargo llvm-cov nextest --features=nimiq-zkp-component/test-prover
# Fixme: --doctest is not supported in stable. See:
# https://github.com/taiki-e/cargo-llvm-cov/tree/7448e48b438797efb446a98ebd8ff22d3fae5ebe#known-limitations
# run: cargo llvm-cov --features=nimiq-zkp-component/test-prover --doctests
#- name: Generate coverage report
# run: cargo llvm-cov report --lcov --output-path coverage.lcov
#- name: Upload coverage to Codecov
# uses: codecov/codecov-action@v3
# with:
# files: coverage.lcov
# fail_ci_if_error: false
# flags: unittests
# name: Nimiq code coverage
# verbose: true
- name: Run tests
run: cargo nextest run --features=nimiq-zkp-component/test-prover
# Currently `nextest` doesn't support doctest so we have to run them apart
- name: Run doctest
run: cargo test --doc
clippy:
if: github.event_name != 'push' || github.event.pusher.name != 'dependabot[bot]'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- uses: actions-rs/clippy-check@v1
with:
name: Clippy Report
token: ${{ secrets.GITHUB_TOKEN }}
args: --release --all-features
web-client:
runs-on: ubuntu-22.04
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: true
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: false
swap-storage: true
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install wasm-pack
run: cargo install wasm-pack
- name: Execute wasm unittests
working-directory: ./web-client
run: wasm-pack test --chrome --headless
web-client-lib:
runs-on: ubuntu-22.04
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
large-packages: false
- uses: actions/checkout@v4
- uses: dtolnay/[email protected]
with:
targets: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
- name: Compile to wasm and generate bindings
working-directory: ./web-client
run: ./scripts/build.sh --only nodejs,types
- name: Install dependencies in the web-client/dist folder
working-directory: ./web-client/dist
run: yarn install
- name: Execute unittests
working-directory: ./web-client/extras
run: yarn test
reconnect-test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Install python dependencies
run: pip install scripts/devnet
- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Build the code
run: cargo build
- name: Executes the 4 validators reconnecting scenario
run: |
python3 scripts/devnet/devnet.py -t .github/devnet_topologies/four_validators.toml -r 1
- name: Archive test results
if: always()
uses: actions/upload-artifact@v4
with:
name: reconnect-test-logs
path: |
temp-logs/