Skip to content

Parser tests

Parser tests #1042

Workflow file for this run

name: Parser tests
on:
schedule:
- cron: '02 19 * * *'
push:
branches:
- main
paths:
- 'parser/**'
- .github/workflows/parser.yml
pull_request:
branches:
- main
paths:
- 'parser/**'
- .github/workflows/parser.yml
jobs:
tests:
name: Parser tests
runs-on: ubuntu-20.04
defaults:
run:
working-directory: parser
env:
IS_PULL_REQUEST: ${{ github.event_name == 'pull_request' }}
RUN_E2E_TESTS: 'true'
TEST_RESULTS_PATH:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: yarn install
run: yarn install
- name: Set test results path environment variable
run: echo "TEST_RESULTS_PATH=${{ runner.temp }}/test-results" >> $GITHUB_ENV
- name: yarn test
run: yarn test-ci
env:
JEST_HTML_REPORTER_OUTPUT_PATH: ${{ env.TEST_RESULTS_PATH }}/unit.html
- name: Determine if we're skipping end-to-end tests on Pull Request
if: ${{ env.IS_PULL_REQUEST == 'true' }}
run: |
headCommitMessage=$(git log ${{ github.event.pull_request.head.sha }} -n 1 --format=%B)
echo "HEAD commit message is: $headCommitMessage"
if [[ $headCommitMessage == *"[skip-e2e]"* ]]; then
echo "RUN_E2E_TESTS=false" >> $GITHUB_ENV
echo "::warning title=Skipping end-to-end tests::End-to-end tests have been skipped because '[skip-e2e]' was present in the commit message."
fi
- name: yarn e2e
id: e2e
if: ${{ env.RUN_E2E_TESTS == 'true' }}
run: yarn e2e-all-ci
env:
JEST_HTML_REPORTER_OUTPUT_PATH: ${{ env.TEST_RESULTS_PATH }}/e2e-all.html
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: ${{ env.TEST_RESULTS_PATH }}
if-no-files-found: error
- name: Upload unit tests coverage
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage
path: ${{ github.workspace }}/parser/coverage/lcov-report
if-no-files-found: error
- name: Upload failed e2e logs and screenshots
uses: actions/upload-artifact@v4
if: ${{ failure() && steps.e2e.conclusion == 'failure' }}
with:
name: failed-e2e-log-screenshot
path: '${{ github.workspace }}/parser/out/log'