-
Notifications
You must be signed in to change notification settings - Fork 2
76 lines (66 loc) · 2 KB
/
ci.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
name: Continuous Integration
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
merge_group:
# 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:
# don't install husky hooks during CI as they are only needed for for pre-push
CARGO_HUSKY_DONT_INSTALL_HOOKS: true
jobs:
build:
name: Build & Test
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
toolchain: ["stable"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Install Rust toolchain ${{ matrix.toolchain }}}
uses: dtolnay/rust-toolchain@master
with:
targets: x86_64-unknown-linux-gnu
toolchain: ${{ matrix.toolchain }}
components: rustfmt, clippy
- name: Cache Cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ matrix.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Check the formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check --verbose
- name: Build the project
uses: actions-rs/cargo@v1
with:
command: check
args: --locked --verbose
- name: Check the lints
uses: actions-rs/cargo@v1
with:
command: clippy
args: --tests --verbose -- -D warnings
- name: Tests
uses: actions-rs/cargo@v1
with:
command: test