From 4e741a11d0f13a252375e3ed6ae6f2152e9e9ec6 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Sun, 12 Nov 2023 01:39:42 +0100 Subject: [PATCH] chore: Update workflows from organization Signed-off-by: Ferdinand Thiessen --- .github/workflows/command-compile.yml | 23 ++++-- .../workflows/lint-eslint-when-unrelated.yml | 39 ---------- .github/workflows/lint-eslint.yml | 73 +++++++++++++----- .github/workflows/lint-php-cs.yml | 8 +- .github/workflows/lint-php.yml | 14 +--- .github/workflows/lint-stylelint.yml | 12 +-- .github/workflows/node-when-unrelated.yml | 43 ----------- .github/workflows/node.yml | 74 +++++++++++++------ .github/workflows/pr-feedback.yml | 9 ++- 9 files changed, 142 insertions(+), 153 deletions(-) delete mode 100644 .github/workflows/lint-eslint-when-unrelated.yml delete mode 100644 .github/workflows/node-when-unrelated.yml diff --git a/.github/workflows/command-compile.yml b/.github/workflows/command-compile.yml index a1255cff..69c0117b 100644 --- a/.github/workflows/command-compile.yml +++ b/.github/workflows/command-compile.yml @@ -23,7 +23,7 @@ jobs: require: write - name: Add reaction on start - uses: peter-evans/create-or-update-comment@ca08ebd5dc95aa0cd97021e9708fcd6b87138c9b # v3.0.1 + uses: peter-evans/create-or-update-comment@23ff15729ef2fc348714a3bb66d2f655ca9066f2 # v3.1.0 with: token: ${{ secrets.COMMAND_BOT_PAT }} repository: ${{ github.event.repository.full_name }} @@ -53,8 +53,14 @@ jobs: needs: init steps: + - name: Restore cached git repository + uses: buildjet/cache@e376f15c6ec6dc595375c78633174c7e5f92dc0e # v3 + with: + path: .git + key: git-repo + - name: Checkout ${{ needs.init.outputs.head_ref }} - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: token: ${{ secrets.COMMAND_BOT_PAT }} fetch-depth: 0 @@ -66,14 +72,14 @@ jobs: git config --local user.name "nextcloud-command" - 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: package-engines-versions with: - fallbackNode: '^16' - fallbackNpm: '^7' + fallbackNode: '^20' + fallbackNpm: '^9' - name: Set up node ${{ steps.package-engines-versions.outputs.nodeVersion }} - uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3 + uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v3 with: node-version: ${{ steps.package-engines-versions.outputs.nodeVersion }} cache: npm @@ -82,6 +88,9 @@ jobs: run: npm i -g npm@"${{ steps.package-engines-versions.outputs.npmVersion }}" - name: Install dependencies & build + env: + CYPRESS_INSTALL_BINARY: 0 + PUPPETEER_SKIP_DOWNLOAD: true run: | npm ci npm run build --if-present @@ -108,7 +117,7 @@ jobs: git push --force origin ${{ needs.init.outputs.head_ref }} - name: Add reaction on failure - uses: peter-evans/create-or-update-comment@ca08ebd5dc95aa0cd97021e9708fcd6b87138c9b # v3.0.1 + uses: peter-evans/create-or-update-comment@23ff15729ef2fc348714a3bb66d2f655ca9066f2 # v3.1.0 if: failure() with: token: ${{ secrets.COMMAND_BOT_PAT }} diff --git a/.github/workflows/lint-eslint-when-unrelated.yml b/.github/workflows/lint-eslint-when-unrelated.yml deleted file mode 100644 index 7a2e9f05..00000000 --- a/.github/workflows/lint-eslint-when-unrelated.yml +++ /dev/null @@ -1,39 +0,0 @@ -# This workflow is provided via the organization template repository -# -# https://github.com/nextcloud/.github -# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization -# -# Use lint-eslint together with lint-eslint-when-unrelated to make eslint a required check for GitHub actions -# https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks - -name: Lint eslint - -on: - pull_request: - paths-ignore: - - '.github/workflows/**' - - 'src/**' - - 'appinfo/info.xml' - - 'package.json' - - 'package-lock.json' - - 'tsconfig.json' - - '.eslintrc.*' - - '.eslintignore' - - '**.js' - - '**.ts' - - '**.vue' - -permissions: - contents: read - -jobs: - lint: - permissions: - contents: none - - runs-on: ubuntu-latest - - name: eslint - - steps: - - run: 'echo "No eslint required"' diff --git a/.github/workflows/lint-eslint.yml b/.github/workflows/lint-eslint.yml index 508d7139..99b624d1 100644 --- a/.github/workflows/lint-eslint.yml +++ b/.github/workflows/lint-eslint.yml @@ -8,20 +8,7 @@ name: Lint eslint -on: - pull_request: - paths: - - '.github/workflows/**' - - 'src/**' - - 'appinfo/info.xml' - - 'package.json' - - 'package-lock.json' - - 'tsconfig.json' - - '.eslintrc.*' - - '.eslintignore' - - '**.js' - - '**.ts' - - '**.vue' +on: pull_request permissions: contents: read @@ -31,24 +18,52 @@ concurrency: cancel-in-progress: true jobs: + changes: + runs-on: ubuntu-latest + + outputs: + src: ${{ steps.changes.outputs.src}} + + steps: + - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1 + id: changes + continue-on-error: true + with: + filters: | + src: + - '.github/workflows/**' + - 'src/**' + - 'appinfo/info.xml' + - 'package.json' + - 'package-lock.json' + - 'tsconfig.json' + - '.eslintrc.*' + - '.eslintignore' + - '**.js' + - '**.ts' + - '**.vue' + lint: runs-on: ubuntu-latest - name: eslint + needs: changes + if: needs.changes.outputs.src != 'false' + + name: NPM lint steps: - name: Checkout - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - 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: '^16' - fallbackNpm: '^7' + fallbackNode: '^20' + fallbackNpm: '^9' - name: Set up node ${{ steps.versions.outputs.nodeVersion }} - uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3 + uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v3 with: node-version: ${{ steps.versions.outputs.nodeVersion }} @@ -56,7 +71,25 @@ jobs: run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}" - name: Install dependencies + env: + CYPRESS_INSTALL_BINARY: 0 + PUPPETEER_SKIP_DOWNLOAD: true run: npm ci - name: Lint run: npm run lint + + summary: + permissions: + contents: none + runs-on: ubuntu-latest + needs: [changes, lint] + + if: always() + + # This is the summary, we just avoid to rename it so that branch protection rules still match + name: eslint + + steps: + - name: Summary status + run: if ${{ needs.changes.outputs.src != 'false' && needs.lint.result != 'success' }}; then exit 1; fi diff --git a/.github/workflows/lint-php-cs.yml b/.github/workflows/lint-php-cs.yml index f8d33751..c23fc7c4 100644 --- a/.github/workflows/lint-php-cs.yml +++ b/.github/workflows/lint-php-cs.yml @@ -22,12 +22,12 @@ jobs: steps: - name: Checkout - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - name: Set up php - uses: shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d # v2 + - name: Set up php8.2 + uses: shivammathur/setup-php@81cd5ae0920b34eef300e1775313071038a53429 # v2 with: - php-version: 8.1 + php-version: 8.2 coverage: none ini-file: development env: diff --git a/.github/workflows/lint-php.yml b/.github/workflows/lint-php.yml index 8d7f63f8..92769c49 100644 --- a/.github/workflows/lint-php.yml +++ b/.github/workflows/lint-php.yml @@ -5,13 +5,7 @@ name: Lint php -on: - pull_request: - push: - branches: - - main - - master - - stable* +on: pull_request permissions: contents: read @@ -25,16 +19,16 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: [ "8.0", "8.1", "8.2" ] + php-versions: [ '8.0', '8.1', '8.2', '8.3' ] name: php-lint steps: - name: Checkout - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Set up php ${{ matrix.php-versions }} - uses: shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d # v2 + uses: shivammathur/setup-php@81cd5ae0920b34eef300e1775313071038a53429 # v2 with: php-version: ${{ matrix.php-versions }} coverage: none diff --git a/.github/workflows/lint-stylelint.yml b/.github/workflows/lint-stylelint.yml index 60cb63a5..684bb619 100644 --- a/.github/workflows/lint-stylelint.yml +++ b/.github/workflows/lint-stylelint.yml @@ -22,17 +22,17 @@ jobs: steps: - name: Checkout - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - 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: '^16' - fallbackNpm: '^7' + fallbackNode: '^20' + fallbackNpm: '^9' - name: Set up node ${{ steps.versions.outputs.nodeVersion }} - uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3 + uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v3 with: node-version: ${{ steps.versions.outputs.nodeVersion }} @@ -40,6 +40,8 @@ jobs: run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}" - name: Install dependencies + env: + CYPRESS_INSTALL_BINARY: 0 run: npm ci - name: Lint diff --git a/.github/workflows/node-when-unrelated.yml b/.github/workflows/node-when-unrelated.yml deleted file mode 100644 index db32b0db..00000000 --- a/.github/workflows/node-when-unrelated.yml +++ /dev/null @@ -1,43 +0,0 @@ -# This workflow is provided via the organization template repository -# -# https://github.com/nextcloud/.github -# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization -# -# Use node together with node-when-unrelated to make eslint a required check for GitHub actions -# https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks - -name: Node - -on: - pull_request: - paths-ignore: - - '.github/workflows/**' - - 'src/**' - - 'appinfo/info.xml' - - 'package.json' - - 'package-lock.json' - - 'tsconfig.json' - - '**.js' - - '**.ts' - - '**.vue' - push: - branches: - - main - - master - - stable* - -concurrency: - group: node-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - build: - permissions: - contents: none - - runs-on: ubuntu-latest - - name: node - steps: - - name: Skip - run: 'echo "No JS/TS files changed, skipped Node"' diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml index 1774e0b2..75c32b44 100644 --- a/.github/workflows/node.yml +++ b/.github/workflows/node.yml @@ -5,23 +5,7 @@ name: Node -on: - pull_request: - paths: - - '.github/workflows/**' - - 'src/**' - - 'appinfo/info.xml' - - 'package.json' - - 'package-lock.json' - - 'tsconfig.json' - - '**.js' - - '**.ts' - - '**.vue' - push: - branches: - - main - - master - - stable* +on: pull_request permissions: contents: read @@ -31,23 +15,49 @@ concurrency: cancel-in-progress: true jobs: + changes: + runs-on: ubuntu-latest + + outputs: + src: ${{ steps.changes.outputs.src}} + + steps: + - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1 + id: changes + continue-on-error: true + with: + filters: | + src: + - '.github/workflows/**' + - 'src/**' + - 'appinfo/info.xml' + - 'package.json' + - 'package-lock.json' + - 'tsconfig.json' + - '**.js' + - '**.ts' + - '**.vue' + build: runs-on: ubuntu-latest - name: node + needs: changes + if: needs.changes.outputs.src != 'false' + + name: NPM build steps: - name: Checkout - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - 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: '^16' - fallbackNpm: '^7' + fallbackNode: '^20' + fallbackNpm: '^9' - name: Set up node ${{ steps.versions.outputs.nodeVersion }} - uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3 + uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v3 with: node-version: ${{ steps.versions.outputs.nodeVersion }} @@ -55,6 +65,9 @@ jobs: run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}" - name: Install dependencies & build + env: + CYPRESS_INSTALL_BINARY: 0 + PUPPETEER_SKIP_DOWNLOAD: true run: | npm ci npm run build --if-present @@ -69,3 +82,18 @@ jobs: git status git --no-pager diff exit 1 # make it red to grab attention + + summary: + permissions: + contents: none + runs-on: ubuntu-latest + needs: [changes, build] + + if: always() + + # This is the summary, we just avoid to rename it so that branch protection rules still match + name: node + + steps: + - name: Summary status + run: if ${{ needs.changes.outputs.src != 'false' && needs.build.result != 'success' }}; then exit 1; fi diff --git a/.github/workflows/pr-feedback.yml b/.github/workflows/pr-feedback.yml index 5976f560..0e7359de 100644 --- a/.github/workflows/pr-feedback.yml +++ b/.github/workflows/pr-feedback.yml @@ -1,3 +1,8 @@ +# This workflow is provided via the organization template repository +# +# https://github.com/nextcloud/.github +# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization + name: 'Ask for feedback on PRs' on: schedule: @@ -5,7 +10,7 @@ on: jobs: pr-feedback: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: The get-github-handles-from-website action uses: marcelklehr/get-github-handles-from-website-action@a739600f6b91da4957f51db0792697afbb2f143c # v1.0.0 @@ -25,5 +30,5 @@ jobs: Thank you for contributing to Nextcloud and we hope to hear from you soon! days-before-feedback: 14 start-date: "2023-07-10" - exempt-authors: "${{ steps.scrape.outputs.users }},nextcloud-command" + exempt-authors: "${{ steps.scrape.outputs.users }},nextcloud-command,nextcloud-android-bot,skjnldsv,datenangebot" exempt-bots: true