From 3b16f14a8734d3522d9e68339d230cc426f2ef31 Mon Sep 17 00:00:00 2001 From: Nextcloud bot Date: Sat, 28 Mar 2026 08:52:50 +0000 Subject: [PATCH] ci: update all workflow templates from organization template repository Signed-off-by: Nextcloud bot --- .../block-unconventional-commits.yml | 4 +- .github/workflows/cypress.yml | 169 ++++++++++-------- .github/workflows/documentation.yml | 4 +- .github/workflows/node-test.yml | 4 +- .github/workflows/reuse.yml | 2 +- 5 files changed, 100 insertions(+), 83 deletions(-) diff --git a/.github/workflows/block-unconventional-commits.yml b/.github/workflows/block-unconventional-commits.yml index 601f31c2..3f91262b 100644 --- a/.github/workflows/block-unconventional-commits.yml +++ b/.github/workflows/block-unconventional-commits.yml @@ -27,10 +27,10 @@ jobs: steps: - name: Checkout - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - - uses: webiny/action-conventional-commits@8bc41ff4e7d423d56fa4905f6ff79209a78776c7 # v1.3.0 + - uses: webiny/action-conventional-commits@faccb24fc2550dd15c0390d944379d2d8ed9690e # v1.3.1 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 7d148116..7d8913d6 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -1,132 +1,149 @@ +# This workflow is provided via the organization template repository +# +# https://github.com/nextcloud-libraries/.github +# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization +# # SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors # SPDX-License-Identifier: MIT + name: Cypress -on: - pull_request: - push: - branches: - - main - - master - - stable* +on: pull_request + +concurrency: + group: cypress-${{ github.head_ref || github.run_id }} + cancel-in-progress: true env: - BRANCH: ${{ github.base_ref || github.event.repository.default_branch }} + # Adjust APP_NAME if your repository name is different + APP_NAME: ${{ github.event.repository.name }} + + # This represents the server branch to checkout. + # Usually it's the base branch of the PR, but for pushes it's the branch itself. + # e.g. 'main', 'stable27' or 'feature/my-feature' + # n.b. server will use head_ref, as we want to test the PR branch. + BRANCH: ${{ github.base_ref || github.ref_name }} + + +permissions: + contents: read jobs: - cypress-e2e: + init: runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - # run multiple copies of the current job in parallel - containers: [1] + env: + PUPPETEER_SKIP_DOWNLOAD: true - name: e2e runner ${{ matrix.containers }} steps: - - name: Checkout - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - - name: Read package.json - uses: nextcloud-libraries/parse-package-engines-action@122ae05d4257008180a514e1ddeb0c1b9d094bdd # v0.1.0 - id: versions - - - name: Set up node - uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 + - name: Disabled on forks + if: ${{ github.event.pull_request.head.repo.full_name != github.repository }} + run: | + echo 'Can not run cypress on forks' + exit 1 + + - name: Checkout app + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: - node-version: ${{ steps.versions.outputs.node-version }} + persist-credentials: false - - name: Set up npm - run: npm i -g 'npm@${{ steps.versions.outputs.package-manager-version }}' + - name: Check composer.json + id: check_composer + uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0 + with: + files: 'composer.json' - - name: Pull server image - run: docker pull ghcr.io/nextcloud/continuous-integration-shallow-server + - name: Install composer dependencies + if: steps.check_composer.outputs.files_exists == 'true' + run: composer install --no-dev - - name: Run E2E cypress tests - uses: cypress-io/github-action@57b70560982e6a11d23d4b8bec7f8a487cdbb71b # v6.7.8 + - name: Set up node + uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 with: - # cypress io - record: true - parallel: true - # cypress env - ci-build-id: ${{ github.sha }}-${{ github.run_number }} - tag: ${{ github.event_name }} - group: 'E2E' - # Build library before using it - build: npm run build:instrumented - env: - # Needs to be prefixed with CYPRESS_ - CYPRESS_BRANCH: ${{ env.BRANCH }} - # https://github.com/cypress-io/github-action/issues/124 - COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} + node-version-file: 'package.json' - - name: Collect coverage - uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.2 + - name: Install node dependencies & build app + run: | + npm ci + TESTING=true npm run build --if-present + + - name: Save context + uses: buildjet/cache/save@3e70d19e31d6a8030aeddf6ed8dbe601f94d09f4 # v4.0.2 with: - files: ./coverage/lcov.info + key: cypress-context-${{ github.run_id }} + path: ./ - cypress-component: + cypress: runs-on: ubuntu-latest + needs: init strategy: fail-fast: false matrix: - # run multiple copies of the current job in parallel - containers: [1] + # Run multiple copies of the current job in parallel + # Please increase the number or runners as your tests suite grows + containers: ['component'] + + name: runner ${{ matrix.containers }} - name: component runner ${{ matrix.containers }} steps: - - name: Checkout - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Restore context + uses: buildjet/cache/restore@3e70d19e31d6a8030aeddf6ed8dbe601f94d09f4 # v4.0.2 + with: + fail-on-cache-miss: true + key: cypress-context-${{ github.run_id }} + path: ./ - name: Read package.json uses: nextcloud-libraries/parse-package-engines-action@122ae05d4257008180a514e1ddeb0c1b9d094bdd # v0.1.0 id: versions - name: Set up node - uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 + uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 with: node-version: ${{ steps.versions.outputs.node-version }} - name: Set up npm run: npm i -g 'npm@${{ steps.versions.outputs.package-manager-version }}' - - name: Run Components cypress tests - uses: cypress-io/github-action@57b70560982e6a11d23d4b8bec7f8a487cdbb71b # v6.7.8 + - name: Run ${{ startsWith(matrix.containers, 'component') && 'component' || 'E2E' }} cypress tests + uses: cypress-io/github-action@e44ee0fa67251ab7e2d854d85b3a466577f47d14 # v7.1.3 with: - # to run component tests we need to use "component: true" - component: true - # cypress io - record: true - parallel: true + record: ${{ secrets.CYPRESS_RECORD_KEY && true }} # zizmor: ignore[secrets-outside-env] + parallel: ${{ secrets.CYPRESS_RECORD_KEY && true }} # zizmor: ignore[secrets-outside-env] + # cypress run type + component: ${{ startsWith(matrix.containers, 'component') }} + group: ${{ secrets.CYPRESS_RECORD_KEY && env.CYPRESS_GROUP }} # cypress env - ci-build-id: ${{ github.sha }}-${{ github.run_number }} - tag: ${{ github.event_name }} - group: 'Components' - # Tests use (instrumented) built files - build: npm run build:instrumented + ci-build-id: ${{ secrets.CYPRESS_RECORD_KEY && env.CYPRESS_BUILD_ID }} # zizmor: ignore[secrets-outside-env] + tag: ${{ secrets.CYPRESS_RECORD_KEY && github.event_name }} # zizmor: ignore[secrets-outside-env] env: # Needs to be prefixed with CYPRESS_ CYPRESS_BRANCH: ${{ env.BRANCH }} # https://github.com/cypress-io/github-action/issues/124 - COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }} + COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }} + # Needed for some specific code workarounds + TESTING: true GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} + CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} # zizmor: ignore[secrets-outside-env] + CYPRESS_BUILD_ID: ${{ github.sha }}-${{ github.run_number }} + CYPRESS_GROUP: Run ${{ startsWith(matrix.containers, 'component') && 'component' || 'E2E' }} - - name: Collect coverage - uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.2 + - name: Upload snapshots + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 + if: always() with: - files: ./coverage/lcov.info + name: snapshots_${{ matrix.containers }} + path: cypress/snapshots summary: runs-on: ubuntu-latest - needs: [cypress-e2e, cypress-component] + needs: [init, cypress] + if: always() name: cypress-summary + steps: - name: Summary status - run: if ${{ (needs.cypress-e2e.result != 'success' && needs.cypress-e2e.result != 'skipped') || (needs.cypress-component.result != 'success' && needs.cypress-component.result != 'skipped') }}; then exit 1; fi + run: if ${{ needs.init.result != 'success' || ( needs.cypress.result != 'success' && needs.cypress.result != 'skipped' ) }}; then exit 1; fi diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index a7d9ecdd..3c7cf852 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -23,7 +23,7 @@ jobs: name: Build and deploy steps: - name: Checkout - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false @@ -32,7 +32,7 @@ jobs: id: versions - name: Set up node - uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 + uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 with: node-version: ${{ steps.versions.outputs.node-version }} diff --git a/.github/workflows/node-test.yml b/.github/workflows/node-test.yml index 7e56e131..0c62487c 100644 --- a/.github/workflows/node-test.yml +++ b/.github/workflows/node-test.yml @@ -30,7 +30,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false @@ -39,7 +39,7 @@ jobs: id: versions - name: Set up node - uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 + uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 with: node-version: ${{ steps.versions.outputs.node-version }} diff --git a/.github/workflows/reuse.yml b/.github/workflows/reuse.yml index cd4ee56a..18ba6497 100644 --- a/.github/workflows/reuse.yml +++ b/.github/workflows/reuse.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false