Merge f7bdcd995d5840f659fc282e5853bbac40f10100 into main #5115
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: e2e-tests-parallel | |
on: | |
push: | |
branches: [ main, release/v2*, feat/* ] | |
pull_request: | |
branches: [ main, release/v2*, feat/* ] | |
concurrency: | |
group: e2e-tests-parallel${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
install-web-components: | |
strategy: | |
matrix: | |
os: [ macos-latest ] | |
node-version: [ 18.x ] | |
browser: [ chromium ] | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 120 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js 18.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'yarn' | |
- uses: actions/cache@v4 | |
name: Download any existing cache | |
id: yarn-cache | |
with: | |
path: | | |
**/node_modules | |
/Users/runner/Library/Caches/Cypress | |
${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn | |
- name: Installing dependencies (if not cached) | |
if: steps.yarn-cache.outputs.cache-hit != 'true' | |
run: yarn install --immutable --immutable-cache | |
- name: Build project | |
run: yarn lerna run --stream --ignore @carbon/ibmdotcom-react build | |
- name: Set Cloud Masthead env var | |
uses: ./.github/actions/set-dotenv | |
with: | |
env-file: packages/web-components/.env | |
env: | |
C4D_CLOUD_MASTHEAD: true | |
C4D_FLAGS_ALL: true | |
- name: Build storybook | |
working-directory: packages/web-components | |
run: yarn build-storybook | |
- name: Save build folder | |
uses: actions/upload-artifact@v4 | |
with: | |
name: storybook-build | |
path: packages/web-components/storybook-static | |
- name: Clear remnant failure files | |
uses: geekyeggo/delete-artifact@v5 | |
with: | |
name: failure-wc.txt | |
web-components-tests: | |
runs-on: macos-latest | |
needs: install-web-components | |
continue-on-error: true | |
strategy: | |
fail-fast: false | |
matrix: | |
# run copies of the current job in parallel | |
containers: [1, 2, 3, 4, 5, 6, 7] | |
os: [ macos-latest ] | |
node-version: [ 18.x ] | |
browser: [ chromium ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'yarn' | |
- name: Download the build folders | |
uses: actions/download-artifact@v4 | |
with: | |
name: storybook-build | |
path: packages/web-components/storybook-static | |
- uses: actions/cache@v4 | |
name: Retrieve yarn cache | |
id: yarn-cache | |
with: | |
path: | | |
**/node_modules | |
/Users/runner/Library/Caches/Cypress | |
${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn | |
- name: 'Run e2e tests (chromium)' | |
if: matrix.browser == 'chromium' | |
id: cypress-tests-wc | |
continue-on-error: true | |
working-directory: packages/web-components | |
run: yarn test:e2e-storybook:test:parallel | |
env: | |
CI_BUILD_ID: '${{ github.sha }}-${{ github.workflow }}-wc' | |
CYPRESS_API_URL: "https://sorry-cypress-director.qfl95m0zv01.us-east.codeengine.appdomain.cloud" | |
CYPRESS_CACHE_FOLDER: /Users/runner/Library/Caches/Cypress | |
- name: Create failure file if job failed | |
id: wc-no-tests-ran | |
if: steps.cypress-tests-wc.outcome == 'failure' | |
run: touch failure-wc.txt | |
- name: Save failure file | |
if: steps.cypress-tests-wc.outcome == 'failure' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: failure-wc | |
path: failure-wc.txt | |
- name: Exit upon failure | |
if: steps.cypress-tests-wc.outcome == 'failure' | |
run: exit 1 | |
wc-tests-completed: | |
if: always() | |
runs-on: ubuntu-20.04 | |
needs: web-components-tests | |
steps: | |
- uses: actions/download-artifact@v4 | |
continue-on-error: true | |
with: | |
name: failure-wc | |
- name: Check failure file existence | |
continue-on-error: true | |
id: check_files | |
uses: andstor/file-existence-action@v3 | |
with: | |
files: "failure-wc.txt" | |
- name: Failure file exists, exit with error | |
if: steps.check_files.outputs.files_exists == 'true' | |
run: exit 1 |