Skip to content

Commit 203e79e

Browse files
committed
build: Add Github actions
This includes checks for DCO, cargo fmt/clippy, cargo.toml format, and unit tests. Signed-off-by: Bo Chen <bchen@crusoe.ai> Suggested-by: Rob Bradford <rbradford@rivosinc.com>
1 parent 654454a commit 203e79e

File tree

4 files changed

+112
-0
lines changed

4 files changed

+112
-0
lines changed

.github/workflows/dco.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: DCO
2+
on: [pull_request]
3+
4+
jobs:
5+
check:
6+
name: DCO Check ("Signed-Off-By")
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v5
10+
- name: Set up Python 3.x
11+
uses: actions/setup-python@v6
12+
with:
13+
python-version: '3.x'
14+
- name: Check DCO
15+
if: ${{ github.event_name == 'pull_request' }}
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
run: |
19+
pip3 install -U dco-check

.github/workflows/quality.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Quality Checks
2+
on: [pull_request, create]
3+
4+
jobs:
5+
build:
6+
name: Quality (clippy, rustfmt)
7+
runs-on: ubuntu-latest
8+
continue-on-error: ${{ matrix.rust == 'beta' }}
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
rust: [stable, beta]
13+
target:
14+
- aarch64-unknown-linux-gnu
15+
- aarch64-unknown-linux-musl
16+
- x86_64-unknown-linux-gnu
17+
- x86_64-unknown-linux-musl
18+
19+
steps:
20+
- name: Code checkout
21+
uses: actions/checkout@v4
22+
23+
- name: Install Rust toolchain (${{ matrix.rust }})
24+
uses: actions-rs/toolchain@v1
25+
with:
26+
toolchain: ${{ matrix.rust }}
27+
target: ${{ matrix.target }}
28+
override: true
29+
components: rustfmt, clippy
30+
31+
- name: Formatting (rustfmt)
32+
run: cargo fmt -- --check
33+
34+
- name: Clippy
35+
uses: actions-rs/cargo@v1
36+
with:
37+
use-cross: ${{ matrix.target != 'x86_64-unknown-linux-gnu' }}
38+
command: clippy
39+
args: --target=${{ matrix.target }} --workspace --all-targets --tests --all-features -- -D warnings -D clippy::undocumented_unsafe_blocks

.github/workflows/taplo.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Cargo.toml format check (taplo)
2+
on:
3+
pull_request:
4+
paths:
5+
- '**/Cargo.toml'
6+
7+
jobs:
8+
cargo_toml_format:
9+
name: Cargo.toml format check
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Code checkout
13+
uses: actions/checkout@v4
14+
15+
- name: Setup Taplo
16+
uses: uncenter/setup-taplo@v1.0.8
17+
18+
- name: Taplo format check
19+
run: taplo fmt --check

.github/workflows/unit_tests.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Unit tests
2+
on: [pull_request, create]
3+
4+
jobs:
5+
build:
6+
name: Unit tests
7+
runs-on: ubuntu-latest
8+
continue-on-error: ${{ matrix.rust == 'beta' }}
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
rust: [stable, beta]
13+
target:
14+
- aarch64-unknown-linux-gnu
15+
- aarch64-unknown-linux-musl
16+
- x86_64-unknown-linux-gnu
17+
- x86_64-unknown-linux-musl
18+
19+
steps:
20+
- name: Code checkout
21+
uses: actions/checkout@v4
22+
23+
- name: Install Rust toolchain (${{ matrix.rust }})
24+
uses: actions-rs/toolchain@v1
25+
with:
26+
toolchain: ${{ matrix.rust }}
27+
target: ${{ matrix.target }}
28+
override: true
29+
30+
- name: Unit tests
31+
uses: actions-rs/cargo@v1
32+
with:
33+
use-cross: ${{ matrix.target != 'x86_64-unknown-linux-gnu' }}
34+
command: test
35+
args: --target=${{ matrix.target }} --workspace --all-targets --tests --all-features

0 commit comments

Comments
 (0)