-
Notifications
You must be signed in to change notification settings - Fork 37
115 lines (108 loc) · 3.26 KB
/
ci.yaml
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
on: [push, pull_request]
name: ci
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
jobs:
rustfmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
components: rustfmt
- run: cargo fmt -- --check
clippy:
name: clippy
runs-on: ubuntu-latest
steps:
- name: system dependencies
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
components: clippy
- run: cargo clippy --locked --all-features
build-gnu:
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
runs-on: ubuntu-latest
steps:
- name: system dependencies
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler gcc-aarch64-linux-gnu
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- run: cargo build --target ${{ matrix.target }}
- run: cargo test
if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }}
- run: cargo xtask --help
if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }}
build-musl:
strategy:
matrix:
target:
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-musl
runs-on: ubuntu-latest
container:
image: rust:alpine
volumes:
- /usr/local/cargo/registry
steps:
- name: system dependencies
run: apk add --no-cache tar musl-dev lld protoc bash clang llvm make perl
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- run: cargo build --target ${{ matrix.target }}
- run: cargo test --target ${{ matrix.target }}
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
- run: cargo run -p xtask --target ${{ matrix.target }} -- --help
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
build-apple:
strategy:
matrix:
target:
- x86_64-apple-darwin
- aarch64-apple-darwin
runs-on: macos-latest
env:
SELECT_XCODE: /Applications/Xcode_15.3.app
steps:
- name: xcode
run: sudo xcode-select -s "${SELECT_XCODE}"
- name: protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- run: cargo build --target ${{ matrix.target }}
- run: cargo test
if: ${{ matrix.target == 'x86_64-apple-darwin' }}
- run: cargo xtask --help
if: ${{ matrix.target == 'x86_64-apple-darwin' }}