feat(route): csair #2
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
name: test | |
on: | |
push: | |
branches-ignore: | |
- 'dependabot/**' | |
paths: | |
- 'test/**' | |
- 'lib/**' | |
- '!**/maintainer.js' | |
- '!**/radar.js' | |
- '!**/radar-rules.js' | |
- 'package.json' | |
- 'yarn.lock' | |
- '.github/workflows/test.yml' | |
pull_request: ~ | |
permissions: | |
contents: read | |
jobs: | |
jest: | |
runs-on: ubuntu-latest | |
services: | |
redis: | |
image: redis | |
ports: | |
- 6379/tcp | |
options: --entrypoint redis-server | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: [ 14, 16, 18 ] | |
name: Jest on Node ${{ matrix.node-version }} | |
steps: | |
- name: Collect Workflow Telemetry | |
uses: runforesight/foresight-workflow-kit-action@v1 | |
if: success() || failure() | |
with: | |
api_key: ${{ secrets.FORESIGHT_KEY }} | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'yarn' | |
- name: Install dependencies (yarn) | |
run: yarn | |
- name: Test all and generate coverage | |
run: npm run jest:coverage | |
env: | |
REDIS_URL: redis://localhost:${{ job.services.redis.ports[6379] }}/ | |
- name: Upload coverage to Codecov | |
if: ${{ matrix.node-version == '18' }} | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos as documented, but seems broken | |
- name: Analyze Test and/or Coverage Results | |
uses: runforesight/foresight-test-kit-action@v1 | |
if: success() || failure() | |
with: | |
api_key: ${{ secrets.FORESIGHT_KEY }} | |
test_format: JUNIT | |
test_framework: JEST | |
test_path: ./coverage/junit.xml | |
puppeteer: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: [ 14, 16, 18 ] | |
chromium: | |
- name: bundled Chromium | |
dependency: '' | |
environment: '{}' | |
- name: Chromium from Ubuntu | |
dependency: chromium-browser | |
environment: '{ "CHROMIUM_EXECUTABLE_PATH": "chromium-browser" }' | |
- name: Chrome from Google | |
dependency: google-chrome-stable | |
environment: '{ "CHROMIUM_EXECUTABLE_PATH": "google-chrome-stable" }' | |
name: Jest puppeteer on Node ${{ matrix.node-version }} with ${{ matrix.chromium.name }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'yarn' | |
- name: Install dependencies (yarn) | |
run: yarn | |
- name: Install Chromium | |
if: ${{ matrix.chromium.dependency != '' }} | |
# Chromium from Ubuntu is too old (85), but can still pass the tests | |
# That's not really a problem since Chromium-bundled Docker image is based on Debian bullseye, | |
# which updates Chromium frequently, and only on arm/arm64 the image needs Chromium from Debian. | |
run: | | |
set -ex | |
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 puppeteer | |
run: npm run jest puppeteer | |
env: ${{ fromJSON(matrix.chromium.environment) }} | |
docs: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: [ 14, 16, 18 ] | |
name: Build docs on Node ${{ matrix.node-version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'yarn' | |
- run: yarn | |
- name: Set environment variable for Node v18 | |
if: ${{ matrix.node-version == '18' }} | |
run: echo "NODE_OPTIONS=--openssl-legacy-provider" >> $GITHUB_ENV | |
- name: Build docs | |
run: npm run docs:build | |
- name: Unset environment variable for Node v18 | |
if: ${{ matrix.node-version == '18' }} | |
run: echo "NODE_OPTIONS=''" >> $GITHUB_ENV | |
all: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: [ 14, 16, 18 ] | |
name: Build radar and maintainer on Node ${{ matrix.node-version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'yarn' | |
- run: yarn | |
- name: Build radar and maintainer | |
run: npm run build:all | |
automerge: | |
if: github.actor == 'dependabot[bot]' && github.event_name == 'pull_request' | |
needs: [ jest, puppeteer, docs, all ] | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
contents: write | |
steps: | |
- uses: fastify/github-action-merge-dependabot@v3 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
target: patch |