Build, Test, Lint for Pull Requests #120
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: Build, Test, Lint for Pull Requests | |
env: | |
CI: true | |
FORCE_COLOR: 1 | |
NODE_OPTIONS: --max_old_space_size=4096 | |
on: | |
workflow_call: | |
schedule: | |
- cron: "0 3 * * *" | |
jobs: | |
setup: | |
name: Setup, Build, Lint and Test | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event_name == 'schedule' && 'main' || github.event.pull_request.head.sha }} | |
- name: Build | |
uses: ./.github/actions/build | |
- name: Lint | |
run: npm run lint | |
- name: Check | |
run: npm run check | |
- name: Test | |
if: ${{ github.event_name == 'schedule' || github.event.label.name == 'ready-to-test' }} | |
run: npm run test --quiet --colors | |
- name: Run deprecated playwright tests | |
if: ${{ github.event_name == 'schedule' || github.event.label.name == 'ready-to-test' }} | |
uses: ./.github/actions/playwright | |
with: | |
node-test-script: test:components-functional | |
test-results-name: Deprecated tests for editing functionality | |
smoke-vital: | |
name: Smoke tests for vital components | |
if: ${{ github.event_name == 'schedule' || github.event.label.name == 'ready-to-test' }} | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event_name == 'schedule' && 'main' || github.event.pull_request.head.sha }} | |
- name: Build | |
uses: ./.github/actions/build | |
- name: Run vital playwright tests | |
env: | |
APPLITOOLS_API_KEY: ${{ secrets.APPLITOOLS_API_KEY }} | |
APPLITOOLS_BATCH_NAME: ${{ github.event_name == 'schedule' && 'Regression Test Run' || format('{0} ({1})', github.event.pull_request.title, github.event.pull_request.number) }} | |
PW_INCLUDE_ALL_RENDERERS: ${{ github.event_name == 'schedule' }} | |
uses: ./.github/actions/playwright | |
with: | |
node-test-script: test:components-visual | |
test-results-name: Smoke tests for vital components | |
- name: Upload Accessibility results | |
if: always() | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Accessibility | |
path: accessibility-reports/ | |
retention-days: 30 | |
cleanup: | |
if: always() && github.event_name != 'schedule' | |
runs-on: ubuntu-20.04 | |
needs: [ setup, smoke-vital ] | |
permissions: | |
pull-requests: write | |
steps: | |
- uses: actions-ecosystem/action-remove-labels@v1 | |
if: always() | |
with: | |
labels: ${{ github.event.label.name }} | |
fail_on_error: false | |
test-results: | |
name: Test Results | |
if: always() && github.event.label.name == 'ready-to-test' | |
runs-on: ubuntu-latest | |
needs: [ setup, smoke-vital ] | |
permissions: | |
checks: write | |
pull-requests: write | |
steps: | |
- name: Download file | |
uses: actions/download-artifact@v3 | |
with: | |
path: playwright-report/ | |
- name: Publish Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v1 | |
with: | |
check_name: 'Playwright Test Results' | |
files: "playwright-report/**/*.xml" |