Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scheduled integration test with jsdom #450

Merged
merged 9 commits into from
Sep 10, 2024
82 changes: 82 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: CI

on:
push:
branches: [master]
pull_request:

permissions:
contents: read

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
- name: Install dependencies
run: npm ci
- name: Run Linter
run: npm run eslint
- name: Run Formatter
run: npm run prettier

test:
name: Test - ${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [latest, lts/*, lts/-1]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js (${{ matrix.node-version }})
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test

api:
name: API & Doc Validation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Extract API
run: npm run api:extract
- name: Generate docs
run: npm run api:docs
- name: Ensure API and doc changes have been committed
run: |
git add --renormalize .
if (( "$(git diff HEAD --ignore-space-at-eol --ignore-cr-at-eol | wc -l)" != 0 )); then
cat << EOF >> $GITHUB_STEP_SUMMARY
### Detected uncommitted changes

\`\`\`shell
$(git diff HEAD)
\`\`\`
EOF
git diff HEAD
exit 1
fi
138 changes: 74 additions & 64 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
@@ -1,82 +1,92 @@
name: CI
name: Integration

on:
push:
branches: [master]
workflow_dispatch:
pull_request:
schedule:
- cron: '00 01 * * 1' # at 1:00 on mondays

permissions:
contents: read

defaults:
run:
# Setting an explicit bash shell ensures GitHub Actions enables pipefail mode too,
# rather than only error on exit (improving failure UX when pipes are used). See:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell
shell: bash

jobs:
lint:
name: Lint
integration-with-canvas:
name: Integration (jsdom + node-canvas)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
- uses: actions/checkout@v4
with:
node-version: lts/*
cache: npm
- name: Install dependencies
run: npm ci
- name: Run Linter
run: npm run eslint
- name: Run Formatter
run: npm run prettier

test:
name: Test - ${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [latest, lts/*, lts/-1]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js (${{ matrix.node-version }})
uses: actions/setup-node@v4
path: ./tough-cookie
- uses: actions/checkout@v4
with:
repository: jsdom/jsdom
ref: main
path: ./jsdom
submodules: recursive
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Install dependencies
run: npm ci
node-version: lts/*
- name: Install required image manipulation packages with APT
run: sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
- name: Build tough-cookie
id: package
run: |
npm ci
npm run build
echo "tough_cookie_tarball=$(npm pack)" >> "$GITHUB_OUTPUT"
working-directory: ./tough-cookie
- name: Setup HOSTS file for Web Platform Test server
run: ./test/web-platform-tests/tests/wpt make-hosts-file | sudo tee -a /etc/hosts
working-directory: ./jsdom
- name: Install jsdom dependencies
run: |
npm ci
npm uninstall tough-cookie
npm install ../tough-cookie/${{ steps.package.outputs.tough_cookie_tarball }}
npm install canvas
working-directory: ./jsdom
- name: Run tests
run: npm test

api:
name: API & Doc Validation
run: npm test -- --retries 1
working-directory: ./jsdom
integration:
name: Integration (jsdom)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
- uses: actions/checkout@v4
with:
path: ./tough-cookie
- uses: actions/checkout@v4
with:
repository: jsdom/jsdom
ref: main
path: ./jsdom
submodules: recursive
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Extract API
run: npm run api:extract
- name: Generate docs
run: npm run api:docs
- name: Ensure API and doc changes have been committed
- name: Build tough-cookie
id: package
run: |
git add --renormalize .
if (( "$(git diff HEAD --ignore-space-at-eol --ignore-cr-at-eol | wc -l)" != 0 )); then
cat << EOF >> $GITHUB_STEP_SUMMARY
### Detected uncommitted changes

\`\`\`shell
$(git diff HEAD)
\`\`\`
EOF
git diff HEAD
exit 1
fi
npm ci
npm run build
echo "tough_cookie_tarball=$(npm pack)" >> "$GITHUB_OUTPUT"
working-directory: ./tough-cookie
- name: Setup HOSTS file for Web Platform Test server
run: ./test/web-platform-tests/tests/wpt make-hosts-file | sudo tee -a /etc/hosts
working-directory: ./jsdom
- name: Install jsdom dependencies
run: |
npm ci
npm uninstall tough-cookie
npm install ../tough-cookie/${{ steps.package.outputs.tough_cookie_tarball }}
working-directory: ./jsdom
- name: Run tests
run: npm run test -- --retries 1
working-directory: ./jsdom