[SPIKE] Configure iframe-resizer
for reduced CPU usage
#3167
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: | |
pull_request: | |
push: | |
branches: | |
- 'feature/**' | |
- 'v[0-9]' | |
workflow_call: | |
inputs: | |
upload-artifact: | |
default: false | |
required: false | |
type: boolean | |
workflow_dispatch: | |
inputs: | |
runner: | |
description: Run tests on | |
type: choice | |
default: ubuntu-latest | |
options: | |
- macos-latest | |
- ubuntu-latest | |
- windows-latest | |
jobs: | |
build: | |
name: Build | |
runs-on: ${{ github.event.inputs.runner || 'ubuntu-latest' }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3.5.3 | |
- name: Restore build | |
uses: actions/cache@v3.3.1 | |
id: build-cache | |
with: | |
key: build-cache-${{ runner.os }}-${{ github.sha }} | |
path: deploy/public | |
- name: Setup Node.js | |
uses: actions/setup-node@v3.7.0 | |
if: steps.build-cache.outputs.cache-hit != 'true' | |
with: | |
cache: npm | |
node-version-file: .nvmrc | |
- name: Install dependencies | |
if: steps.build-cache.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: Build | |
if: steps.build-cache.outputs.cache-hit != 'true' | |
run: npm run build | |
# Share data between the build and deploy jobs so we don't need to run `npm run build` again on deploy | |
# Upload the deploy folder as an artifact so it can be downloaded and used in the deploy job | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3.1.2 | |
if: ${{ inputs.upload-artifact }} | |
with: | |
name: build | |
path: deploy/** | |
retention-days: 1 | |
test: | |
name: ${{ matrix.task.description }} | |
runs-on: ${{ github.event.inputs.runner || 'ubuntu-latest' }} | |
needs: [build] | |
strategy: | |
fail-fast: false | |
matrix: | |
task: | |
- description: Lint Sass | |
run: npm run lint:scss | |
- description: Lint JavaScript | |
run: npm run lint:js | |
- description: Lint HTML | |
run: npm run lint:html --ignore-scripts | |
- description: EditorConfig | |
run: npm run lint:editorconfig | |
- description: Prettier | |
run: npm run lint:prettier | |
- description: JavaScript tests | |
run: npx jest --color --maxWorkers=2 | |
- description: Check broken links | |
run: npm run check-links | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3.5.3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3.7.0 | |
with: | |
cache: npm | |
node-version-file: .nvmrc | |
- name: Install dependencies | |
run: npm ci | |
- name: Restore build | |
uses: actions/cache/restore@v3.3.1 | |
with: | |
key: build-cache-${{ runner.os }}-${{ github.sha }} | |
path: deploy/public | |
- name: Run task | |
run: ${{ matrix.task.run }} |