Added Playwright E2E setup #258
Workflow file for this run
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: CI | |
| on: | |
| pull_request: | |
| types: [opened, synchronize] | |
| jobs: | |
| test: | |
| name: Testing on ${{ matrix.platform }} | |
| timeout-minutes: 20 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # Mirrors the platforms and Node.js version @elek-io/core tests on | |
| platform: [ubuntu-24.04, macos-15-intel, macos-15, windows-2025] | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 1 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v6 | |
| - name: Setup Node.js environment | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: '.node-version' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| # Temporary diagnostic: dugite ships its git-core commands as symlinks to | |
| # one git binary. A healthy install keeps ~145 symlinks. If the toolchain | |
| # dereferences them into full copies the git dir grows from ~70MB to | |
| # ~580MB and the packaged macOS app roughly doubles. Prints the counts so | |
| # we can see which platform and which action version breaks it. Never | |
| # fails the build. | |
| - name: Probe dugite git-core symlinks | |
| shell: bash | |
| continue-on-error: true | |
| run: | | |
| dir=$(find node_modules/.pnpm -type d -path '*dugite*/git/libexec/git-core' 2>/dev/null | head -1) | |
| if [ -z "$dir" ]; then echo "dugite git-core dir not found"; exit 0; fi | |
| echo "git-core dir: $dir" | |
| echo "symlinks: $(find "$dir" -type l 2>/dev/null | wc -l)" | |
| echo "files: $(find "$dir" -type f 2>/dev/null | wc -l)" | |
| du -sh "$(dirname "$(dirname "$dir")")" 2>/dev/null || true | |
| - name: Run lint, check types and formatting | |
| run: pnpm run lint && pnpm run check-types && pnpm run check-format | |
| # - name: Identify misconfigurations and security anti-patterns | |
| # uses: doyensec/electronegativity-action@v2 | |
| # - name: Upload report | |
| # uses: github/codeql-action/upload-sarif@v1 | |
| # with: | |
| # sarif_file: ../electronegativity_results | |
| # Full package build (not build:unpack), so PR CI also verifies that | |
| # electron-builder can still produce the installers. The E2E tests | |
| # only use the unpacked directory this step produces alongside them | |
| - name: Build | |
| run: pnpm run build | |
| # Invoke the runner directly, since "pnpm run test" would rebuild | |
| # the app that the build step above already built | |
| - name: Run E2E tests (Linux) | |
| if: runner.os == 'Linux' | |
| run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" pnpm exec playwright test | |
| - name: Run E2E tests (macOS/Windows) | |
| if: runner.os != 'Linux' | |
| run: pnpm exec playwright test | |
| - name: Upload Playwright report | |
| uses: actions/upload-artifact@v7 | |
| if: ${{ !cancelled() }} | |
| with: | |
| name: playwright-report-${{ matrix.platform }} | |
| path: playwright-report/ | |
| retention-days: 30 | |
| # The HTML report above embeds the trace, but not each failed test's | |
| # Core data directory (the git repos and files Core wrote). preserveOutput | |
| # in the Playwright config keeps only failed tests' output, so this ships | |
| # just those data dirs | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v7 | |
| if: failure() | |
| with: | |
| name: test-results-${{ matrix.platform }} | |
| path: test-results/ | |
| retention-days: 7 | |
| # Uncomment if necessary | |
| # For example to inspect the build applications | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: artifact_${{ matrix.platform }} | |
| path: | | |
| dist/*.exe | |
| dist/*.dmg | |
| dist/*.zip | |
| dist/*.AppImage | |
| dist/*.snap | |
| dist/*.deb | |
| if-no-files-found: error |