flecks/.github/workflows/ci.yml

89 lines
2.8 KiB
YAML
Raw Normal View History

name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch: {}
2024-02-11 22:36:47 -06:00
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
2024-02-11 21:03:06 -06:00
2024-02-13 01:11:08 -06:00
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 }}
2024-02-13 06:02:45 -06:00
- id: cache-node-modules
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ hashFiles('**/package-lock.json') }}
2024-02-13 06:20:46 -06:00
- if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
2024-02-13 06:02:45 -06:00
run: npm ci
- run: npm run build
2024-02-13 01:11:08 -06:00
test:
2024-02-11 21:03:06 -06:00
runs-on: ubuntu-latest
strategy:
2024-02-11 23:19:58 -06:00
max-parallel: ${{ vars.CI_PARALLEL || 256 }}
2024-02-11 21:03:06 -06:00
matrix:
2024-02-14 20:16:31 -06:00
test-platforms: ['', '-s e2e']
2024-02-11 21:03:06 -06:00
node-version: [16.x, 18.x, 20.x]
steps:
- uses: actions/checkout@v4
2024-02-12 06:29:27 -06:00
- 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 }}
2024-02-11 21:03:06 -06:00
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
2024-02-13 04:54:41 -06:00
- uses: actions/cache@v4
2024-02-11 21:03:06 -06:00
with:
2024-02-13 00:55:54 -06:00
path: "~/.cache/puppeteer"
key: ${{ runner.os }}-${{ matrix.node-version }}-puppeteer
2024-02-13 06:02:45 -06:00
- id: cache-node-modules
uses: actions/cache@v4
with:
path: '**/node_modules'
2024-02-13 06:17:07 -06:00
key: ${{ runner.os }}-${{ matrix.node-version }}-modules-${{ hashFiles('package-lock.json') }}
- run: npm config set registry ${{ vars.NPM_CI_REGISTRY }}
2024-02-13 06:20:46 -06:00
if: ${{ vars.NPM_CI_REGISTRY && steps.cache-node-modules.outputs.cache-hit != 'true' }}
2024-02-13 06:17:07 -06:00
- run: npm ci
2024-02-13 06:20:46 -06:00
if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
- run: npm run -- test -t 120000 ${{ matrix.test-platforms }}
2024-02-13 01:11:08 -06:00
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 }}
2024-02-13 06:02:45 -06:00
- id: cache-node-modules
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ hashFiles('**/package-lock.json') }}
2024-02-13 06:20:46 -06:00
- if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
2024-02-13 06:02:45 -06:00
run: npm ci
- run: npm run lint