2024 12 #386
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: CI (on PRs and master branch) | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
env: | |
IS_PR_WITH_PERCY: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.title, 'SKIP_PERCY') && !contains(github.event.pull_request.body, 'SKIP_PERCY') }} | |
IS_PR_JUST_MERGED: ${{ github.ref_name == 'master' && contains(github.event.head_commit.message, 'Merge pull request') && !contains(github.event.head_commit.message, 'SKIP_PERCY') }} | |
jobs: | |
install_and_cache_dependencies: | |
if: "!contains(github.event.head_commit.message, 'SKIP_CI')" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout ποΈ | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16.16.0 | |
cache: yarn | |
- name: Install Dependencies π§ | |
run: yarn install --immutable | |
build_and_test: | |
runs-on: ubuntu-latest | |
needs: install_and_cache_dependencies | |
steps: | |
- name: Log Interesting Info βΉοΈ | |
run: | | |
echo "The job is triggered by a ${{ github.event_name }} event." | |
echo "This job is now running on a ${{ runner.os }} server hosted by GitHub!" | |
- name: Checkout ποΈ | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16.16.0 | |
cache: yarn | |
- name: Install Dependencies π§ | |
run: yarn install --immutable | |
- name: Type Check Κ¦ | |
run: yarn run typecheck | |
- name: Linting π΅ | |
run: yarn run lint | |
- name: Formatting π | |
run: yarn run format:check | |
- name: Build π¨ | |
run: yarn run build:public | |
- name: Run Tests (Cypress excluded) β | |
run: yarn run test | |
- name: "Cancel build on failure" | |
if: failure() | |
uses: andymckay/[email protected] | |
cypress_tests: | |
needs: install_and_cache_dependencies | |
strategy: | |
fail-fast: true | |
matrix: | |
group: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | |
runs-on: ubuntu-latest # note: macos doesn't have docker installed! | |
container: cypress/browsers:node16.16.0-chrome107-ff107-edge | |
env: | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
CYPRESS_parallel: true | |
steps: | |
- name: Log Interesting Info βΉοΈ | |
run: | | |
echo "The job is triggered by a ${{ github.event_name }} event." | |
echo "This job is now running on a ${{ runner.os }} server hosted by GitHub!" | |
- name: Checkout ποΈ | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16.16.0 | |
cache: yarn | |
- name: Install Dependencies π§ | |
run: yarn install --immutable | |
- name: Run Cypress Tests β | |
if: ${{ env.IS_PR_JUST_MERGED == 'true' || env.IS_PR_WITH_PERCY == 'true' }} | |
env: | |
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }} | |
# Without this, we would need to "finalize" percy build explicitly. More info: https://docs.percy.io/docs/parallel-test-suites | |
PERCY_PARALLEL_TOTAL: 15 # 10 for component tests, 5 for e2e | |
# Percy's nonce is supposed to be set to run id by default, but it's not. Plus, appending run_number makes it more reliable in case of rerunning | |
PERCY_PARALLEL_NONCE: ${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }} | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
run: yarn run cypress:component --record --parallel --group component | |
- name: Run Cypress Tests (without percy) β | |
if: ${{ !(env.IS_PR_JUST_MERGED == 'true' || env.IS_PR_WITH_PERCY == 'true') }} | |
env: | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
run: yarn run cypress:component --record --parallel --group component | |
cypress_tests_e2e: | |
needs: install_and_cache_dependencies | |
strategy: | |
fail-fast: true | |
matrix: | |
group: [1, 2, 3, 4, 5] | |
runs-on: ubuntu-latest # note: macos doesn't have docker installed! | |
container: cypress/browsers:node16.16.0-chrome107-ff107-edge | |
env: | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
CYPRESS_parallel: true | |
steps: | |
- name: Checkout ποΈ | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16.16.0 | |
cache: yarn | |
- name: Install Dependencies π§ | |
run: yarn install --immutable | |
- name: Build example-app π¨ | |
run: yarn workspace jui-example-app run build | |
- name: Run Cypress Tests β | |
if: ${{ env.IS_PR_JUST_MERGED == 'true' || env.IS_PR_WITH_PERCY == 'true' }} | |
env: | |
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }} | |
# Without this, we would need to "finalize" percy build explicitly. More info: https://docs.percy.io/docs/parallel-test-suites | |
PERCY_PARALLEL_TOTAL: 15 # 10 for component tests, 5 for e2e | |
# Percy's nonce is supposed to be set to run id by default, but it's not. Plus, appending run_number makes it more reliable in case of rerunning | |
PERCY_PARALLEL_NONCE: ${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }} | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
run: | | |
yarn workspace jui-example-app run serve & | |
yarn run cypress:e2e --record --parallel --group e2e | |
- name: Run Cypress Tests (without percy) β | |
if: ${{ !(env.IS_PR_JUST_MERGED == 'true' || env.IS_PR_WITH_PERCY == 'true') }} | |
env: | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
run: | | |
yarn workspace jui-example-app run serve & | |
yarn run cypress:e2e --record --parallel --group e2e | |
# just because there is no way to add a required status check based on a matrix job. In order to avoid adding | |
# individual status check for each parallel job. Based on this suggestion: | |
# https://github.com/orgs/community/discussions/26822#discussioncomment-5122101 | |
succeeded: | |
name: Succeeded | |
if: ${{ always() }} | |
runs-on: ubuntu-latest | |
needs: [build_and_test, cypress_tests, cypress_tests_e2e] | |
steps: | |
- run: exit 1 | |
# see https://stackoverflow.com/a/67532120/4907315 | |
if: >- | |
${{ | |
contains(needs.*.result, 'failure') | |
|| contains(needs.*.result, 'cancelled') | |
}} |