-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
31 additions
and
37 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,42 @@ | ||
name: CI | ||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
branches: [master] | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
ci: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
node-version: [18.x, 20.x] | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20.x' | ||
- name: Cache node modules | ||
id: cache-npm | ||
uses: actions/cache@v3 | ||
env: | ||
cache-name: cache-node-modules | ||
submodules: true | ||
- uses: actions/setup-node@v4 | ||
with: | ||
# npm cache files are stored in `~/.npm` on Linux/macOS | ||
path: ~/.npm | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-name }}- | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} | ||
name: List the state of node modules | ||
continue-on-error: true | ||
run: npm list | ||
- name: Install system dependencies | ||
run: | | ||
sudo apt update | ||
sudo apt install -y libcairo2-dev libjpeg-dev libpango1.0-dev libgif-dev librsvg2-dev libxt-dev libxi-dev mesa-utils libgl1-mesa-dev xvfb | ||
- name: Start Xvfb | ||
run: | | ||
/usr/bin/Xvfb :99 -ac & | ||
export DISPLAY=:99 | ||
- name: Install dependencies | ||
run: npm install | ||
- name: Build | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'npm' | ||
- name: Install dependencies on Ubuntu | ||
if: startsWith(matrix.os, 'ubuntu') | ||
run: sudo apt-get install -y build-essential libgl1-mesa-dri libglapi-mesa \ | ||
libglew-dev libglu1-mesa-dev libosmesa6 \ | ||
libxi-dev mesa-utils pkg-config | ||
- name: Install node dependencies | ||
run: npm ci | ||
- name: Build project | ||
run: npm run build | ||
- name: Unit tests | ||
run: xvfb-run npm run test:unit | ||
- name: E2e tests | ||
run: xvfb-run npm run test:e2e | ||
- name: Run tests on Ubuntu | ||
if: startsWith(matrix.os, 'ubuntu') | ||
run: xvfb-run npm test:unit | ||
- name: Run tests on non-Ubuntu | ||
if: "!startsWith(matrix.os, 'ubuntu')" | ||
run: npm test:unit | ||
- name: Run E2e tests on Ubuntu | ||
if: startsWith(matrix.os, 'ubuntu') | ||
run: xvfb-run npm test:e2e | ||
- name: Run E2e tests on non-Ubuntu | ||
if: "!startsWith(matrix.os, 'ubuntu')" | ||
run: npm test:e2e |