Skip to content

Commit 080a4dc

Browse files
committed
ci: add build.yml
Signed-off-by: Xin Liu <[email protected]>
1 parent 81a0126 commit 080a4dc

File tree

1 file changed

+108
-0
lines changed

1 file changed

+108
-0
lines changed

.github/workflows/build.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- dev
8+
- release-*
9+
- feat-*
10+
- ci-*
11+
- refactor-*
12+
- fix-*
13+
- test-*
14+
paths:
15+
- '.github/workflows/build.yml'
16+
- '**/Cargo.toml'
17+
- '**/*.rs'
18+
pull_request:
19+
branches: [ main ]
20+
21+
env:
22+
CARGO_TERM_COLOR: always
23+
24+
jobs:
25+
check:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Clone project
29+
uses: actions/checkout@v5
30+
31+
- name: Install Rust-nightly
32+
uses: actions-rust-lang/setup-rust-toolchain@v1
33+
with:
34+
toolchain: nightly
35+
components: rustfmt, clippy
36+
37+
- name: Run clippy
38+
run: |
39+
cargo +nightly clippy --version
40+
cargo +nightly clippy --all-features -- -D warnings
41+
42+
- name: Run fmt
43+
run: |
44+
cargo +nightly fmt --all -- --check
45+
46+
build_macos:
47+
runs-on: ${{ matrix.os }}
48+
strategy:
49+
matrix:
50+
os: [macos-14, macos-15]
51+
rust: [1.90.0]
52+
steps:
53+
- name: Clone project
54+
id: checkout
55+
uses: actions/checkout@v5
56+
57+
- name: Install Rust-stable
58+
uses: actions-rust-lang/setup-rust-toolchain@v1
59+
with:
60+
toolchain: ${{ matrix.rust }}
61+
62+
- name: Build
63+
run: |
64+
cargo build --release --verbose
65+
66+
- name: Run tests
67+
run: cargo test --verbose
68+
69+
build_linux:
70+
runs-on: ${{ matrix.runner }}
71+
container:
72+
image: ${{ matrix.image }}
73+
strategy:
74+
matrix:
75+
build: [linux-x86_64, linux-aarch64]
76+
include:
77+
- build: linux-x86_64
78+
runner: ubuntu-latest
79+
image: ubuntu:20.04
80+
target: x86_64-unknown-linux-gnu
81+
- build: linux-aarch64
82+
runner: ubuntu-24.04-arm
83+
image: arm64v8/ubuntu:20.04
84+
target: aarch64-unknown-linux-gnu
85+
rust: [1.90.0]
86+
fail-fast: false
87+
88+
steps:
89+
- name: Clone project
90+
id: checkout
91+
uses: actions/checkout@v5
92+
93+
- name: Install dependencies silently
94+
run: |
95+
export DEBIAN_FRONTEND=noninteractive
96+
apt update && apt install -y curl build-essential pkg-config
97+
98+
- name: Install Rust toolchain
99+
uses: actions-rust-lang/setup-rust-toolchain@v1
100+
with:
101+
toolchain: ${{ matrix.rust }}
102+
103+
- name: Build
104+
run: |
105+
cargo build --release --verbose --target ${{ matrix.target }}
106+
107+
- name: Run tests
108+
run: cargo test --verbose

0 commit comments

Comments
 (0)