-
Notifications
You must be signed in to change notification settings - Fork 7
85 lines (75 loc) · 2.36 KB
/
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
name: Test
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test:
runs-on: ubuntu-22.04
strategy:
matrix:
rust-toolchain:
- stable
- beta
- nightly
feature:
- default
- memchr
- serde
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup | Rust
run: |
rustup toolchain install ${{ matrix.rust-toolchain }} --profile minimal --component clippy
rustup default ${{ matrix.rust-toolchain }}
- name: Setup cache for cargo
uses: actions/cache@v4
with:
path: target
key: "${{ runner.os }}-cargo-${{ matrix.rust-toolchain }}-${{ matrix.feature }}"
- name: Install cargo-binstall
run: |
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
- name: Install cargo-tarpaulin
run: |
cargo binstall -y cargo-tarpaulin
- name: Measure code coverage with ${{ matrix.feature }} feature
run: |
cargo tarpaulin -v --out Xml --ciserver github-actions --no-default-features --features=${{ matrix.feature }}
- name: Upload coverage statistics
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
flags: rust-${{ matrix.rust-toolchain }},${{ matrix.feature }}
- name: Run Clippy
run: |
# we need to exclude --bench, as it only works on nightly
cargo clippy --lib --bins --tests --no-default-features --features=${{ matrix.feature }} -- -D warnings
all-tests:
runs-on: ubuntu-22.04
needs:
- test
if: always()
steps:
- name: Success
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0
- name: Failure
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1
lint:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Rust stable
run: |
rustup toolchain install stable --profile minimal --component rustfmt
rustup default stable
- name: Check code format
run: |
cargo fmt --all -- --check