test: react #61
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: CI | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
workflow_dispatch: {} | |
concurrency: | |
group: ci-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
cache: 'npm' | |
- run: npm config set registry ${{ vars.NPM_CI_REGISTRY }} | |
if: ${{ vars.NPM_CI_REGISTRY }} | |
- id: cache-node-modules | |
uses: actions/cache@v4 | |
with: | |
path: '**/node_modules' | |
key: ${{ hashFiles('**/package-lock.json') }} | |
- if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }} | |
run: npm ci | |
- run: npm run build | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: ${{ vars.CI_PARALLEL || 256 }} | |
matrix: | |
test-platforms: ['', '-s e2e'] | |
node-version: [16.x, 18.x, 20.x] | |
steps: | |
- uses: actions/checkout@v4 | |
- run: sudo apt-get update | |
- uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: libgconf-2-4 libatk1.0-0 libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libgbm-dev libnss3-dev libxss-dev libasound2 | |
version: ${{ matrix.node-version }} | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- uses: actions/cache@v4 | |
with: | |
path: "~/.cache/puppeteer" | |
key: ${{ runner.os }}-${{ matrix.node-version }}-puppeteer | |
- id: cache-node-modules | |
uses: actions/cache@v4 | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-${{ matrix.node-version }}-modules-${{ hashFiles('package-lock.json') }} | |
- run: npm config set registry ${{ vars.NPM_CI_REGISTRY }} | |
if: ${{ vars.NPM_CI_REGISTRY && steps.cache-node-modules.outputs.cache-hit != 'true' }} | |
- run: npm ci | |
if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }} | |
- run: npm run -- test -t 120000 ${{ matrix.test-platforms }} | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
cache: 'npm' | |
- run: npm config set registry ${{ vars.NPM_CI_REGISTRY }} | |
if: ${{ vars.NPM_CI_REGISTRY }} | |
- id: cache-node-modules | |
uses: actions/cache@v4 | |
with: | |
path: '**/node_modules' | |
key: ${{ hashFiles('**/package-lock.json') }} | |
- if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }} | |
run: npm ci | |
- run: npm run lint |