[Do not merge] - Preview link #4790
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: Unit Tests | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
test-base: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout front end code. | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.base_ref}} | |
- name: Build UI | |
run: yarn install --frozen-lockfile | |
- name: Run unit tests | |
run: yarn test:unit --coverage.reporter=json --outputFile=base-report.json && node ./scripts/fix-coverage-report.js --outputFile base-report.json | |
- name: Upload Report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: base-report | |
path: base-report.json | |
test-branch: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout front end code. | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.ref}} | |
- name: Build UI | |
run: yarn install --frozen-lockfile | |
- name: Run unit tests | |
run: yarn test:unit --coverage.reporter=json --outputFile=branch-report.json && node ./scripts/fix-coverage-report.js --outputFile branch-report.json | |
- name: Upload Report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: branch-report | |
path: branch-report.json | |
coverageReport: | |
runs-on: ubuntu-latest | |
needs: [test-base, test-branch] | |
permissions: | |
pull-requests: write | |
contents: write | |
steps: | |
- name: Download Base Report | |
uses: actions/download-artifact@v3 | |
with: | |
name: base-report | |
- name: Download Branch Report | |
uses: actions/download-artifact@v3 | |
with: | |
name: branch-report | |
- name: Generate Coverage Report | |
uses: ArtiomTr/jest-coverage-report-action@v2 | |
with: | |
test-script: yarn test:unit | |
package-manager: yarn | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
coverage-file: branch-report.json | |
base-coverage-file: base-report.json | |
annotations: all |