add github ci

This commit is contained in:
awalol
2026-04-29 19:17:17 +08:00
parent 64f0216c3b
commit 733dad3fae
2 changed files with 146 additions and 0 deletions
+75
View File
@@ -0,0 +1,75 @@
name: Build release firmware
on:
release:
types:
- published
env:
PICO_SDK_REF: 2.2.0
TINYUSB_REF: 0.20.0
PICO_SDK_PATH: ${{ github.workspace }}/pico-sdk
permissions:
contents: write
jobs:
build:
name: Build and upload release UF2
runs-on: ubuntu-latest
steps:
- name: Checkout release ref
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}
submodules: recursive
- name: Install build dependencies
run: |
sudo apt update
sudo apt install -y cmake python3 build-essential gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib ninja-build
- name: Cache Pico SDK
uses: actions/cache@v4
with:
path: ${{ env.PICO_SDK_PATH }}
key: pico-sdk-${{ runner.os }}-${{ env.PICO_SDK_REF }}-tinyusb-${{ env.TINYUSB_REF }}
- name: Prepare Pico SDK
run: |
if [ ! -d "$PICO_SDK_PATH/.git" ]; then
git clone --depth 1 --branch "$PICO_SDK_REF" https://github.com/raspberrypi/pico-sdk.git "$PICO_SDK_PATH"
fi
git -C "$PICO_SDK_PATH" submodule update --init --recursive
- name: Switch TinyUSB to configured tag
run: |
if ! git -C "$PICO_SDK_PATH/lib/tinyusb" rev-parse -q --verify "refs/tags/$TINYUSB_REF" >/dev/null; then
git -C "$PICO_SDK_PATH/lib/tinyusb" fetch --depth 1 origin "refs/tags/$TINYUSB_REF:refs/tags/$TINYUSB_REF"
fi
git -C "$PICO_SDK_PATH/lib/tinyusb" checkout --detach "$TINYUSB_REF"
- name: Build standard firmware
run: |
cmake -S . -B build/standard -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DPICO_SDK_PATH="$PICO_SDK_PATH"
cmake --build build/standard --target ds5-bridge
mkdir -p artifacts
cp build/standard/ds5-bridge.uf2 artifacts/ds5-bridge.uf2
- name: Build DSE firmware
run: |
cmake -S . -B build/dse -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DPICO_SDK_PATH="$PICO_SDK_PATH" \
-DENABLE_DSE=ON
cmake --build build/dse --target ds5-bridge
cp build/dse/ds5-bridge.uf2 artifacts/ds5-bridge-dse.uf2
- name: Upload UF2 files to release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release upload "${{ github.event.release.tag_name }}" artifacts/*.uf2 --clobber