1+ # .test.yml
2+
3+ name : test
4+
5+ permissions :
6+ contents : read
7+
8+ on :
9+ push :
10+ branches : [ main ]
11+ pull_request :
12+ merge_group :
13+
14+ concurrency :
15+ group : ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
16+ cancel-in-progress : true
17+
18+ jobs :
19+ required :
20+ runs-on : ubuntu-latest
21+ name : ubuntu / ${{ matrix.toolchain }}
22+ strategy :
23+ matrix :
24+ toolchain : [stable, beta]
25+ steps :
26+ - uses : actions/checkout@v4
27+ - name : Install ${{ matrix.toolchain }}
28+ uses : dtolnay/rust-toolchain@master
29+ with :
30+ toolchain : ${{ matrix.toolchain }}
31+ - uses : Swatinem/rust-cache@v2
32+ - name : cargo generate-lockfile
33+ if : hashFiles('Cargo.lock') == ''
34+ run : cargo generate-lockfile
35+ - name : cargo test --locked (all targets)
36+ run : cargo test --locked --all-features --all-targets
37+ - name : cargo test --doc (locked)
38+ run : cargo test --locked --all-features --doc
39+
40+ minimal :
41+ runs-on : ubuntu-latest
42+ name : ubuntu / stable / minimal-versions
43+ steps :
44+ - uses : actions/checkout@v4
45+ - name : Install stable
46+ uses : dtolnay/rust-toolchain@stable
47+ - name : Install nightly for -Zminimal-versions
48+ uses : dtolnay/rust-toolchain@nightly
49+ - uses : Swatinem/rust-cache@v2
50+ - name : Set default to stable
51+ run : rustup default stable
52+ - name : cargo update -Z minimal-versions
53+ run : cargo +nightly update -Z minimal-versions
54+ - name : cargo test (locked)
55+ run : cargo test --locked --all-features --all-targets
56+
57+ os-check :
58+ runs-on : ${{ matrix.os }}
59+ name : ${{ matrix.os }} / stable
60+ strategy :
61+ fail-fast : false
62+ matrix :
63+ os : [macos-latest, windows-latest]
64+ steps :
65+ - uses : actions/checkout@v4
66+ - name : Install stable
67+ uses : dtolnay/rust-toolchain@stable
68+ - uses : Swatinem/rust-cache@v2
69+ - name : cargo generate-lockfile
70+ if : hashFiles('Cargo.lock') == ''
71+ run : cargo generate-lockfile
72+ - name : cargo test (locked)
73+ run : cargo test --locked --all-features --all-targets
74+
75+ coverage :
76+ runs-on : ubuntu-latest
77+ name : ubuntu / stable / coverage
78+ permissions :
79+ contents : read
80+ id-token : write
81+ steps :
82+ - uses : actions/checkout@v4
83+ - name : Install stable + llvm-tools
84+ uses : dtolnay/rust-toolchain@stable
85+ with :
86+ components : llvm-tools-preview
87+ - uses : Swatinem/rust-cache@v2
88+ - name : Install cargo-llvm-cov
89+ uses : taiki-e/install-action@cargo-llvm-cov
90+ - name : cargo generate-lockfile
91+ if : hashFiles('Cargo.lock') == ''
92+ run : cargo generate-lockfile
93+ - name : cargo llvm-cov (produce lcov.info)
94+ run : cargo llvm-cov --locked --all-features --lcov --output-path lcov.info
95+ - name : Record OS/Rust (for Codecov)
96+ run : |
97+ echo "OS=${{ runner.os }}" >> "$GITHUB_ENV"
98+ echo "RUST=$(rustc --version)" >> "$GITHUB_ENV"
99+ - name : Upload to codecov.io (OIDC)
100+ if : ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false }}
101+ uses : codecov/codecov-action@v5
102+ with :
103+ use_oidc : true
104+ files : lcov.info
105+ env_vars : OS,RUST
106+ fail_ci_if_error : true
0 commit comments