From d1f07ea02e118e168dd57ed57e3f779ab6089dbd Mon Sep 17 00:00:00 2001 From: maelstr0m <96124638+mlstr0m@users.noreply.github.com> Date: Tue, 14 Jul 2026 15:18:14 +0200 Subject: [PATCH] Add CI: headless tests on every PR, DMG build artifact on main - .github/workflows/ci.yml: macOS runner, Python 3.12, runs tests/test_bridge.py and tests/test_dsu.py on push/PR; builds the .app + DMG (uploaded as artifact) on main pushes and manual runs - build_dmg.sh: skip `open dist` on CI (headless runner + set -e) - README: CI badge Co-Authored-By: Claude Fable 5 --- .github/workflows/ci.yml | 52 ++++++++++++++++++++++++++++++++++++++++ README.md | 1 + build_dmg.sh | 6 +++-- 3 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d0bbc22 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,52 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + workflow_dispatch: + +jobs: + test: + name: Headless tests + runs-on: macos-14 + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: pip + + - name: Install dependencies + run: pip install -r requirements.txt + + - name: Bridge tests (mappings, key dispatch, BLE lifecycle) + run: python tests/test_bridge.py + + - name: DSU server tests (cemuhook protocol over UDP) + run: python tests/test_dsu.py + + build: + name: Build .app + DMG + runs-on: macos-14 + needs: test + # Building is slower — only on main and manual runs + if: github.event_name != 'pull_request' + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: pip + + - name: Build DMG + run: ./build_dmg.sh + + - name: Upload DMG artifact + uses: actions/upload-artifact@v4 + with: + name: Switch2Bridge-Installer + path: dist/Switch2Bridge-Installer.dmg + if-no-files-found: error diff --git a/README.md b/README.md index e17a918..ca5856e 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ A Python menubar app that connects to the Switch 2 Pro Controller via BLE and translates inputs to keyboard presses for use with emulators like Ryujinx. +[![CI](https://github.com/mlstr0m/switch2bridge-macos/actions/workflows/ci.yml/badge.svg)](https://github.com/mlstr0m/switch2bridge-macos/actions/workflows/ci.yml) [![macOS](https://img.shields.io/badge/macOS-Ventura%2B-blue?logo=apple)](https://www.apple.com/macos) [![Python](https://img.shields.io/badge/Python-3.9%2B-green?logo=python)](https://python.org) [![License](https://img.shields.io/badge/License-MIT-yellow)](LICENSE) diff --git a/build_dmg.sh b/build_dmg.sh index 53fb1f5..27763be 100755 --- a/build_dmg.sh +++ b/build_dmg.sh @@ -133,5 +133,7 @@ echo " To test: open dist/${DMG_NAME}.dmg" echo "═══════════════════════════════════════════════════════════" echo "" -# Open in Finder -open dist +# Open in Finder (skip on CI / headless) +if [ -z "${CI:-}" ]; then + open dist +fi