Skip to content

Commit 0313e66

Browse files
committed
chore(ci): run tests on os matrix
1 parent c908357 commit 0313e66

File tree

2 files changed

+34
-5
lines changed

2 files changed

+34
-5
lines changed

.github/workflows/ci.yaml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,33 @@ on:
1212

1313
jobs:
1414
build-and-test:
15-
runs-on: ubuntu-latest
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
matrix:
18+
# os: [ubuntu-latest, macos-latest, windows-latest]
19+
os: [macos-latest]
1620

1721
steps:
1822
- name: Checkout code
19-
uses: actions/checkout@v3
23+
uses: actions/checkout@v4
2024

2125
- name: Set up Node.js
22-
uses: actions/setup-node@v3
26+
uses: actions/setup-node@v4
2327
with:
2428
node-version: "18"
2529

2630
- name: Install dependencies
2731
run: yarn install
2832

29-
- name: Run tests
30-
run: xvfb-run --auto-servernum yarn test
33+
- name: Install XQuartz on macOS
34+
if: runner.os == 'macOS'
35+
run: brew install xquartz xorg-server
36+
37+
# cf https://code.visualstudio.com/api/working-with-extensions/continuous-integration#github-actions
38+
- name: Run tests with Xvfb (Linux) or XQuartz (macOS)
39+
run: |
40+
if [[ "$RUNNER_OS" == "Linux" ]]; then
41+
xvfb-run --auto-servernum yarn test
42+
else
43+
bash ./scripts/xvfb-run-macos.sh yarn test
44+
fi

scripts/xvfb-run-macos.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
# Start Xvfb if not running
4+
if ! pgrep -x "Xvfb" > /dev/null; then
5+
echo "Starting Xvfb on macOS..."
6+
Xvfb :99 -screen 0 1920x1080x24 &
7+
XVFB_PID=$!
8+
export DISPLAY=:99
9+
fi
10+
11+
# Run the command passed as arguments
12+
"$@"
13+
14+
# Stop Xvfb after the command runs
15+
kill $XVFB_PID

0 commit comments

Comments
 (0)