-
Notifications
You must be signed in to change notification settings - Fork 3
111 lines (90 loc) · 2.8 KB
/
rust.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
name: rust
on:
push:
branches: ["master"]
pull_request:
workflow_dispatch:
concurrency:
group: rust-${{ github.head_ref || github.ref || github.run_id }}
cancel-in-progress: true
env:
# Always colorize output.
CARGO_TERM_COLOR: always
# Disable incremental compilation.
CARGO_INCREMENTAL: 0
# Allow more retries for network requests in cargo (downloading crates).
CARGO_NET_RETRY: 10
# Allow more retries for network requests in rustup (downloading toolchains).
RUSTUP_MAX_RETRIES: 10
# Don't emit giant backtraces in the CI logs.
RUST_BACKTRACE: short
# RUSTFLAGS: -D warnings
RUSTDOCFLAGS: -D warnings
jobs:
just-lint:
runs-on: ubuntu-latest
steps:
- name: Install Just
uses: extractions/setup-just@v1
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
run: |
rustup toolchain install stable --profile minimal
echo "RUST_VERSION_HASH=$(rustc --version | sha256sum | awk '{print $1}')" >> $GITHUB_ENV
- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/
./target/debug/build/
key: ${{ runner.os }}-rust-${{ env.RUST_VERSION_HASH }}-${{ hashFiles('./Cargo.lock') }}
- name: Run linter
run: just lint
just-fmt:
runs-on: ubuntu-latest
steps:
- name: Install Just
uses: extractions/setup-just@v1
- name: Checkout repository
uses: actions/checkout@v4
- name: Install minimal nightly rustfmt
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
components: rustfmt
- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/
./target/debug/build/
key: ${{ runner.os }}-rust-${{ env.RUST_VERSION_HASH }}-${{ hashFiles('./Cargo.lock') }}
- name: Run formatter
run: just fmt-check
just-test:
runs-on: ubuntu-latest
needs: [just-lint, just-fmt]
steps:
- name: Install Just
uses: extractions/setup-just@v1
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
run: |
rustup toolchain install stable --profile minimal
echo "RUST_VERSION_HASH=$(rustc --version | sha256sum | awk '{print $1}')" >> $GITHUB_ENV
- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/
./target/debug/build/
key: ${{ runner.os }}-rust-${{ env.RUST_VERSION_HASH }}-${{ hashFiles('./Cargo.lock') }}
- name: Install dependencies
uses: taiki-e/install-action@v2
with:
tool: nextest
- name: Run tests
run: just test