mirror of
https://github.com/bybrooklyn/openbitdo.git
synced 2026-03-19 04:12:56 -04:00
301 lines
9.0 KiB
YAML
301 lines
9.0 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- '**'
|
|
pull_request:
|
|
paths:
|
|
- '**'
|
|
schedule:
|
|
# 07:30 UTC is 02:30 America/New_York during standard time.
|
|
# (GitHub cron does not support time zones/DST directly.)
|
|
- cron: '30 7 * * *'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
guard:
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: sdk
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Clean-room guard
|
|
run: ./scripts/cleanroom_guard.sh
|
|
|
|
aur-validate:
|
|
runs-on: ubuntu-latest
|
|
needs: guard
|
|
container: archlinux:base
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install AUR packaging toolchain
|
|
run: |
|
|
pacman -Sy --noconfirm --needed base-devel git
|
|
- name: Ensure package metadata has pinned checksum fields
|
|
run: |
|
|
set -euo pipefail
|
|
if grep -nE 'SKIP|:no_check' \
|
|
packaging/aur/openbitdo/PKGBUILD \
|
|
packaging/aur/openbitdo-bin/PKGBUILD \
|
|
packaging/homebrew/Formula/openbitdo.rb; then
|
|
echo "Found placeholder checksum markers; release metadata must be pinned." >&2
|
|
exit 1
|
|
fi
|
|
test -f packaging/scripts/render_release_metadata.sh
|
|
test -f packaging/aur/openbitdo/PKGBUILD.tmpl
|
|
test -f packaging/aur/openbitdo-bin/PKGBUILD.tmpl
|
|
test -f packaging/homebrew/Formula/openbitdo.rb.tmpl
|
|
- name: Validate PKGBUILD and .SRCINFO
|
|
run: |
|
|
useradd -m builder
|
|
chown -R builder:builder "$GITHUB_WORKSPACE"
|
|
su builder -s /bin/bash -c "set -euo pipefail; \
|
|
cd '$GITHUB_WORKSPACE/packaging/aur/openbitdo'; \
|
|
makepkg --printsrcinfo > /tmp/openbitdo.srcinfo; \
|
|
diff -u .SRCINFO /tmp/openbitdo.srcinfo; \
|
|
cd '$GITHUB_WORKSPACE/packaging/aur/openbitdo-bin'; \
|
|
makepkg --printsrcinfo > /tmp/openbitdo-bin.srcinfo; \
|
|
diff -u .SRCINFO /tmp/openbitdo-bin.srcinfo"
|
|
|
|
tui-smoke-test:
|
|
runs-on: ubuntu-latest
|
|
needs: guard
|
|
defaults:
|
|
run:
|
|
working-directory: sdk
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install system deps
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y libudev-dev pkg-config
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
- name: Run TUI smoke tests
|
|
run: cargo test -p bitdo_tui --all-targets
|
|
|
|
build-macos-arm64:
|
|
runs-on: macos-14
|
|
needs: guard
|
|
defaults:
|
|
run:
|
|
working-directory: sdk
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: aarch64-apple-darwin
|
|
- name: Build/package macOS arm64 artifacts
|
|
run: ./scripts/package-macos.sh v0.0.0-ci arm64 aarch64-apple-darwin
|
|
- name: Upload macOS arm64 artifact sample
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ci-macos-arm64-package
|
|
path: sdk/dist/openbitdo-v0.0.0-ci-macos-arm64*
|
|
|
|
build-linux-x86_64:
|
|
runs-on: ubuntu-latest
|
|
needs: guard
|
|
defaults:
|
|
run:
|
|
working-directory: sdk
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install system deps
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y libudev-dev pkg-config
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
- name: Build/package linux x86_64 artifacts
|
|
run: ./scripts/package-linux.sh v0.0.0-ci x86_64
|
|
- name: Upload linux x86_64 artifact sample
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ci-linux-x86_64-package
|
|
path: sdk/dist/openbitdo-v0.0.0-ci-linux-x86_64*
|
|
|
|
build-linux-aarch64:
|
|
runs-on: ubuntu-24.04-arm
|
|
needs: guard
|
|
defaults:
|
|
run:
|
|
working-directory: sdk
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install system deps
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y libudev-dev pkg-config
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
- name: Build/package linux aarch64 artifacts
|
|
run: ./scripts/package-linux.sh v0.0.0-ci aarch64
|
|
- name: Upload linux aarch64 artifact sample
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ci-linux-aarch64-package
|
|
path: sdk/dist/openbitdo-v0.0.0-ci-linux-aarch64*
|
|
|
|
hardware-paths:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
hardware: ${{ steps.filter.outputs.hardware }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dorny/paths-filter@v3
|
|
id: filter
|
|
with:
|
|
filters: |
|
|
hardware:
|
|
- 'sdk/crates/bitdo_proto/**'
|
|
- 'sdk/crates/bitdo_app_core/**'
|
|
- 'sdk/crates/bitdo_tui/**'
|
|
- 'sdk/crates/openbitdo/**'
|
|
- 'sdk/tests/**'
|
|
- 'sdk/scripts/run_hardware_smoke.sh'
|
|
- 'spec/**'
|
|
- 'harness/lab/device_lab.yaml'
|
|
- '.github/workflows/ci.yml'
|
|
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- guard
|
|
- tui-smoke-test
|
|
- aur-validate
|
|
- build-macos-arm64
|
|
- build-linux-x86_64
|
|
- build-linux-aarch64
|
|
defaults:
|
|
run:
|
|
working-directory: sdk
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install system deps
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y libudev-dev pkg-config
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
- name: Clippy (workspace strict)
|
|
run: cargo clippy --workspace --all-targets -- -D warnings
|
|
- name: Run tests
|
|
run: cargo test --workspace --all-targets
|
|
|
|
hardware-dinput:
|
|
if: vars.BITDO_ENABLE_EXTRA_HARDWARE == '1'
|
|
runs-on: [self-hosted, linux, hid-lab]
|
|
needs: test
|
|
env:
|
|
BITDO_REQUIRED_FAMILIES: DInput
|
|
defaults:
|
|
run:
|
|
working-directory: sdk
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
- name: Hardware smoke tests
|
|
run: ./scripts/run_hardware_smoke.sh
|
|
- name: Upload hardware smoke report
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: hardware-smoke-dinput
|
|
path: harness/reports/*.json
|
|
|
|
hardware-standard64:
|
|
if: vars.BITDO_ENABLE_EXTRA_HARDWARE == '1'
|
|
runs-on: [self-hosted, linux, hid-lab]
|
|
needs: test
|
|
env:
|
|
BITDO_REQUIRED_FAMILIES: Standard64
|
|
defaults:
|
|
run:
|
|
working-directory: sdk
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
- name: Hardware smoke tests
|
|
run: ./scripts/run_hardware_smoke.sh
|
|
- name: Upload hardware smoke report
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: hardware-smoke-standard64
|
|
path: harness/reports/*.json
|
|
|
|
hardware-ultimate2:
|
|
if: github.event_name == 'schedule' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') || needs.hardware-paths.outputs.hardware == 'true'
|
|
runs-on: [self-hosted, linux, hid-lab]
|
|
needs: [test, hardware-paths]
|
|
env:
|
|
BITDO_REQUIRED_SUITE: ultimate2
|
|
defaults:
|
|
run:
|
|
working-directory: sdk
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
- name: Hardware smoke tests (Ultimate2)
|
|
run: ./scripts/run_hardware_smoke.sh
|
|
- name: Upload hardware smoke report
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: hardware-smoke-ultimate2
|
|
path: harness/reports/*.json
|
|
|
|
hardware-108jp:
|
|
if: github.event_name == 'schedule' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') || needs.hardware-paths.outputs.hardware == 'true'
|
|
runs-on: [self-hosted, linux, hid-lab]
|
|
needs: [test, hardware-paths]
|
|
env:
|
|
BITDO_REQUIRED_SUITE: 108jp
|
|
defaults:
|
|
run:
|
|
working-directory: sdk
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
- name: Hardware smoke tests (JP108)
|
|
run: ./scripts/run_hardware_smoke.sh
|
|
- name: Upload hardware smoke report
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: hardware-smoke-108jp
|
|
path: harness/reports/*.json
|
|
|
|
hardware-jphandshake:
|
|
if: vars.BITDO_ENABLE_JP_HARDWARE == '1'
|
|
runs-on: [self-hosted, linux, hid-lab]
|
|
needs: test
|
|
env:
|
|
BITDO_REQUIRED_FAMILIES: JpHandshake
|
|
defaults:
|
|
run:
|
|
working-directory: sdk
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
- name: Hardware smoke tests
|
|
run: ./scripts/run_hardware_smoke.sh
|
|
- name: Upload hardware smoke report
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: hardware-smoke-jphandshake
|
|
path: harness/reports/*.json
|