Skip to content

Commit f2ed639

Browse files
committed
used shared rust cache and add job to build code coverage from it
1 parent 626628b commit f2ed639

File tree

1 file changed

+87
-35
lines changed

1 file changed

+87
-35
lines changed

.github/workflows/ci_tests.yml

Lines changed: 87 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,28 @@ jobs:
2525
with:
2626
ref: ${{ github.event.pull_request.head.sha }}
2727
- uses: Swatinem/rust-cache@v2
28+
with:
29+
shared-key: "cov"
30+
- name: Install Rust toolchain
31+
uses: actions-rs/toolchain@v1
32+
with:
33+
toolchain: "1.65" # it says it can read the rust-toolchain file, but it fails if we omit this
34+
components: llvm-tools-preview
2835
- name: Install Nextest
2936
run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
3037
- name: Install cargo-llvm-cov
3138
uses: taiki-e/install-action@cargo-llvm-cov
3239
- name: Install deps
3340
run:
3441
sudo apt install -y protobuf-compiler libssl-dev libpq-dev libsqlite3-dev pkg-config
35-
3642
- name: Run vit-ss tests
37-
uses: actions-rs/toolchain@v1
38-
with:
39-
toolchain: "1.65" # it says it can read the rust-toolchain file, but it fails if we omit this
40-
- run: |
43+
run: |
4144
source <(cargo llvm-cov show-env --export-prefix)
4245
cargo build -p vit-servicing-station-cli -p vit-servicing-station-server
43-
cargo nextest run \
44-
-p vit-servicing-station-cli \
45-
-p vit-servicing-station-lib \
46-
-p vit-servicing-station-tests \
47-
-p vit-servicing-station-server \
48-
--profile ci
46+
cargo llvm-cov nextest --no-report --manifest-path ./src/vit-servicing-station/vit-servicing-station-cli/Cargo.toml --profile ci
47+
cargo llvm-cov nextest --no-report --manifest-path ./src/vit-servicing-station/vit-servicing-station-lib/Cargo.toml --profile ci
48+
cargo llvm-cov nextest --no-report --manifest-path ./src/vit-servicing-station/vit-servicing-station-server/Cargo.toml --profile ci
49+
cargo llvm-cov nextest --no-report --manifest-path ./src/vit-servicing-station/vit-servicing-station-tests/Cargo.toml --profile ci
4950
5051
catalyst_toolbox:
5152
name: Catalyst Toolbox Tests
@@ -58,6 +59,13 @@ jobs:
5859
with:
5960
ref: ${{ github.event.pull_request.head.sha }}
6061
- uses: Swatinem/rust-cache@v2
62+
with:
63+
shared-key: "cov"
64+
- name: Install Rust toolchain
65+
uses: actions-rs/toolchain@v1
66+
with:
67+
toolchain: "1.65" # it says it can read the rust-toolchain file, but it fails if we omit this
68+
components: llvm-tools-preview
6169
- name: Install Nextest
6270
run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
6371
- name: Install cargo-llvm-cov
@@ -67,12 +75,10 @@ jobs:
6775
sudo apt install -y protobuf-compiler libssl-dev libpq-dev libsqlite3-dev pkg-config
6876

6977
- name: Run catalyst-toolbox tests
70-
uses: actions-rs/toolchain@v1
71-
with:
72-
toolchain: "1.65" # it says it can read the rust-toolchain file, but it fails if we omit this
73-
- run: |
78+
run: |
7479
source <(cargo llvm-cov show-env --export-prefix)
75-
cargo nextest run -p catalyst-toolbox -p snapshot-lib --profile ci
80+
cargo llvm-cov nextest --no-report --manifest-path ./src/catalyst-toolbox/catalyst-toolbox/Cargo.toml --profile ci
81+
cargo llvm-cov nextest --no-report --manifest-path ./src/catalyst-toolbox/snapshot-lib/Cargo.toml --profile ci
7682
7783
voting_tools:
7884
name: Voting Tools Tests
@@ -85,6 +91,13 @@ jobs:
8591
with:
8692
ref: ${{ github.event.pull_request.head.sha }}
8793
- uses: Swatinem/rust-cache@v2
94+
with:
95+
shared-key: "cov"
96+
- name: Install Rust toolchain
97+
uses: actions-rs/toolchain@v1
98+
with:
99+
toolchain: "1.65" # it says it can read the rust-toolchain file, but it fails if we omit this
100+
components: llvm-tools-preview
88101
- name: Install Nextest
89102
run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
90103
- name: Install cargo-llvm-cov
@@ -94,12 +107,9 @@ jobs:
94107
sudo apt install -y protobuf-compiler libssl-dev libpq-dev libsqlite3-dev pkg-config
95108

96109
- name: Run voting-tools tests
97-
uses: actions-rs/toolchain@v1
98-
with:
99-
toolchain: "1.65" # it says it can read the rust-toolchain file, but it fails if we omit this
100-
- run: |
110+
run: |
101111
source <(cargo llvm-cov show-env --export-prefix)
102-
cargo nextest run -p voting_tools_rs --profile ci
112+
cargo llvm-cov nextest --no-report --manifest-path ./src/voting-tools-rs/Cargo.toml --profile ci
103113
104114
chain-libs:
105115
name: Chain Libs Tests
@@ -112,6 +122,13 @@ jobs:
112122
with:
113123
ref: ${{ github.event.pull_request.head.sha }}
114124
- uses: Swatinem/rust-cache@v2
125+
with:
126+
shared-key: "cov"
127+
- name: Install Rust toolchain
128+
uses: actions-rs/toolchain@v1
129+
with:
130+
toolchain: "1.65" # it says it can read the rust-toolchain file, but it fails if we omit this
131+
components: llvm-tools-preview
115132
- name: Install Nextest
116133
run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
117134
- name: Install cargo-llvm-cov
@@ -121,12 +138,29 @@ jobs:
121138
sudo apt install -y protobuf-compiler libssl-dev libpq-dev libsqlite3-dev pkg-config
122139

123140
- name: Run chain-libs tests
124-
uses: actions-rs/toolchain@v1
125-
with:
126-
toolchain: "1.65" # it says it can read the rust-toolchain file, but it fails if we omit this
127141
- run: |
128142
source <(cargo llvm-cov show-env --export-prefix)
129-
cargo nextest run -p "chain-*" --profile ci
143+
cargo llvm-cov nextest --no-report --manifest-path ./src/chain-libs/cardano-legacy-address/Cargo.toml --profile ci
144+
cargo llvm-cov nextest --no-report --manifest-path ./src/chain-libs/chain-addr/Cargo.toml --profile ci
145+
cargo llvm-cov nextest --no-report --manifest-path ./src/chain-libs/chain-core/Cargo.toml --profile ci
146+
cargo llvm-cov nextest --no-report --manifest-path ./src/chain-libs/chain-crypto/Cargo.toml --profile ci
147+
cargo llvm-cov nextest --no-report --manifest-path ./src/chain-libs/chain-evm/Cargo.toml --profile ci
148+
cargo llvm-cov nextest --no-report --manifest-path ./src/chain-libs/chain-impl-mockchain/Cargo.toml --profile ci
149+
cargo llvm-cov nextest --no-report --manifest-path ./src/chain-libs/chain-network/Cargo.toml --profile ci
150+
cargo llvm-cov nextest --no-report --manifest-path ./src/chain-libs/chain-ser/Cargo.toml --profile ci
151+
cargo llvm-cov nextest --no-report --manifest-path ./src/chain-libs/chain-storage/Cargo.toml --profile ci
152+
cargo llvm-cov nextest --no-report --manifest-path ./src/chain-libs/chain-time/Cargo.toml --profile ci
153+
cargo llvm-cov nextest --no-report --manifest-path ./src/chain-libs/chain-vote/Cargo.toml --profile ci
154+
cargo llvm-cov nextest --no-report --manifest-path ./src/chain-libs/imhamt/Cargo.toml --profile ci
155+
cargo llvm-cov nextest --no-report --manifest-path ./src/chain-libs/sparse-array/Cargo.toml --profile ci
156+
cargo llvm-cov nextest --no-report --manifest-path ./src/chain-libs/typed-bytes/Cargo.toml --profile ci
157+
cargo llvm-cov nextest --no-report --manifest-path ./src/chain-wallet-libs/bindings/wallet-c/Cargo.toml --profile ci
158+
cargo llvm-cov nextest --no-report --manifest-path ./src/chain-wallet-libs/bindings/wallet-core/Cargo.toml --profile ci
159+
cargo llvm-cov nextest --no-report --manifest-path ./src/chain-wallet-libs/bindings/wallet-wasm-js/Cargo.toml --profile ci
160+
cargo llvm-cov nextest --no-report --manifest-path ./src/chain-wallet-libs/chain-path-derivation/Cargo.toml --profile ci
161+
cargo llvm-cov nextest --no-report --manifest-path ./src/chain-wallet-libs/hdkeygen/Cargo.toml --profile ci
162+
cargo llvm-cov nextest --no-report --manifest-path ./src/chain-wallet-libs/symmetric-cipher/Cargo.toml --profile ci
163+
cargo llvm-cov nextest --no-report --manifest-path ./src/chain-wallet-libs/wallet/Cargo.toml --profile ci
130164
131165
jormungandr:
132166
name: Jormungandr Tests
@@ -139,19 +173,23 @@ jobs:
139173
with:
140174
ref: ${{ github.event.pull_request.head.sha }}
141175
- uses: Swatinem/rust-cache@v2
176+
with:
177+
shared-key: "cov"
178+
- name: Install Rust toolchain
179+
uses: actions-rs/toolchain@v1
180+
with:
181+
toolchain: "1.65" # it says it can read the rust-toolchain file, but it fails if we omit this
182+
components: llvm-tools-preview
142183
- name: Install Nextest
143184
run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
144185
- name: Install deps
145186
run:
146187
sudo apt install -y protobuf-compiler libssl-dev libpq-dev libsqlite3-dev pkg-config
147188

148189
- name: Run jormungandr tests
149-
uses: actions-rs/toolchain@v1
150-
with:
151-
toolchain: "1.65" # it says it can read the rust-toolchain file, but it fails if we omit this
152-
- run: |
190+
run: |
153191
source <(cargo llvm-cov show-env --export-prefix)
154-
cargo nextest run -p jormungandr --profile ci
192+
cargo llvm-cov nextest --no-report --manifest-path ./src/jormungandr/jormungandr/Cargo.toml --profile ci
155193
156194
jormungandr-integration:
157195
name: Jormungandr Integration Tests
@@ -164,6 +202,13 @@ jobs:
164202
with:
165203
ref: ${{ github.event.pull_request.head.sha }}
166204
- uses: Swatinem/rust-cache@v2
205+
with:
206+
shared-key: "cov"
207+
- name: Install Rust toolchain
208+
uses: actions-rs/toolchain@v1
209+
with:
210+
toolchain: "1.65" # it says it can read the rust-toolchain file, but it fails if we omit this
211+
components: llvm-tools-preview
167212
- name: Install Nextest
168213
run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
169214
- name: Install cargo-llvm-cov
@@ -173,14 +218,19 @@ jobs:
173218
sudo apt install -y protobuf-compiler libssl-dev libpq-dev libsqlite3-dev pkg-config
174219

175220
- name: Run jormungandr-integration tests
176-
uses: actions-rs/toolchain@v1
177-
with:
178-
toolchain: "1.65" # it says it can read the rust-toolchain file, but it fails if we omit this
179-
- run: |
221+
run: |
180222
source <(cargo llvm-cov show-env --export-prefix)
181223
cargo build -p jcli -p jormungandr -p explorer
182-
cargo nextest run -p jormungandr-integration-tests --profile ci
224+
cargo llvm-cov nextest --no-report --manifest-path ./src/jormungandr/testing/jormungandr-integration-tests/Cargo.toml --profile ci
183225
226+
code-coverage:
227+
name: Generage and publish code coverage
228+
runs-on: ubuntu-latest
229+
needs: [vit_servicing_station, catalyst_toolbox, voting_tools, chain-libs, jormungandr, jormungandr-integration]
230+
steps:
231+
- uses: Swatinem/rust-cache@v2
232+
with:
233+
shared-key: "cov"
184234
- name: Generate lcov.info
185235
run: cargo llvm-cov report --lcov --output-path ./lcov.info
186236

@@ -231,6 +281,8 @@ jobs:
231281
with:
232282
ref: ${{ github.event.pull_request.head.sha }}
233283
- uses: Swatinem/rust-cache@v2
284+
with:
285+
shared-key: "cov"
234286
- name: Install deps
235287
run:
236288
sudo apt install -y protobuf-compiler libssl-dev libpq-dev libsqlite3-dev pkg-config

0 commit comments

Comments
 (0)