Skip to content

[RFR] Nightly CI for Vscode tests #40

[RFR] Nightly CI for Vscode tests

[RFR] Nightly CI for Vscode tests #40

Workflow file for this run

name: Run Playwright tests nightly on main branch
on:
# schedule:
# - cron: "5 3 * * *"
# workflow_dispatch:
[push, pull_request]
jobs:
main-nightly:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: lts/*
- name: Install vscode dependencies
run: sudo apt-get update && sudo apt-get install -y wget
- name: Find VS Code stable release version
id: code-stable
run: |
echo "VSCODE_VERSION=`curl --silent https://update.code.visualstudio.com/api/releases/stable | jq -r '.[0]'`" >> "$GITHUB_OUTPUT"
- name: Cache VS Code download
uses: actions/cache@v4
with:
path: |
.vscode-test
key: vscode-test-cache-${{ steps.code-stable.outputs.VSCODE_VERSION }}
- name: Set up virtual X11
run: |
sudo apt-get update
sudo apt-get install -y \
xvfb \
x11-xserver-utils \
dbus-x11 \
xfonts-100dpi \
xfonts-75dpi \
libxrender1 \
libxext6 \
libx11-6
- name: Set DISPLAY environment variable
run: |
Xvfb :99 -screen 0 1920x1080x24 &
echo "DISPLAY=:99" >> $GITHUB_ENV
- name: Start D-Bus
run: |
dbus-launch --exit-with-session &
- name: Test using VS Code
# commands before `xvfb-run -a npm run test` avoid these ERROR messages:
# - Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
# - Exiting GPU process due to errors during initialization
run: |
sudo service dbus start
export XDG_RUNTIME_DIR=/run/user/$(id -u)
sudo chmod 700 $XDG_RUNTIME_DIR
sudo chown $(id -un):$(id -gn) $XDG_RUNTIME_DIR
export DBUS_SESSION_BUS_ADDRESS=unix:path=$XDG_RUNTIME_DIR/bus
dbus-daemon --session --address=$DBUS_SESSION_BUS_ADDRESS --nofork --nopidfile --syslog-only &
mkdir ~/.vscode && echo '{ "disable-hardware-acceleration": true }' > ~/.vscode/argv.json
# xvfb-run -a npm run test
- name: Verify Installation
run: code --version
- name: Verbose code
run: code --verbose
- name: Verify VSCode Path
run: |
if [ -f /usr/share/code/code ]; then
echo "VSCode is installed at /usr/share/code/code"
else
echo "VSCode is NOT found at /usr/share/code/code"
echo "Listing /usr/share/code:"
ls /usr/share/code
fi
- name: Ensure no VSCode instances are running
run: |
pkill -f code || true # Kills all VSCode processes if they are running
- name: Install playwright dependencies
run: npm install
- name: More dependencies
run: npm ci
- name: Copy .env.example to .env
run: cp .env.example .env
- name: Run Playwright tests
run: npx playwright test
- name: Upload screenshots
uses: actions/upload-artifact@v3
with:
name: vscode-screenshots
path: |
vscode-initialized-screenshot.png
vscode-window-title-check.png
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30