Improve BLE disconnection logic by de-registering event handlers. #267
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Test | |
| on: | |
| push: | |
| branches: [ main, dev ] | |
| # Don't need to run on tags anymore, we always push artifacts to a draft release now. | |
| # tags: | |
| # - 'v*' | |
| # pull_request: | |
| # branches: [ main, dev ] | |
| jobs: | |
| test-electron: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [macos-15, ubuntu-latest, windows-latest] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run unit tests | |
| run: npm run test:unit | |
| - name: Install Xvfb (Ubuntu only) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: sudo apt-get update && sudo apt-get install -y xvfb | |
| - name: Build Electron app | |
| run: npm run build | |
| - name: Install Playwright browsers (Ubuntu only) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: npx playwright install --with-deps | |
| - name: Run Electron tests (headless) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| export DISPLAY=:99 | |
| # Start Xvfb in the background and wait for it to be ready | |
| Xvfb :99 -screen 0 1280x960x24 -ac & | |
| sleep 3 | |
| npm run test:electron:ci | |
| # - name: Test Electron app build (no packaging) | |
| # run: npx electron-builder --dir | |
| # env: | |
| # # Skip notarization and signing in PR builds | |
| # CSC_IDENTITY_AUTO_DISCOVERY: false | |
| #=============================================================== | |
| # NOTE: More build config is in package.json under the "build" key. | |
| #=============================================================== | |
| - name: Build/release Electron app (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| npx electron-builder --win --publish onTagOrDraft 2>&1 | Tee-Object build-output.log | |
| if (Select-String "skipped publishing.*reason=existing type not compatible with publishing type" build-output.log) { | |
| Write-Output "::error::Publishing was skipped due to incompatible release type" | |
| exit 1 | |
| } | |
| env: | |
| # Windows code signing | |
| CSC_LINK: ${{ secrets.CSC_LINK }} | |
| CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} | |
| # Publish to GitHub Releases | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build/release Electron app (Linux) | |
| if: matrix.os == 'ubuntu-latest' | |
| # Need to install noble dependencies for bluetooth support, see https://github.com/abandonware/noble#readme. | |
| run: | | |
| sudo apt install -y bluetooth bluez libbluetooth-dev libudev-dev | |
| npx electron-builder --linux --publish onTagOrDraft 2>&1 | tee build-output.log | |
| if grep -q "skipped publishing.*reason=existing type not compatible with publishing type" build-output.log; then | |
| echo "::error::Publishing was skipped due to incompatible release type" | |
| exit 1 | |
| fi | |
| env: | |
| # Publish to GitHub Releases | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build/release Electron app (Mac) | |
| if: matrix.os == 'macos-15' | |
| run: | | |
| npx electron-builder --mac --publish onTagOrDraft 2>&1 | tee build-output.log | |
| if grep -q "skipped publishing.*reason=existing type not compatible with publishing type" build-output.log; then | |
| echo "::error::Publishing was skipped due to incompatible release type" | |
| exit 1 | |
| fi | |
| env: | |
| # Publish to GitHub Releases | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # - name: Upload test results (Ubuntu only) | |
| # if: matrix.os == 'ubuntu-latest' | |
| # uses: actions/upload-artifact@v4 | |
| # if: failure() | |
| # with: | |
| # name: playwright-report | |
| # path: playwright-report/ | |
| # retention-days: 30 | |
| release: | |
| needs: test-electron | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-15] | |
| steps: | |
| - name: Check out Git repository | |
| uses: actions/checkout@v4 | |
| - name: Install Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Rebuild native modules (fallback) | |
| run: npm rebuild --build-from-source=false | |
| continue-on-error: true | |
| - name: Build Electron app | |
| run: npm run build | |
| #=============================================================== | |
| # NOTE: More build config is in package.json under the "build" key. | |
| #=============================================================== | |
| - name: Build/release Electron app (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| npx electron-builder --win --publish always 2>&1 | Tee-Object build-output.log | |
| if (Select-String "skipped publishing.*reason=existing type not compatible with publishing type" build-output.log) { | |
| Write-Output "::error::Publishing was skipped due to incompatible release type" | |
| exit 1 | |
| } | |
| env: | |
| # Windows code signing | |
| CSC_LINK: ${{ secrets.CSC_LINK }} | |
| CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} | |
| # Publish to GitHub Releases | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build/release Electron app (Linux) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| npx electron-builder --linux --publish always 2>&1 | tee build-output.log | |
| if grep -q "skipped publishing.*reason=existing type not compatible with publishing type" build-output.log; then | |
| echo "::error::Publishing was skipped due to incompatible release type" | |
| exit 1 | |
| fi | |
| env: | |
| # Publish to GitHub Releases | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build/release Electron app (Mac) | |
| if: matrix.os == 'macos-15' | |
| run: | | |
| npx electron-builder --mac --publish always 2>&1 | tee build-output.log | |
| if grep -q "skipped publishing.*reason=existing type not compatible with publishing type" build-output.log; then | |
| echo "::error::Publishing was skipped due to incompatible release type" | |
| exit 1 | |
| fi | |
| env: | |
| # Publish to GitHub Releases | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |