-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (71 loc) · 2.02 KB
/
ci.yaml
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
name: CI
on:
push:
branches: [main]
pull_request:
# ensure that the workflow is only triggered once per PR, subsequent pushes to the PR will cancel
# and restart the workflow. See https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
RUST_BACKTRACE: 1
RUST_TEST_THREADS: 1
CARGO_TERM_COLOR: always
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
checks: write
steps:
- uses: actions/checkout@v4
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
- name: install rust nightly for rustfmt and clippy
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt, clippy
- name: Install taplo
uses: baptiste0928/cargo-install@v3
with:
crate: taplo-cli
- name: Check format
run: |
cargo +nightly fmt --all -- --check
cargo clippy --all-targets -- -D warnings
- name: Check typos
uses: crate-ci/typos@master
- name: Check toml format
run: taplo validate --colors never --no-schema
test:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
checks: write
steps:
- uses: actions/checkout@v4
- uses: taiki-e/install-action@v2
with:
tool: nextest
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
- name: Run tests
run: cargo nextest run
- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
if: success() || failure() # always run even if the previous step fails
with:
report_paths: '**/target/nextest/default/junit.xml'
# empty job for branch protection
ci-check:
runs-on: ubuntu-latest
needs: [lint, test]
timeout-minutes: 1
steps:
- name: Check
run: echo "All checks passed"