Skip to content

Commit 4df78e9

Browse files
committed
ci: Added test workflow
1 parent 0d0aebb commit 4df78e9

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed

.github/workflows/test.yaml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
permissions:
2+
contents: read
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
# Spend CI time only on latest ref: https://github.com/jonhoo/rust-ci-conf/pull/5
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
10+
cancel-in-progress: true
11+
name: test
12+
jobs:
13+
required:
14+
runs-on: ubuntu-latest
15+
name: ubuntu / ${{ matrix.toolchain }}
16+
strategy:
17+
matrix:
18+
toolchain: [stable, beta]
19+
steps:
20+
- uses: actions/checkout@v3
21+
with:
22+
submodules: true
23+
- name: Install ${{ matrix.toolchain }}
24+
uses: dtolnay/rust-toolchain@master
25+
with:
26+
toolchain: ${{ matrix.toolchain }}
27+
- name: cargo generate-lockfile
28+
if: hashFiles('Cargo.lock') == ''
29+
run: cargo generate-lockfile
30+
# https://twitter.com/jonhoo/status/1571290371124260865
31+
- name: cargo test --locked
32+
run: cargo test --locked --all-features --all-targets
33+
# https://github.com/rust-lang/cargo/issues/6669
34+
- name: cargo test --doc
35+
run: cargo test --locked --all-features --doc
36+
minimal:
37+
runs-on: ubuntu-latest
38+
name: ubuntu / stable / minimal-versions
39+
steps:
40+
- uses: actions/checkout@v3
41+
with:
42+
submodules: true
43+
- name: Install stable
44+
uses: dtolnay/rust-toolchain@stable
45+
- name: Install nightly for -Zminimal-versions
46+
uses: dtolnay/rust-toolchain@nightly
47+
- name: rustup default stable
48+
run: rustup default stable
49+
- name: cargo update -Zminimal-versions
50+
run: cargo +nightly update -Zminimal-versions
51+
- name: cargo test
52+
run: cargo test --locked --all-features --all-targets
53+
os-check:
54+
runs-on: ${{ matrix.os }}
55+
name: ${{ matrix.os }} / stable
56+
strategy:
57+
fail-fast: false
58+
matrix:
59+
os: [macos-latest, windows-latest]
60+
steps:
61+
- uses: actions/checkout@v3
62+
with:
63+
submodules: true
64+
- name: Install stable
65+
uses: dtolnay/rust-toolchain@stable
66+
- name: cargo generate-lockfile
67+
if: hashFiles('Cargo.lock') == ''
68+
run: cargo generate-lockfile
69+
- name: cargo test
70+
run: cargo test --locked --all-features --all-targets
71+
coverage:
72+
runs-on: ubuntu-latest
73+
name: ubuntu / stable / coverage
74+
steps:
75+
- uses: actions/checkout@v3
76+
with:
77+
submodules: true
78+
- name: Install stable
79+
uses: dtolnay/rust-toolchain@stable
80+
with:
81+
components: llvm-tools-preview
82+
- name: cargo install cargo-llvm-cov
83+
uses: taiki-e/install-action@cargo-llvm-cov
84+
- name: cargo generate-lockfile
85+
if: hashFiles('Cargo.lock') == ''
86+
run: cargo generate-lockfile
87+
- name: cargo llvm-cov
88+
run: cargo llvm-cov --locked --all-features --lcov --output-path lcov.info
89+
- name: Upload to codecov.io
90+
uses: codecov/codecov-action@v3
91+
with:
92+
fail_ci_if_error: true

0 commit comments

Comments
 (0)