-
Notifications
You must be signed in to change notification settings - Fork 85
75 lines (71 loc) · 2.29 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
name: CI
on:
pull_request:
push:
branches:
- master
env:
RUSTFLAGS: -Dwarnings
RUST_BACKTRACE: 1
CARGO_INCREMENTAL: 0 # makes cache smaller
CARGO_PROFILE_DEV_DEBUG: 0
jobs:
clippy:
name: Clipy and format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Check format
run: cargo fmt -- --check
- name: Cache cargo index
uses: actions/cache@v4
with:
key: immutable # this will always be hit because it's a constant
path: ~/.cargo/registry/index
- name: Cache cargo crates
uses: actions/cache@v4
with:
key: crates-${{ hashFiles('Cargo.toml') }} # don't accumulate .crate files of old versions
path: ~/.cargo/registry/cache # target/ dir of clippy is not worth caching
- name: Fetch dependencies
run: cargo fetch
- name: Run clippy
run: cargo clippy --all --all-targets --target-dir=target
- name: Run clippy on integration tests
run: cargo clippy --all --all-targets --features=integration_test --target-dir=target
- name: Run clippy on C API
run: cargo clippy --all-targets --manifest-path=c-api/Cargo.toml --target-dir=target
- name: Run clippy on JS API
run: cargo clippy --all-targets --manifest-path=js-api/Cargo.toml --target-dir=target
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: dtolnay/rust-toolchain@stable
- name: Cache cargo index and registry
uses: actions/cache@v4
with:
key: immutable
path: ~/.cargo/registry/index
- name: Cache cargo crates
uses: actions/cache@v4
with:
key: crates-${{ hashFiles('Cargo.toml') }} # don't accumulate .crate files of old versions
path: ~/.cargo/registry/cache
- name: Fetch dependencies
run: cargo fetch
- name: Cache target directory
uses: actions/cache@v4
with:
path: target
key: target-${{ hashFiles('Cargo.toml') }}
- name: Run Rust tests
run: scripts/test.sh