From 6cd0c1fa6689892c266c40bd2ba8046636d8c941 Mon Sep 17 00:00:00 2001 From: 4gray Date: Fri, 9 Jan 2026 12:54:05 +0100 Subject: [PATCH] feat(ci): add cross-platform E2E workflow and remove old CI Add a new GitHub Actions workflow "Cross-Platform E2E Tests" that runs end-to-end tests on linux, macOS, and Windows using a matrix job. The workflow checks out code, sets up Node.js 22 with npm cache, installs deps, builds the backend, installs Playwright browsers, and runs the electron-backend-e2e suite (using xvfb on Linux). Failed test artifacts (Playwright report) are uploaded per OS for 7 days. Remove the previous monolithic 'Build and Test' workflow which included unit tests, coverage upload, and an older E2E configuration. This consolidates E2E across platforms into a focused, cross-platform job and simplifies the CI surface by deprecating the outdated workflow. --- .github/workflows/build-and-test.yaml | 89 --------------------------- .github/workflows/e2e-tests.yaml | 63 +++++++++++++++++++ 2 files changed, 63 insertions(+), 89 deletions(-) delete mode 100644 .github/workflows/build-and-test.yaml create mode 100644 .github/workflows/e2e-tests.yaml diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml deleted file mode 100644 index ad634d39d..000000000 --- a/.github/workflows/build-and-test.yaml +++ /dev/null @@ -1,89 +0,0 @@ -name: 'Build and Test' - -on: - push: - branches: - - master - pull_request: - branches: - - master - -jobs: - build-and-test: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version: '22' - - run: git config --global url."https://${{ secrets.PAT }}@github.com/".insteadOf ssh://git@github.com/ - - run: npm ci - - run: npm test -- --coverage - - run: bash <(curl -s https://codecov.io/bash) - - run: npm run build:prod - env: - CI: true - e2e-tests: - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: [macos-latest] - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version: '22' - - run: git config --global url."https://${{ secrets.PAT }}@github.com/".insteadOf ssh://git@github.com/ - - run: npm ci - # env: - # PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 - - run: npm run build:prod - - run: npx playwright install --with-deps - #- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run e2e:ci - # if: matrix.os == 'ubuntu-latest' - # env: - # e2e: true - - run: npm run e2e:ci - env: - e2e: true - # release: - # needs: [build-and-test] - # runs-on: ${{ matrix.os }} - - # strategy: - # matrix: - # os: [macos-latest, ubuntu-latest, windows-latest] - - # steps: - # - name: Check out Git repository - # uses: actions/checkout@v4 - - # - name: Install Node.js, NPM and Yarn - # uses: actions/setup-node@v4 - # with: - # node-version: '22' - - # - name: Build Electron app - # uses: samuelmeuli/action-electron-builder@v1 - # with: - # # GitHub token, automatically provided to the action - # # (No need to define this secret in the repo settings) - # github_token: ${{ secrets.github_token }} - - # # If the commit is tagged with a version (e.g. "v1.0.0"), - # # release the app after building - # release: ${{ startsWith(github.ref, 'refs/tags/v') }} - # #- name: Archive production artifacts - # # uses: actions/upload-artifact@v3 - # # with: - # # name: dev-release - # # path: ./release/** diff --git a/.github/workflows/e2e-tests.yaml b/.github/workflows/e2e-tests.yaml new file mode 100644 index 000000000..7a068e0ff --- /dev/null +++ b/.github/workflows/e2e-tests.yaml @@ -0,0 +1,63 @@ +name: 'Cross-Platform E2E Tests' + +on: + push: + branches: + - nx + pull_request: + branches: + - nx + +jobs: + e2e-tests: + name: E2E on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + env: + NX_SKIP_NX_CACHE: true + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + + steps: + - uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 10 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '22' + cache: 'pnpm' + + - name: Install Dependencies + run: pnpm install + + - name: Build Backend + run: npx nx build electron-backend + + - name: Install Playwright Browsers + run: npx playwright install --with-deps + + - name: Run E2E Tests (Linux) + if: runner.os == 'Linux' + run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" npx nx run electron-backend-e2e:e2e + env: + CI: true + + - name: Run E2E Tests (Windows/Mac) + if: runner.os != 'Linux' + run: npx nx run electron-backend-e2e:e2e + env: + CI: true + + - name: Upload Test Results + if: failure() + uses: actions/upload-artifact@v4 + with: + name: playwright-report-${{ matrix.os }} + path: dist/playwright-report/electron-backend-e2e/ + retention-days: 7