-
-
Notifications
You must be signed in to change notification settings - Fork 10
136 lines (131 loc) · 4.13 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Test
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Update local toolchain
run: |
rustup update
rustup component add rustfmt
- name: Toolchain info
run: |
rustc --version
cargo --version --verbose
cargo fmt --version
- name: Format
run: |
cargo fmt --check
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Update local toolchain
run: |
rustup update
rustup component add clippy
- name: Toolchain info
run: |
rustc --version
cargo --version --verbose
cargo clippy --version
- name: Clippy check
run: |
cargo clippy --all-features --all-targets
- name: Clippy check (use-gauge-on-cpu-seconds-total)
run: |
cargo clippy --features use-gauge-on-cpu-seconds-total --all-targets
test:
strategy:
matrix:
runner: [ubuntu-latest, macos-latest, windows-latest]
env:
RUNNER: ${{ matrix.runner }}
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Update local toolchain
run: |
rustup update
rustup component add llvm-tools-preview
cargo install cargo-llvm-cov
- name: Toolchain info
run: |
rustc --version
cargo --version --verbose
cargo llvm-cov --version
- name: Test
run: |
cargo llvm-cov --all-features --lcov --output-path lcov.info
- name: Test (use-gauge-on-cpu-seconds-total)
run: |
cargo llvm-cov --features use-gauge-on-cpu-seconds-total --lcov --output-path lcov.use-gauge-on-cpu-seconds-total.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info,lcov.use-gauge-on-cpu-seconds-total.info
env_vars: RUNNER
test-cross-platform:
strategy:
matrix:
# don't forget to update current os versions, see https://github.com/cross-platform-actions/action?tab=readme-ov-file#supported-platforms
include:
- { os: freebsd, version: "14.1", prepare_cmd: "sudo pkg install -y rust cmake rust-bindgen-cli" }
# 7.6 is not supported by action@v0.25.0 yet
- { os: openbsd, version: "7.5", prepare_cmd: "sudo pkg_add rust cmake llvm%17; export LIBCLANG_PATH=/usr/local/llvm17/lib" }
fail-fast: false
runs-on: ubuntu-latest
name: "test (${{matrix.os}}-${{matrix.version}})"
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{matrix.os}}-${{matrix.version}}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Cross-platform test
uses: cross-platform-actions/action@v0.25.0
with:
operating_system: ${{matrix.os}}
version: "${{matrix.version}}"
run: |
${{matrix.prepare_cmd}}
cargo test -- --nocapture