Run UI tests headlessly in CI via xvfb on ubuntu-latest #24
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: | |
| push: | |
| pull_request: | |
| concurrency: | |
| group: ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| jobs: | |
| build: | |
| runs-on: | |
| - self-hosted | |
| - macOS | |
| - ARM64 | |
| - patchloom-vscode | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run tests | |
| run: npm test | |
| - name: Package extension | |
| run: npm run package | |
| ui-test: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Install xvfb and Electron dependencies | |
| run: | | |
| sudo apt-get update -qq | |
| sudo apt-get install -y xvfb libgtk-3-0 libgbm1 libnss3 \ | |
| libxss1 libasound2t64 libatk-bridge2.0-0 libdrm2 \ | |
| libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 \ | |
| libxrandr2 libpango-1.0-0 libcairo2 | |
| - name: Disable GPU acceleration for Electron | |
| run: | | |
| mkdir -p ~/.vscode | |
| echo '{ "disable-hardware-acceleration": true }' > ~/.vscode/argv.json | |
| - name: Run UI tests (headless via xvfb) | |
| uses: GabrielBB/xvfb-action@v1 | |
| with: | |
| run: npm run test:ui |