From b464aee4774c1ffe32ed79c4302bcc2a01346679 Mon Sep 17 00:00:00 2001 From: Nextcloud bot Date: Tue, 2 Jun 2026 21:48:15 +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 ++++++++++-------- .../workflows/dependabot-approve-merge.yml | 4 +- .github/workflows/documentation.yml | 6 +- .github/workflows/node-test.yml | 6 +- .github/workflows/npm-publish.yml | 4 +- .github/workflows/reuse.yml | 2 +- 7 files changed, 106 insertions(+), 89 deletions(-) diff --git a/.github/workflows/block-unconventional-commits.yml b/.github/workflows/block-unconventional-commits.yml index decb6301..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@7f91b1595ca1951cdb671ddc9f07a49081ec5b69 # v1.4.2 + - 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 79ff1cb5..dc1993c4 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@558493d6c74bf472d87c84eab196434afc2fa029 # v3.1.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@dace029018fcdf86e0df89a31bc3cfa5b32570d8 # v7.3.0 + - name: Set up node + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.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@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1 + - name: Install node dependencies & build app + run: | + npm ci + TESTING=true npm run build --if-present + + - name: Save context + uses: actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 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: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 + 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@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.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@dace029018fcdf86e0df89a31bc3cfa5b32570d8 # v7.3.0 + - name: Run ${{ startsWith(matrix.containers, 'component') && 'component' || 'E2E' }} cypress tests + uses: cypress-io/github-action@783cb3f07983868532cabaedaa1e6c00ff4786a8 # v7.1.9 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@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1 + - name: Upload snapshots + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + 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/dependabot-approve-merge.yml b/.github/workflows/dependabot-approve-merge.yml index 2ce753bd..23715867 100644 --- a/.github/workflows/dependabot-approve-merge.yml +++ b/.github/workflows/dependabot-approve-merge.yml @@ -52,7 +52,7 @@ jobs: # Enable GitHub auto merge - name: Auto merge - uses: alexwilson/enable-github-automerge-action@2c32e18a76e0726ffe7a573bfff2d42a20885126 # v3.0.0 - if: startsWith(steps.branchname.outputs.branch, 'dependabot/') + uses: alexwilson/enable-github-automerge-action@56e3117d1ae1540309dc8f7a9f2825bc3c5f06ff # v2.0.0 + if: startsWith(steps.branchname.outputs.branch, 'dependabot/') && (github.event.pull_request.action == 'opened' || github.event.pull_request.action == 'reopened') with: github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 33ca1c48..f52af4c9 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@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: node-version: ${{ steps.versions.outputs.node-version }} @@ -50,7 +50,7 @@ jobs: - name: Deploy # Only deploy on release if: github.event.release - uses: peaceiris/actions-gh-pages@84c30a85c19949d7eee79c4ff27748b70285e453 # v4.1.0 + uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./dist/doc diff --git a/.github/workflows/node-test.yml b/.github/workflows/node-test.yml index 49716513..8b5c42dc 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@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: node-version: ${{ steps.versions.outputs.node-version }} @@ -60,7 +60,7 @@ jobs: run: npm run test:coverage --if-present - name: Collect coverage - uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1 + uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0 with: files: ./coverage/lcov.info env: diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 0d6677c5..5b9892b6 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -24,7 +24,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false @@ -33,7 +33,7 @@ jobs: id: versions - name: Set up node - uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: node-version: ${{ steps.versions.outputs.node-version }} registry-url: https://registry.npmjs.org 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