Build and Release Firmware / firmware (ak4490) (push) Successful in 16s
Build and Release Firmware / firmware (cs4398) (push) Successful in 14s
Build and Release Firmware / firmware (evk) (push) Successful in 14s
Build and Release Firmware / cli (aarch64-unknown-linux-musl) (push) Successful in 1m20s
Build and Release Firmware / cli (x86_64-unknown-linux-musl) (push) Canceled after 0s
Build and Release Firmware / release (push) Canceled after 0s
Build and Release Firmware / cli (x86_64-pc-windows-gnu) (push) Canceled after 1m22s
137 lines
3.9 KiB
YAML
137 lines
3.9 KiB
YAML
name: Build and Release Firmware
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
|
|
env:
|
|
TARGET: thumbv8m.main-none-eabihf
|
|
# The catthehacker image installs rust here and only symlinks ~/.rustup and ~/.cargo to it.
|
|
# actions/cache archives the symlink, not its contents, so point at the real paths.
|
|
RUSTUP_HOME: /usr/share/rust/.rustup
|
|
CARGO_HOME: /usr/share/rust/.cargo
|
|
|
|
jobs:
|
|
firmware:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: catthehacker/ubuntu:rust-latest
|
|
strategy:
|
|
fail-fast: true
|
|
matrix:
|
|
variant: [cs4398, ak4490, evk]
|
|
env:
|
|
FEATURES: ${{ matrix.variant }},hid
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Cache rustup
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ env.RUSTUP_HOME }}
|
|
key: rustup-firmware-${{ env.TARGET }}-${{ runner.os }}
|
|
|
|
- name: Install Rust Toolchain
|
|
run: |
|
|
rustup target install ${{ env.TARGET }}
|
|
rustup component add llvm-tools
|
|
|
|
- name: Cache cargo
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
shared-key: firmware-${{ matrix.variant }}
|
|
|
|
- name: Install cargo-binutils
|
|
run: cargo binstall -y --locked cargo-binutils
|
|
|
|
- name: Build firmware (${{ matrix.variant }})
|
|
working-directory: firmware
|
|
run: cargo build --release --target ${{ env.TARGET }} --no-default-features --features "${{ env.FEATURES }}"
|
|
|
|
- name: Create hex file
|
|
working-directory: firmware
|
|
run: cargo objcopy --release --target ${{ env.TARGET }} --no-default-features --features "${{ env.FEATURES }}" -- -O ihex ../target/${{ env.TARGET }}/release/guac-${{ matrix.variant }}.hex
|
|
|
|
- name: Package
|
|
run: |
|
|
out=target/${{ env.TARGET }}/release
|
|
cp "$out/guac" "$out/guac-${{ matrix.variant }}.elf"
|
|
mkdir -p dist
|
|
zip -j "dist/guac-firmware-${{ matrix.variant }}.zip" "$out/guac-${{ matrix.variant }}.elf" "$out/guac-${{ matrix.variant }}.hex"
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: firmware-${{ matrix.variant }}
|
|
path: dist/*.zip
|
|
|
|
cli:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: catthehacker/ubuntu:rust-latest
|
|
strategy:
|
|
fail-fast: true
|
|
matrix:
|
|
target:
|
|
- aarch64-unknown-linux-musl
|
|
- x86_64-pc-windows-gnu
|
|
- x86_64-unknown-linux-musl
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Cache rustup
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ env.RUSTUP_HOME }}
|
|
key: rustup-cli-${{ matrix.target }}-${{ runner.os }}
|
|
|
|
- name: Install Rust Toolchain
|
|
run: rustup target install ${{ matrix.target }}
|
|
|
|
- name: Cache cargo
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
shared-key: cli-${{ matrix.target }}
|
|
|
|
- name: Install cargo-zigbuild Toolchain
|
|
run: pip install --break-system-packages cargo-zigbuild
|
|
|
|
- name: Build cli (${{ matrix.target }})
|
|
working-directory: cli
|
|
run: cargo zigbuild --release --target ${{ matrix.target }}
|
|
|
|
- name: Package
|
|
run: |
|
|
bin=cli
|
|
[[ "${{ matrix.target }}" == *windows* ]] && bin=cli.exe
|
|
mkdir -p dist
|
|
zip -j "dist/guac-cli-${{ matrix.target }}.zip" "target/${{ matrix.target }}/release/$bin"
|
|
shell: bash
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: cli-${{ matrix.target }}
|
|
path: dist/*.zip
|
|
|
|
release:
|
|
needs: [firmware, cli]
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: catthehacker/ubuntu:act-latest
|
|
steps:
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
path: dist
|
|
|
|
- name: Create Gitea Release
|
|
uses: akkuman/gitea-release-action@v1
|
|
with:
|
|
files: dist/**/*.zip
|
|
draft: false
|
|
prerelease: false
|