diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2023-10-19 16:32:48 +0200 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2023-10-27 13:50:04 +0200 |
commit | cbefae7fd9bf1076a8e882826f3887ab527337c8 (patch) | |
tree | 2dfc7fcad91b59f43e2043e082a603cc5f5cd710 /.github | |
parent | 5665838ef4e042ddceb32a762cf225889a4c08a6 (diff) | |
download | nextcloud-server-cbefae7fd9bf1076a8e882826f3887ab527337c8.tar.gz nextcloud-server-cbefae7fd9bf1076a8e882826f3887ab527337c8.zip |
fix(tests): Only run tests on CI that are needed
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/lint-eslint-when-unrelated.yml | 39 | ||||
-rw-r--r-- | .github/workflows/lint-eslint.yml | 59 | ||||
-rw-r--r-- | .github/workflows/lint-php-cs.yml | 44 | ||||
-rw-r--r-- | .github/workflows/lint-php.yml | 37 | ||||
-rw-r--r-- | .github/workflows/node-tests.yml | 59 | ||||
-rw-r--r-- | .github/workflows/node-when-unrelated.yml | 43 | ||||
-rw-r--r-- | .github/workflows/node.yml | 53 | ||||
-rw-r--r-- | .github/workflows/phpunit-oci.yml (renamed from .github/workflows/oci.yml) | 30 | ||||
-rw-r--r-- | .github/workflows/s3-primary-integration.yml | 10 | ||||
-rw-r--r-- | .github/workflows/s3-primary.yml | 10 |
10 files changed, 260 insertions, 124 deletions
diff --git a/.github/workflows/lint-eslint-when-unrelated.yml b/.github/workflows/lint-eslint-when-unrelated.yml deleted file mode 100644 index c8e3f0605f9..00000000000 --- 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/**' - - 'apps/**/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 b9437f7b914..274a7cdb4a6 100644 --- a/.github/workflows/lint-eslint.yml +++ b/.github/workflows/lint-eslint.yml @@ -10,18 +10,6 @@ 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' permissions: contents: read @@ -31,14 +19,42 @@ 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@b4ffde65f46336ab88eb53be808477a3936bae11 # v3.6.0 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Read package.json node and npm engines version uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2 @@ -62,3 +78,18 @@ jobs: - 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 f140d79f0a8..ea04076e25b 100644 --- a/.github/workflows/lint-php-cs.yml +++ b/.github/workflows/lint-php-cs.yml @@ -15,17 +15,40 @@ 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/**' + - '3rdparty/**' + - '**/lib/**' + - '**/tests/**' + - '**/vendor-bin/**' + - '.php-cs-fixer.dist.php' + - 'composer.json' + - 'composer.lock' + - '**.php' + lint: runs-on: ubuntu-latest - name: php-cs + name: PHP CS fixer lint steps: - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v3.5.2 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Set up php - uses: shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d # v2 + uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2 with: php-version: 8.1 coverage: none @@ -38,3 +61,18 @@ jobs: - name: Lint run: composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 ) + + 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: php-cs + + 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.yml b/.github/workflows/lint-php.yml index da752f5a069..6254e034061 100644 --- a/.github/workflows/lint-php.yml +++ b/.github/workflows/lint-php.yml @@ -21,8 +21,35 @@ concurrency: cancel-in-progress: true jobs: - php-lint: + 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/**' + - '3rdparty/**' + - '**/lib/**' + - '**/tests/**' + - '**/vendor-bin/**' + - '.php-cs-fixer.dist.php' + - 'composer.json' + - 'composer.lock' + - '**.php' + + lint: + runs-on: ubuntu-latest + + needs: changes + if: needs.changes.outputs.src != 'false' + strategy: matrix: php-versions: [ "8.0", "8.1", "8.2", "8.3" ] @@ -31,10 +58,10 @@ jobs: steps: - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 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@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2 with: php-version: ${{ matrix.php-versions }} coverage: none @@ -49,7 +76,7 @@ jobs: permissions: contents: none runs-on: ubuntu-latest - needs: php-lint + needs: [changes, lint] if: always() @@ -57,4 +84,4 @@ jobs: steps: - name: Summary status - run: if ${{ needs.php-lint.result != 'success' && needs.php-lint.result != 'skipped' }}; then exit 1; fi + run: if ${{ needs.changes.outputs.src != 'false' && needs.lint.result != 'success' }}; then exit 1; fi diff --git a/.github/workflows/node-tests.yml b/.github/workflows/node-tests.yml index c351654f032..51bd2723060 100644 --- a/.github/workflows/node-tests.yml +++ b/.github/workflows/node-tests.yml @@ -8,10 +8,37 @@ on: - stable* 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/**' + - '**/__tests__/**' + - '**/__mocks__/**' + - '**/src/**' + - '**/appinfo/info.xml' + - 'package.json' + - 'package-lock.json' + - 'tsconfig.json' + - '**.js' + - '**.ts' + - '**.vue' + - '**.handlebars' + versions: runs-on: ubuntu-latest + needs: changes - if: ${{ github.repository_owner != 'nextcloud-gmbh' }} + if: ${{ github.repository_owner != 'nextcloud-gmbh' && needs.changes.outputs.src != 'false' }} outputs: nodeVersion: ${{ steps.versions.outputs.nodeVersion }} @@ -25,12 +52,14 @@ jobs: uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 id: versions with: - fallbackNode: '^16' - fallbackNpm: '^7' + fallbackNode: '^20' + fallbackNpm: '^9' test: runs-on: ubuntu-latest - needs: versions + needs: [versions, changes] + + if: ${{ needs.versions.result != 'failure' && needs.changes.outputs.src != 'false' }} env: CYPRESS_INSTALL_BINARY: 0 @@ -63,7 +92,9 @@ jobs: jsunit: runs-on: ubuntu-latest - needs: versions + needs: [versions, changes] + + if: ${{ needs.versions.result != 'failure' && needs.changes.outputs.src != 'false' }} env: CYPRESS_INSTALL_BINARY: 0 @@ -91,7 +122,9 @@ jobs: handlebars: runs-on: ubuntu-latest - needs: versions + needs: [versions, changes] + + if: ${{ needs.versions.result != 'failure' && needs.changes.outputs.src != 'false' }} env: CYPRESS_INSTALL_BINARY: 0 @@ -116,3 +149,17 @@ jobs: - name: Run compile run: ./build/compile-handlebars-templates.sh + + summary: + permissions: + contents: none + runs-on: ubuntu-latest + needs: [changes, test, jsunit, handlebars] + + if: always() + + name: node-test-summary + + steps: + - name: Summary status + run: if ${{ needs.changes.outputs.src != 'false' && needs.test.result != 'success' && needs.jsunit.result != 'success' && needs.handlebars.result != 'success' }}; then exit 1; fi diff --git a/.github/workflows/node-when-unrelated.yml b/.github/workflows/node-when-unrelated.yml deleted file mode 100644 index 5957422d222..00000000000 --- 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/**' - - 'apps/**/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 6de29586fd8..610602162c5 100644 --- a/.github/workflows/node.yml +++ b/.github/workflows/node.yml @@ -7,16 +7,6 @@ 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 @@ -31,10 +21,36 @@ 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@b4ffde65f46336ab88eb53be808477a3936bae11 # v3.6.0 @@ -71,3 +87,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/oci.yml b/.github/workflows/phpunit-oci.yml index a0d9067984b..2c90b992cd0 100644 --- a/.github/workflows/oci.yml +++ b/.github/workflows/phpunit-oci.yml @@ -1,6 +1,7 @@ name: PHPUnit oci -on: pull_request +on: + pull_request: permissions: contents: read @@ -10,6 +11,29 @@ 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/**' + - '3rdparty/**' + - '**/lib/**' + - '**/tests/**' + - '**/vendor-bin/**' + - '.php-cs-fixer.dist.php' + - 'composer.json' + - 'composer.lock' + - '**.php' + phpunit-oci: runs-on: ubuntu-20.04 @@ -74,7 +98,7 @@ jobs: permissions: contents: none runs-on: ubuntu-latest - needs: phpunit-oci + needs: [changes, phpunit-oci] if: always() @@ -82,4 +106,4 @@ jobs: steps: - name: Summary status - run: if ${{ needs.phpunit-oci.result != 'success' }}; then exit 1; fi + run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-oci.result != 'success' }}; then exit 1; fi diff --git a/.github/workflows/s3-primary-integration.yml b/.github/workflows/s3-primary-integration.yml index 6202c2979e2..09823e71523 100644 --- a/.github/workflows/s3-primary-integration.yml +++ b/.github/workflows/s3-primary-integration.yml @@ -1,6 +1,16 @@ name: S3 primary storage integration tests on: pull_request: + paths: + - '.github/workflows/**' + - '3rdparty/**' + - '**/*.php' + - '**/lib/**' + - '**/tests/**' + - '**/vendor-bin/**' + - '.php-cs-fixer.dist.php' + - 'composer.json' + - 'composer.lock' push: branches: - master diff --git a/.github/workflows/s3-primary.yml b/.github/workflows/s3-primary.yml index ffdf26aa731..4e637f1b7d4 100644 --- a/.github/workflows/s3-primary.yml +++ b/.github/workflows/s3-primary.yml @@ -1,6 +1,16 @@ name: S3 primary storage on: pull_request: + paths: + - '.github/workflows/**' + - '3rdparty/**' + - '**/*.php' + - '**/lib/**' + - '**/tests/**' + - '**/vendor-bin/**' + - '.php-cs-fixer.dist.php' + - 'composer.json' + - 'composer.lock' push: branches: - master |