Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: CI

on:
push:
branches: [main]
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

jobs:
check:
name: Format, lint & test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- uses: Swatinem/rust-cache@v2

- name: Check formatting
run: cargo fmt --all --check

- name: Clippy
run: cargo clippy --all-targets -- -D warnings

- name: Test
run: cargo test

cross:
name: Cross-compile ${{ matrix.target }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target:
# Pi Zero W
- arm-unknown-linux-musleabihf
# Pi Zero 2 W
- aarch64-unknown-linux-musl
steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}

# Prebuilt binary — `cargo install cross` compiles from source and takes
# minutes on every run.
- uses: taiki-e/install-action@cross

- name: Build
run: cross build --release --target ${{ matrix.target }}
26 changes: 20 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@ on:
push:
tags:
- "v*"
workflow_dispatch:

permissions:
contents: write

env:
CARGO_TERM_COLOR: always

jobs:
release:
strategy:
# One broken target should not hide the others.
fail-fast: false
matrix:
include:
# Linux x86_64 (musl)
Expand Down Expand Up @@ -38,11 +44,18 @@ jobs:

steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}

# Prebuilt binary — `cargo install cross` compiles from source and adds
# minutes to every job.
- name: Install cross
if: matrix.build == 'cross'
run: cargo install cross
uses: taiki-e/install-action@cross

- name: Install target
if: matrix.build == 'cargo'
Expand All @@ -61,17 +74,18 @@ jobs:
fi
shell: bash

- name: Strip binary
if: runner.os != 'Windows' && matrix.build == 'cargo'
run: strip target/${{ matrix.target }}/release/${{ matrix.binary }}
# No explicit strip step: [profile.release] already sets strip = true.

- name: Rename binary
- name: Rename binary and checksum it
shell: bash
run: |
cp target/${{ matrix.target }}/release/${{ matrix.binary }} \
${{ matrix.asset }}
sha256sum ${{ matrix.asset }} > ${{ matrix.asset }}.sha256

- name: Upload to GitHub Release
uses: softprops/action-gh-release@v2
with:
files: ${{ matrix.asset }}
files: |
${{ matrix.asset }}
${{ matrix.asset }}.sha256
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Generated files
/target/
/Cargo.lock
*.bk
*.bak.rs

Expand Down
Loading
Loading