155 lines
6.6 KiB
YAML
155 lines
6.6 KiB
YAML
name: Test
|
|
|
|
on:
|
|
push:
|
|
branches-ignore:
|
|
- 'dependabot/**'
|
|
paths:
|
|
- 'lib/**'
|
|
- 'package.json'
|
|
- 'pnpm-lock.yaml'
|
|
- '.github/workflows/test.yml'
|
|
pull_request: {}
|
|
|
|
permissions:
|
|
checks: write
|
|
|
|
jobs:
|
|
vitest:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
services:
|
|
redis:
|
|
image: redis
|
|
ports:
|
|
- 6379/tcp
|
|
options: --entrypoint redis-server
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
# playwright install hangs in node v26.1.0, https://github.com/microsoft/playwright/issues/40724
|
|
node-version: [26.0.0, lts/*, lts/-1]
|
|
name: Vitest on Node ${{ matrix.node-version }}
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
- uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8
|
|
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
cache: 'pnpm'
|
|
- name: Install dependencies (pnpm)
|
|
run: pnpm i
|
|
- name: Run postinstall script for dependencies
|
|
run: pnpm rb && pnpm exec playwright install chromium
|
|
- name: Build routes
|
|
run: pnpm build
|
|
- name: Build worker routes
|
|
run: WORKER_BUILD=true pnpm build:routes
|
|
- name: Build worker
|
|
run: pnpm worker-build
|
|
- name: Test all and generate coverage
|
|
run: pnpm run vitest:coverage --reporter=github-actions
|
|
env:
|
|
REDIS_URL: redis://localhost:${{ job.services.redis.ports['6379'] }}/
|
|
- name: Upload coverage to Codecov
|
|
if: ${{ matrix.node-version == 'lts/*' }}
|
|
uses: codecov/codecov-action@v6
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos as documented, but seems broken
|
|
|
|
playwright:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
node-version: [26.0.0, lts/*, lts/-1]
|
|
chromium:
|
|
- name: bundled Chromium
|
|
dependency: ''
|
|
environment: '{ "PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD": "0" }'
|
|
- name: Chromium from Ubuntu
|
|
dependency: chromium-browser
|
|
environment: '{ "PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD": "1" }'
|
|
- name: Chrome from Google
|
|
dependency: google-chrome-stable
|
|
environment: '{ "PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD": "1" }'
|
|
name: Vitest Playwright on Node ${{ matrix.node-version }} with ${{ matrix.chromium.name }}
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
- uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8
|
|
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
cache: 'pnpm'
|
|
- name: Install dependencies (pnpm)
|
|
run: pnpm i
|
|
env: ${{ fromJSON(matrix.chromium.environment) }}
|
|
- name: Run postinstall script for dependencies
|
|
run: pnpm rb
|
|
- name: Build routes
|
|
run: pnpm build
|
|
- name: Install bundled Chromium
|
|
if: ${{ matrix.chromium.dependency == '' }}
|
|
run: pnpm exec playwright install chromium
|
|
- name: Install Chromium
|
|
if: ${{ matrix.chromium.dependency != '' }}
|
|
# 'chromium-browser' from Ubuntu APT repo is a dummy package. Its version (85.0.4183.83) means
|
|
# nothing since it calls Snap (disgusting!) to install Chromium, which should be up-to-date.
|
|
# That's not really a problem since the Chromium-bundled Docker image is based on Debian bookworm,
|
|
# which provides up-to-date native packages.
|
|
run: |
|
|
set -eux
|
|
curl -s "https://dl.google.com/linux/linux_signing_key.pub" | gpg --dearmor |
|
|
sudo tee /etc/apt/trusted.gpg.d/google-chrome.gpg > /dev/null
|
|
echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" |
|
|
sudo tee /etc/apt/sources.list.d/google-chrome.list > /dev/null
|
|
sudo apt-get update
|
|
sudo apt-get install -yq --no-install-recommends ${{ matrix.chromium.dependency }}
|
|
- name: Test Playwright
|
|
run: |
|
|
set -eux
|
|
if [ -n "${{ matrix.chromium.dependency }}" ]; then
|
|
export CHROMIUM_EXECUTABLE_PATH="$(which ${{ matrix.chromium.dependency }})"
|
|
fi
|
|
pnpm run vitest playwright
|
|
|
|
all:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
permissions:
|
|
attestations: write
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
node-version: [26, 24, 22]
|
|
name: Build radar and maintainer on Node ${{ matrix.node-version }}
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
- uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8
|
|
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
cache: 'pnpm'
|
|
- run: pnpm i
|
|
- name: Build radar and maintainer
|
|
run: npm run build
|
|
- name: Upload assets
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: generated-assets-${{ matrix.node-version }}
|
|
path: assets/build/
|
|
|
|
automerge:
|
|
if: github.triggering_actor == 'dependabot[bot]' && github.event_name == 'pull_request'
|
|
needs: [vitest, playwright, all]
|
|
runs-on: ubuntu-slim
|
|
permissions:
|
|
pull-requests: write
|
|
contents: write
|
|
steps:
|
|
- uses: fastify/github-action-merge-dependabot@30c3f8f14a4f7b315ba38dbc1b793d27128fef82 # v3.12.0
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
target: patch
|