Skip to content

Commit

Permalink
test(cypress): only run in parallel for pull requests
Browse files Browse the repository at this point in the history
Results from pushes are not time critical.
Save some resources by avoiding the overhead of parallelization.

Signed-off-by: Max <max@nextcloud.com>
  • Loading branch information
max-nextcloud committed Sep 5, 2023
1 parent ff8c2d0 commit 5a07227
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ on:
- main
- master
- stable*
- test/slow-cypress-on-push

concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
cancel-in-progress: ${{ !github.head_ref }}

env:
APP_NAME: text
Expand Down Expand Up @@ -60,12 +61,6 @@ jobs:
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"

- name: Install dependencies & build app
working-directory: apps/${{ env.APP_NAME }}
run: |
npm ci
TESTING=true npm run build --if-present
- name: Save context
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
Expand All @@ -83,6 +78,23 @@ jobs:
containers: [1, 2, 3, 4, 5, 6, 7, 8]
php-versions: [ '8.1' ]
server-versions: [ 'master' ]
is-pr:
- ${{ !!github.head_ref }}
exclude:
- is-pr: false
containers: 2
- is-pr: false
containers: 3
- is-pr: false
containers: 4
- is-pr: false
containers: 5
- is-pr: false
containers: 6
- is-pr: false
containers: 7
- is-pr: false
containers: 8

name: runner ${{ matrix.containers }}

Expand Down Expand Up @@ -145,8 +157,8 @@ jobs:
- name: Cypress run
uses: cypress-io/github-action@v4
with:
record: true
parallel: true
record: '${{ !!matrix.is-pr }}' # only on pull requests
parallel: '${{ !!matrix.is-pr }}' # only on pull requests
wait-on: '${{ env.CYPRESS_baseUrl }}'
working-directory: 'apps/${{ env.APP_NAME }}'
config: defaultCommandTimeout=10000,video=false
Expand Down

0 comments on commit 5a07227

Please sign in to comment.