name: Build and Test on: pull_request: {} push: branches: [develop, staging, master] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true permissions: {} # No permissions required jobs: fetch: uses: ./.github/workflows/build_prepare.yaml permissions: contents: read with: config: ${{ github.event.pull_request.base.ref == 'develop' && 'element.io/nightly' || 'element.io/release' }} version: ${{ github.event.pull_request.base.ref == 'develop' && 'develop' || '' }} windows: needs: fetch name: Windows uses: ./.github/workflows/build_windows.yaml strategy: matrix: arch: [x64] with: arch: ${{ matrix.arch }} test: needs: - windows strategy: matrix: include: - name: Windows (x64) os: windows-2022 artifact: win-x64 executable: "%LOCALAPPDATA%\element-desktop*\Element.exe" prepare_cmd: "./dist/squirrel-windows*/Element Setup*.exe" name: Test ${{ matrix.name }} runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version-file: package.json cache: "yarn" - name: Install Deps run: "yarn install --frozen-lockfile" - uses: actions/download-artifact@v4 with: name: ${{ matrix.artifact }} path: dist - name: Prepare for tests run: ${{ matrix.prepare_cmd }} if: matrix.prepare_cmd # We previously disabled the `EnableNodeCliInspectArguments` fuse, but Playwright requires # it to be enabled to test Electron apps, so turn it back on. - name: Set EnableNodeCliInspectArguments fuse enabled run: $RUN_AS npx @electron/fuses write --app ${{ matrix.executable }} EnableNodeCliInspectArguments=on shell: bash env: # We need sudo on Linux as it is installed in /opt/ RUN_AS: ${{ runner.os == 'Linux' && 'sudo' || '' }} - name: Workaround macOS GHA permission issues if: runner.os == 'macOS' run: | sqlite3 $HOME/Library/Application\ Support/com.apple.TCC/TCC.db "INSERT OR IGNORE INTO access VALUES ('kTCCServiceMicrophone','/usr/local/opt/runner/provisioner/provisioner',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159,NULL,NULL,'UNUSED',1687786159);" sqlite3 $HOME/Library/Application\ Support/com.apple.TCC/TCC.db "INSERT OR IGNORE INTO access VALUES ('kTCCServiceMicrophone','/opt/off/opt/runner/provisioner/provisioner',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159,NULL,NULL,'UNUSED',1687786159);" - name: Run tests uses: coactions/setup-xvfb@6b00cf1889f4e1d5a48635647013c0508128ee1a timeout-minutes: 5 with: run: "yarn test ${{ runner.os != 'Linux' && '--ignore-snapshots' || '' }}" env: ELEMENT_DESKTOP_EXECUTABLE: ${{ matrix.executable }} - name: Upload HTML report if: always() uses: actions/upload-artifact@v4 with: name: ${{ matrix.artifact }}-test path: playwright/html-report retention-days: 14