-
Notifications
You must be signed in to change notification settings - Fork 0
136 lines (132 loc) · 4.41 KB
/
rust.yml
File metadata and controls
136 lines (132 loc) · 4.41 KB
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: Rust
run-name: Build ${{ github.ref == 'refs/heads/main' && 'Nightly' || github.event_name == 'pull_request' && format('{0} {1}', 'Pull Request', github.event.pull_request.number) || format('{0} {1}', 'Branch', github.ref) }} by @${{ github.actor }}
on:
push:
branches: [ main ]
paths:
- "plugins/**/crates/**/*.rs"
- "plugins/**/crates/**/Cargo.toml"
- "Cargo.toml"
- "Cargo.lock"
- "CHANGELOG.md"
- ".github/workflows/rust.yml"
pull_request:
branches: [ main ]
paths:
- "plugins/*/crates/**/*.rs"
- "plugins/**/crates/**/Cargo.toml"
- "Cargo.toml"
- "Cargo.lock"
- "CHANGELOG.md"
- ".github/workflows/rust.yml"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
env:
CARGO_TERM_COLOR: always
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
AWS_LC_SYS_PREBUILT_NASM: 1
jobs:
formatting:
name: Verify code formatting
runs-on: ubuntu-22.04
steps:
- name: VCS Checkout
uses: actions/checkout@v4
- name: Install latest nightly
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2025-08-05
components: rustfmt
- name: Run cargo fmt
run: cargo fmt --all -- --check
check_changelog:
name: Check Changelog
runs-on: ubuntu-22.04
steps:
- uses: tarides/changelog-check-action@v3
with:
changelog: CHANGELOG.md
if: github.actor != 'dependabot[bot]'
lint:
name: Lint
needs: [ formatting, check_changelog ]
if: always() && (!contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled'))
runs-on: ubuntu-22.04
strategy:
matrix:
toolchain: [ stable, nightly-2025-08-05 ]
target:
- x86_64-unknown-linux-gnu
# Musl is not yet compatible with openssl-sys and gitoxide doesn't support rustls yet
# - x86_64-unknown-linux-musl
steps:
- name: VCS Checkout
uses: actions/checkout@v4
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
target: ${{ matrix.target }}
components: clippy
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.9
- name: Run cargo clippy
run: cargo clippy
build:
name: Release Build
needs: [ lint ]
if: always() && (!contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled'))
strategy:
matrix:
os: [ ubuntu-22.04, ubuntu-22.04-arm, macos-latest, windows-latest ]
toolchain: [ stable, nightly-2025-08-05 ]
runs-on: ${{ matrix.os }}
steps:
- name: VCS Checkout
uses: actions/checkout@v4
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.9
- name: Build (Release Mode)
run: cargo build --release --verbose
test:
name: Tests
needs: [ lint ]
if: always() && (!contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled'))
strategy:
matrix:
toolchain: [ stable, nightly-2025-08-05 ]
target:
- x86_64-unknown-linux-gnu
# Musl is not yet compatible with openssl-sys and gitoxide doesn't support rustls yet
# - x86_64-unknown-linux-musl
runs-on: ubuntu-22.04
steps:
- name: VCS Checkout
uses: actions/checkout@v4
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
target: ${{ matrix.target }}
- name: Install musl-tools
uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: musl-tools # provides musl-gcc
version: 1.0
if: matrix.target == 'x86_64-unknown-linux-musl'
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.9
- name: Test (Release Mode)
run: cargo test --release --verbose --target ${{ matrix.target }}