fix(tests): Only run tests on CI that are needed

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
pull/40986/head
Ferdinand Thiessen 1 year ago
parent 5665838ef4
commit cbefae7fd9
No known key found for this signature in database
GPG Key ID: 45FAE7268762B400
  1. 39
      .github/workflows/lint-eslint-when-unrelated.yml
  2. 59
      .github/workflows/lint-eslint.yml
  3. 44
      .github/workflows/lint-php-cs.yml
  4. 37
      .github/workflows/lint-php.yml
  5. 59
      .github/workflows/node-tests.yml
  6. 43
      .github/workflows/node-when-unrelated.yml
  7. 53
      .github/workflows/node.yml
  8. 30
      .github/workflows/phpunit-oci.yml
  9. 10
      .github/workflows/s3-primary-integration.yml
  10. 10
      .github/workflows/s3-primary.yml

@ -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"'

@ -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

@ -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

@ -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

@ -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

@ -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"'

@ -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

@ -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

@ -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

@ -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

Loading…
Cancel
Save