Skip to content

Build, Test, Lint for Pull Requests #3649

Build, Test, Lint for Pull Requests

Build, Test, Lint for Pull Requests #3649

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:pw-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:playwright
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
lhci:
name: Lighthouse
if: ${{ github.event_name == 'schedule' || github.event.label.name == 'ready-to-test' }}
runs-on: ubuntu-20.04
permissions:
statuses: write
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: Lighthouse audit
if: always()
uses: treosh/lighthouse-ci-action@v10
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
APP_SITE_NAME: vital-demo-next
with:
configPath: ./lighthouserc.js
uploadArtifacts: true
temporaryPublicStorage: true
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"