-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (53 loc) · 1.7 KB
/
ci.yml
File metadata and controls
65 lines (53 loc) · 1.7 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
name: CI
on:
pull_request:
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-D warnings"
jobs:
build-test:
name: Build and test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 # stable
with:
components: clippy, rustfmt
- name: Install protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Restore Rust cache
uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
with:
cache-on-failure: true
- name: Check compilation
run: cargo check --workspace
- name: Check formatting
if: runner.os == 'Linux'
run: cargo fmt --all -- --check
- name: Clippy lints
run: cargo clippy --workspace --all-targets -- -D warnings
- name: Run tests
run: cargo test --workspace
- name: Check copyright headers
if: matrix.os != 'windows-latest'
shell: bash
run: |
missing=0
for f in $(find . -name '*.rs' -not -path '*/gen/*' -not -path '*/target/*'); do
if ! head -1 "$f" | grep -q '^// Copyright AGNTCY'; then
echo "Missing header: $f"
missing=$((missing + 1))
fi
done
if [ "$missing" -gt 0 ]; then
echo "ERROR: $missing file(s) missing copyright header"
exit 1
fi