* Add concurrency settings for a bunch of workflows * Restrict prod deployments to one at a time but disallow interrupting * Remove redundant pull_request.types specification
70 lines
2.2 KiB
YAML
70 lines
2.2 KiB
YAML
name: Browser Tests
|
|
|
|
# **What it does**: This runs our browser tests on pull requests.
|
|
# **Why we have it**: This is the only way we currently test our browser JavaScript.
|
|
# **Who does it impact**: Docs engineering, open-source engineering contributors.
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
paths:
|
|
- '**.js'
|
|
- '**.mjs'
|
|
- '**.ts'
|
|
- '**.tsx'
|
|
- jest.config.js
|
|
- package.json
|
|
# In case something like eslint or tsc or prettier upgrades
|
|
- package-lock.json
|
|
# Ultimately, for debugging this workflow itself
|
|
- .github/workflows/browser-test.yml
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
# This allows a subsequently queued workflow run to interrupt previous runs
|
|
concurrency:
|
|
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
|
|
with:
|
|
lfs: true
|
|
|
|
- name: Checkout LFS objects
|
|
run: git lfs checkout
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@04c56d2f954f1e4c69436aa54cfef261a018f458
|
|
with:
|
|
node-version: 16.13.x
|
|
cache: npm
|
|
|
|
- name: Install dependencies
|
|
env:
|
|
# This makes it so the puppeteer npm package doesn't bother
|
|
# to download a copy of chromium because it can use
|
|
# `$PUPPETEER_EXECUTABLE_PATH` from the ubuntu Action container.
|
|
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
|
|
run: npm ci --include=optional
|
|
|
|
- name: Cache nextjs build
|
|
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353
|
|
with:
|
|
path: .next/cache
|
|
key: ${{ runner.os }}-nextjs-${{ hashFiles('package*.json') }}
|
|
|
|
- name: Cache lib/redirects/.redirects-cache_en_ja.json
|
|
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353
|
|
with:
|
|
path: lib/redirects/.redirects-cache_en_ja.json
|
|
key: ${{ runner.os }}-redirects-cache-${{ hashFiles('.github/workflows/browser-test.yml') }}
|
|
|
|
- name: Run browser-test
|
|
run: npm run browser-test
|