chore: Add Vue Ecosystem CI scripts #256
Workflow file for this run
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: UI Tests | |
on: | |
pull_request_target: | |
types: [opened, synchronize] | |
branches: | |
- 'dev' | |
paths: | |
- 'ui/**.js' | |
- '!.github/**' | |
jobs: | |
build: | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ui | |
name: Build the UI package | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 14 | |
- name: Install dependencies | |
run: npm i | |
- name: Build the package | |
run: npm run build | |
tests: | |
# If the build pipeline doesn't succeed, we don't need to run tests at all | |
needs: build | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
actions: read # to correctly identify workflow run (cypress-io/github-action) | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
browser: [chrome, firefox] | |
name: Tests on ${{ matrix.browser }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 14 | |
- name: Install dependencies | |
run: cd ./ui && npm i | |
- name: Run tests in ${{ matrix.browser }} browser | |
uses: cypress-io/github-action@v5 | |
with: | |
browser: ${{ matrix.browser }} | |
command: npm run test:component:ci --record --parallel | |
working-directory: ui | |
tag: ${{ github.event.name }} # Tag will be either "opened" or "synchronize" | |
group: Tests in ${{ matrix.browser }} browser | |
env: | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} # Dashboard record key as an environment variable | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # To allow accurately detecting a build vs a re-run build | |
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }} | |
COMMIT_INFO_AUTHOR: ${{ github.event.pull_request.user.login }} | |
COMMIT_INFO_TIMESTAMP: ${{ github.event.pull_request.created_at }} | |
- name: Add workflow summary | |
env: | |
SUMMARY: | | |
Hi @${{ github.event.pull_request.user.login }} and thanks for the contribution! 👏 | |
We've detected file changes inside the `ui` folder, so that triggered our Cypress component tests. | |
run: echo "$SUMMARY" >> $GITHUB_STEP_SUMMARY | |
if: always() | |
- name: Output failure message | |
env: | |
FAILURE: ":bangbang: Seems like some of the tests are failing. Please amend 'em for someone from the team to be able to review it." | |
run: echo "$FAILURE" >> $GITHUB_STEP_SUMMARY | |
if: failure() || cancelled() | |
- name: Output success message | |
env: | |
SUCCESS: ':white_check_mark: Seems like all the tests passed successfully, so your PR is ready to be reviewed!' | |
run: echo "$SUCCESS" >> $GITHUB_STEP_SUMMARY | |
if: success() |