give an example of hiding GH summary for #340 #721
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: push | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
jobs: | |
# example splitting all tests across GitHub machines | |
prepare: | |
runs-on: ubuntu-22.04 | |
# explicitly set the output of this job | |
# so that other jobs can use it | |
outputs: | |
matrix: ${{ steps.prepare.outputs.matrix }} | |
steps: | |
# generate the list using a bash script | |
- name: Create matrix ⊹ | |
id: prepare | |
# for reusable workflow, must use the full action reference | |
uses: bahmutov/[email protected] | |
with: | |
n: 3 # number of containers to output | |
- name: Print result 🖨 | |
run: echo '${{ steps.prepare.outputs.matrix }}' | |
test-unit: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout 🛎 | |
uses: actions/checkout@v4 | |
- name: Install dependencies 🧪 | |
# https://github.com/cypress-io/github-action | |
uses: cypress-io/github-action@v6 | |
with: | |
runTests: false | |
- name: Run unit tests 🧪 | |
run: npm run unit | |
# two jobs that split 2 explicit specs | |
test-spec: | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
containers: [1, 2] | |
steps: | |
- name: Checkout 🛎 | |
uses: actions/checkout@v4 | |
- name: Run split Cypress E2E tests 🧪 | |
# https://github.com/cypress-io/github-action | |
uses: cypress-io/github-action@v6 | |
with: | |
build: npm run test-names | |
# using operating system process environment variables | |
env: | |
SPEC: 'cypress/e2e/spec-b.cy.js,cypress/e2e/spec-e.cy.js' | |
SPLIT: ${{ strategy.job-total }} | |
SPLIT_INDEX: ${{ strategy.job-index }} | |
DEBUG: 'cypress-split' | |
test-spec-wildcard: | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
containers: [1, 2] | |
steps: | |
- name: Checkout 🛎 | |
uses: actions/checkout@v4 | |
- name: Run split Cypress E2E tests 🧪 | |
# https://github.com/cypress-io/github-action | |
uses: cypress-io/github-action@v6 | |
with: | |
build: npm run demo-preview-spec | |
# using operating system process environment variables | |
env: | |
# confirm we can use wildcards in the SPEC list | |
SPEC: 'cypress/e2e/spec-*.cy.js, cypress/e2e/spec-*.cy.js' | |
SPLIT: ${{ strategy.job-total }} | |
SPLIT_INDEX: ${{ strategy.job-index }} | |
DEBUG: 'cypress-split' | |
test-random-order: | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
containers: [1, 2] | |
steps: | |
- name: Checkout 🛎 | |
uses: actions/checkout@v4 | |
- name: Run random order Cypress E2E tests 🧪 | |
# https://github.com/cypress-io/github-action | |
uses: cypress-io/github-action@v6 | |
# using operating system process environment variables | |
env: | |
SPLIT_RANDOM_SEED: 42 | |
SPLIT: ${{ strategy.job-total }} | |
SPLIT_INDEX: ${{ strategy.job-index }} | |
DEBUG: 'cypress-split' | |
test-subfolder: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout 🛎 | |
uses: actions/checkout@v4 | |
- name: Run Cypress E2E tests in the subfolder 🧪 | |
# https://github.com/cypress-io/github-action | |
uses: cypress-io/github-action@v6 | |
with: | |
build: npm run subfolder | |
env: | |
SPLIT: 2 | |
SPLIT_INDEX: 0 | |
test-merge-timings: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout 🛎 | |
uses: actions/checkout@v4 | |
- name: Install dependencies 🧪 | |
uses: cypress-io/github-action@v6 | |
with: | |
runTests: false | |
- name: Merge example timings ⛙ | |
id: merge | |
run: npm run demo-merge -- --set-gha-output merged | |
env: | |
DEBUG: cypress-split | |
- name: Show merged output | |
run: | | |
echo off | |
echo '${{ steps.merge.outputs.merged }}' | |
preview: | |
needs: prepare | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout 🛎 | |
uses: actions/checkout@v4 | |
- name: Preview the split 🧪 | |
# https://github.com/cypress-io/github-action | |
uses: cypress-io/github-action@v6 | |
with: | |
command: npm run demo-preview | |
- name: Preview the split with timings 🧪 | |
# https://github.com/cypress-io/github-action | |
uses: cypress-io/github-action@v6 | |
with: | |
install: false | |
command: npm run demo-preview -- --split-file ./timings.json | |
test-split: | |
needs: prepare | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJSON(needs.prepare.outputs.matrix) }} | |
steps: | |
- name: Checkout 🛎 | |
uses: actions/checkout@v4 | |
- name: Print GitHub variables 🖨 | |
run: npx @bahmutov/print-env GITHUB | |
- name: Print GitHub strategy context 🖨 | |
run: echo '${{ toJSON(strategy) }}' | |
- name: Run split Cypress tests 🧪 | |
# https://github.com/cypress-io/github-action | |
uses: cypress-io/github-action@v6 | |
with: | |
build: npm run test-names | |
# using operating system process environment variables | |
env: | |
SPLIT: ${{ strategy.job-total }} | |
SPLIT_INDEX: ${{ strategy.job-index }} | |
test-no-summary: | |
needs: prepare | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout 🛎 | |
uses: actions/checkout@v4 | |
- name: Run some Cypress tests 🧪 | |
# https://github.com/cypress-io/github-action | |
uses: cypress-io/github-action@v6 | |
# run half of all specs | |
env: | |
SPLIT: 2 | |
# run the second part of the list of specs | |
SPLIT_INDEX: 1 | |
# do not write summary to github | |
SPLIT_SUMMARY: false | |
test-empty: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout 🛎 | |
uses: actions/checkout@v4 | |
- name: Run an empty Cypress split 🧪 | |
# https://github.com/cypress-io/github-action | |
uses: cypress-io/github-action@v6 | |
with: | |
build: npm run deps | |
command: npm run empty | |
test-user-spec-list: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout 🛎 | |
uses: actions/checkout@v4 | |
- name: Split explicit user list of specs 🧪 | |
# https://github.com/cypress-io/github-action | |
uses: cypress-io/github-action@v6 | |
with: | |
command: npm run user-specs | |
test-timings: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout 🛎 | |
uses: actions/checkout@v4 | |
- name: Split specs based on timings json file 🧪 | |
# https://github.com/cypress-io/github-action | |
uses: cypress-io/github-action@v6 | |
with: | |
command: npm run timings | |
test-timings-split-output-file: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout 🛎 | |
uses: actions/checkout@v4 | |
- name: Split specs based on timings json file 🧪, write output to different file 🗃️ | |
# https://github.com/cypress-io/github-action | |
uses: cypress-io/github-action@v6 | |
with: | |
command: npm run timings-split-output-file | |
- name: Show split output file | |
run: cat new-timings.json | |
test-timings-no-file: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout 🛎 | |
uses: actions/checkout@v4 | |
- name: Split specs based on non-existent timings json file 🧪 | |
# https://github.com/cypress-io/github-action | |
uses: cypress-io/github-action@v6 | |
with: | |
command: npm run timings-no-file | |
test-find-timings-file: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout 🛎 | |
uses: actions/checkout@v4 | |
- name: Needs to find the timings file 🧪 | |
# https://github.com/cypress-io/github-action | |
uses: cypress-io/github-action@v6 | |
with: | |
project: examples/timings-file/tests/cypress-tests | |
env: | |
SPLIT: 1 | |
SPLIT_INDEX: 0 | |
# the timings file is not next to the config file | |
# but in the project folder | |
SPLIT_FILE: timings.json | |
test-pending-tests: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout 🛎 | |
uses: actions/checkout@v4 | |
- name: Needs to find the timings file 🧪 | |
# https://github.com/cypress-io/github-action | |
uses: cypress-io/github-action@v6 | |
with: | |
project: examples/pending-timings/tests/cypress-tests | |
env: | |
SPLIT: 1 | |
SPLIT_INDEX: 0 | |
# the timings file is not next to the config file | |
# but in the project folder | |
SPLIT_FILE: timings.json | |
test-workflow-e2e: | |
# https://github.com/bahmutov/cypress-workflows | |
uses: bahmutov/cypress-workflows/.github/workflows/split.yml@v2 | |
with: | |
nE2E: 3 | |
test-workflow-component: | |
# https://github.com/bahmutov/cypress-workflows | |
uses: bahmutov/cypress-workflows/.github/workflows/split.yml@v2 | |
with: | |
nComponent: 2 | |
# using SPLIT_INDEX1 to start index at 1 | |
test-index1: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout 🛎 | |
uses: actions/checkout@v4 | |
- name: Run split Cypress E2E tests 🧪 | |
# https://github.com/cypress-io/github-action | |
uses: cypress-io/github-action@v6 | |
# using operating system process environment variables | |
env: | |
SPEC: 'cypress/e2e/spec-b.cy.js,cypress/e2e/spec-e.cy.js' | |
SPLIT: 2 | |
# should run the first spec "spec-b" in the list | |
SPLIT_INDEX1: 1 | |
DEBUG: 'cypress-split' | |
test-skipped-specs: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout 🛎 | |
uses: actions/checkout@v4 | |
- name: Run split Cypress E2E tests 🧪 | |
# https://github.com/cypress-io/github-action | |
uses: cypress-io/github-action@v6 | |
# using operating system process environment variables | |
env: | |
# should exclude these specs | |
SKIP_SPEC: 'cypress/e2e/spec-b.cy.js,cypress/e2e/spec-e.cy.js' | |
SPLIT: 2 | |
SPLIT_INDEX: 0 | |
DEBUG: 'cypress-split' | |
release: | |
if: github.ref == 'refs/heads/main' | |
needs: | |
[ | |
test-random-order, | |
test-skipped-specs, | |
test-unit, | |
test-empty, | |
test-split, | |
test-spec, | |
test-workflow-e2e, | |
test-workflow-component, | |
test-no-summary, | |
test-user-spec-list, | |
test-subfolder, | |
test-index1, | |
test-timings, | |
test-timings-no-file, | |
test-pending-tests, | |
test-merge-timings, | |
test-find-timings-file, | |
test-spec-wildcard, | |
preview, | |
] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout 🛎 | |
uses: actions/checkout@v4 | |
- name: Semantic Release 🚀 | |
# https://github.com/cycjimmy/semantic-release-action | |
uses: cycjimmy/semantic-release-action@v4 | |
with: | |
branch: main | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |