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 authored and juliusknorr committed Oct 11, 2023
1 parent fd8be89 commit a2bae24
Showing 1 changed file with 26 additions and 9 deletions.
35 changes: 26 additions & 9 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

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

env:
APP_NAME: text
Expand All @@ -29,26 +29,26 @@ jobs:

steps:
- name: Checkout server
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
submodules: true

- name: Checkout viewer
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
repository: nextcloud/viewer
ref: ${{ matrix.server-versions }}
path: apps/viewer

- name: Checkout app
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
path: apps/${{ env.APP_NAME }}

- name: Read package.json node and npm engines version
uses: skjnldsv/read-package-engines-version-actions@0ce2ed60f6df073a62a77c0a4958dd0fc68e32e7 # v2.1
uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
id: versions
with:
fallbackNode: "^20"
Expand Down Expand Up @@ -85,6 +85,23 @@ jobs:
matrix:
containers: [1, 2, 3, 4, 5, 6, 7, 8]
php-versions: [ '8.1' ]
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 @@ -117,7 +134,7 @@ jobs:
run: npm i -g npm@"${{ needs.init.outputs.npmVersion }}"

- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2
with:
php-version: ${{ matrix.php-versions }}
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, pgsql, pdo_pgsql
Expand Down Expand Up @@ -147,12 +164,12 @@ 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
tag: ${{ github.event_name }}
tag: ${{ matrix.is-pr && github.event_name }}
env:
# https://github.com/cypress-io/github-action/issues/124
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }}
Expand Down

0 comments on commit a2bae24

Please sign in to comment.