bugsnag/bugsnag-js

View on GitHub
.github/workflows/test-electron.yml

Summary

Maintainability
Test Coverage
name: '@bugsnag/electron'

on: push

jobs:
  test:

    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        electron: [ '^20.0.0', '^24.0.0', '^26.0.0', '^28.0.0', '^30.0.0' ]
        node-version: [18]
        os: [ ubuntu-latest ]

    steps:
    - uses: actions/checkout@v4
    - uses: actions/setup-node@v4
      with:
        node-version: ${{ matrix.node-version }}
    - name: (Act) install build tools and dependencies
      run: |
        sudo apt-get --assume-yes update
        sudo apt-get --assume-yes install build-essential xvfb libnss3 libatk1.0-0 libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libasound2 libgbm1
        # electron-forge requires yarn for some reason
        npm install --global yarn
      if: ${{ env.ACT && contains(matrix.os, 'ubuntu-20.04') }}
    - name: Get npm cache directory
      id: npm-cache-dir
      if: ${{ !env.ACT }}
      run: |
        echo "::set-output name=dir::$(npm config get cache)"
    - uses: actions/cache@v4
      id: npm-cache
      if: ${{ !env.ACT }}
      with:
        path: ${{ steps.npm-cache-dir.outputs.dir }}
        key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
        restore-keys: |
          ${{ runner.os }}-node-
    - run: npm install electron@${{ matrix.electron }} --no-audit --progress=false --no-save
      env:
        PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
    - run: npm ci --no-audit --progress=false
      env:
        PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
    - run: npx lerna bootstrap
    - run: npm run build:electron
      shell: bash
    - run: sudo apt-get install cppcheck --assume-yes
      name: Install cppcheck
      if: contains(matrix.os, 'ubuntu')
    - run: npm run test:lint-native
      name: Lint C/C++ extensions
      if: contains(matrix.os, 'ubuntu')
    - name: (macOS) disable crash dialog
      if: contains(matrix.os, 'macos')
      run: defaults write com.apple.CrashReporter DialogType none
    - name: run unit tests
      run: npm run test:unit:electron-runner
      env:
        ELECTRON_DISABLE_SANDBOX: 1
    - name: run integration tests
      run: npm run test:electron
      shell: bash
      env:
        START_LOCAL_NPM: 1
        VERBOSE: 1
        ELECTRON_VERSION: ${{ matrix.electron }}
    - uses: actions/upload-artifact@v4
      if: failure()
      with:
        name: cucumber-failures
        path: test/.cucumber-failures/