-
-
Notifications
You must be signed in to change notification settings - Fork 1
82 lines (70 loc) · 2.09 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
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Setup toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Setup cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: "babyrite/gh-actions-cache"
- name: Run rustfmt
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --all-targets --all-features
- name: Run test
run: cargo test --verbose
build:
name: build (${{ matrix.job.target }})
runs-on: ${{ matrix.job.os || 'ubuntu-latest' }}
needs: check
strategy:
fail-fast: false
matrix:
# Note: babyrite will no longer support Windows
job:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
use-cross: false
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
use-cross: true
- os: macos-latest
target: x86_64-apple-darwin
use-cross: false
- os: macos-latest
target: aarch64-apple-darwin
use-cross: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup toolchain
uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.job.target }}
- name: Setup cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: "babyrite/gh-actions-cache"
- name: Install cross
if: matrix.job.use-cross
run: cargo install cross
# note: In Ubuntu-latest (Ubuntu 24), musl-tools has disappeared, so it must be installed separately.
- name: Install musl-gcc
if: matrix.job.target == 'x86_64-unknown-linux-musl'
run: sudo apt-get update && sudo apt-get install -y musl-tools
- name: Build
run: |
cargo build --verbose --target ${{ matrix.job.target }}