Skip to content

Commit a0e94a2

Browse files
committed
add test workflow
1 parent f2e13f0 commit a0e94a2

1 file changed

Lines changed: 60 additions & 0 deletions

File tree

.github/workflows/test.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Cargo test
2+
3+
concurrency:
4+
group: test-${{ github.ref }}
5+
cancel-in-progress: true
6+
7+
on:
8+
pull_request:
9+
10+
## Allow running workflow manually from the Actions tab
11+
workflow_dispatch:
12+
inputs:
13+
verbose:
14+
description: "Output more information when triggered manually"
15+
required: false
16+
default: ""
17+
18+
env:
19+
CARGO_TERM_COLOR: always
20+
VERBOSE: ${{ github.events.input.verbose }}
21+
22+
jobs:
23+
test:
24+
name: cargo test (${{ matrix.directory }})
25+
runs-on: ubuntu-latest
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
include:
30+
- directory: substrate/frame
31+
exclude: '^(contracts|pallet-revive-fixtures|pallet-contracts-fixtures-common)$'
32+
- directory: substrate/primitives
33+
exclude: '^sp-state-machine-fuzz$'
34+
- directory: substrate/client
35+
exclude: '^THIS_PATTERN_MATCHES_NOTHING$'
36+
env:
37+
RUST_BACKTRACE: full
38+
SKIP_WASM_BUILD: 1
39+
SKIP_PALLET_REVIVE_FIXTURES: 1
40+
steps:
41+
- name: Check-out repository under $GITHUB_WORKSPACE
42+
uses: actions/checkout@v4
43+
44+
- name: Install Rust
45+
uses: actions-rs/toolchain@v1
46+
with:
47+
toolchain: stable
48+
49+
- name: Utilize Shared Rust Cache
50+
uses: Swatinem/rust-cache@v2
51+
with:
52+
key: cargo-test
53+
cache-on-failure: true
54+
55+
- name: Test ${{ matrix.directory }}
56+
run: |
57+
find ${{ matrix.directory }} -name Cargo.toml -exec yq -r '.package.name' {} \; 2>/dev/null \
58+
| grep -vE '${{ matrix.exclude }}' \
59+
| while read crate; do echo "-p $crate"; done \
60+
| xargs cargo test --all-features

0 commit comments

Comments
 (0)