diff --git a/.github/changes-filters.yml b/.github/changes-filters.yml new file mode 100644 index 0000000000..02bbe05a24 --- /dev/null +++ b/.github/changes-filters.yml @@ -0,0 +1,17 @@ +# SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: MIT +backend: + - '.github/workflows/**' + - 'appinfo/**' + - 'lib/**' + - 'templates/**' + - 'tests/php/**' + - 'vendor/**' + - 'vendor-bin/**' + - 'composer/**' + - 'composer.json' + - 'composer.lock' + - 'phpunit.integration.xml' + - 'phpunit.unit' + - '.php-cs-fixer.dist.php' + - 'psalm.xml' \ No newline at end of file diff --git a/.github/workflows/lint-php-cs.yml b/.github/workflows/lint-php-cs.yml index 55014f9881..b399feb7a1 100644 --- a/.github/workflows/lint-php-cs.yml +++ b/.github/workflows/lint-php-cs.yml @@ -18,8 +18,29 @@ concurrency: cancel-in-progress: true jobs: + changes: + runs-on: ubuntu-latest-low + permissions: + contents: read + pull-requests: read + outputs: + backend: ${{ steps.changes.outputs.backend }} + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + fetch-depth: 1 + sparse-checkout: .github/changes-filters.yml + sparse-checkout-cone-mode: false + - uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3 + id: changes + continue-on-error: true + with: + filters: .github/changes-filters.yml + lint: runs-on: ubuntu-latest + needs: changes + if: needs.changes.outputs.backend != 'false' name: php-cs @@ -50,3 +71,17 @@ 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-low + needs: lint + + if: always() + + name: php-cs-lint-summary + + steps: + - name: Summary status + run: if ${{ needs.lint.result != 'success' && needs.lint.result != 'skipped' }}; then exit 1; fi diff --git a/.github/workflows/lint-php.yml b/.github/workflows/lint-php.yml index 833a03e3b3..005f8719dd 100644 --- a/.github/workflows/lint-php.yml +++ b/.github/workflows/lint-php.yml @@ -18,8 +18,29 @@ concurrency: cancel-in-progress: true jobs: + changes: + runs-on: ubuntu-latest-low + permissions: + contents: read + pull-requests: read + outputs: + backend: ${{ steps.changes.outputs.backend }} + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + fetch-depth: 1 + sparse-checkout: .github/changes-filters.yml + sparse-checkout-cone-mode: false + - uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3 + id: changes + continue-on-error: true + with: + filters: .github/changes-filters.yml + matrix: runs-on: ubuntu-latest-low + needs: changes + if: needs.changes.outputs.backend != 'false' outputs: php-min: ${{ steps.versions.outputs.php-min }} php-max: ${{ steps.versions.outputs.php-max }} diff --git a/.github/workflows/php-test.yml b/.github/workflows/php-test.yml index 4f9840add3..a440280bea 100644 --- a/.github/workflows/php-test.yml +++ b/.github/workflows/php-test.yml @@ -4,8 +4,29 @@ name: PHP Tests on: pull_request jobs: + changes: + runs-on: ubuntu-latest-low + permissions: + contents: read + pull-requests: read + outputs: + backend: ${{ steps.changes.outputs.backend }} + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + fetch-depth: 1 + sparse-checkout: .github/changes-filters.yml + sparse-checkout-cone-mode: false + - uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3 + id: changes + continue-on-error: true + with: + filters: .github/changes-filters.yml + unit-tests: runs-on: ubuntu-latest + needs: changes + if: needs.changes.outputs.backend != 'false' strategy: matrix: php-versions: [ '8.3', '8.4', '8.5' ] @@ -55,6 +76,8 @@ jobs: integration-tests: runs-on: ubuntu-latest + needs: changes + if: needs.changes.outputs.backend != 'false' strategy: matrix: php-versions: [ '8.3', '8.4', '8.5' ] @@ -96,7 +119,7 @@ jobs: run: composer run test:integration summary: - runs-on: ubuntu-latest + runs-on: ubuntu-latest-low needs: - unit-tests - integration-tests diff --git a/.github/workflows/psalm-matrix.yml b/.github/workflows/psalm-matrix.yml index 87a7b52be9..76df6af266 100644 --- a/.github/workflows/psalm-matrix.yml +++ b/.github/workflows/psalm-matrix.yml @@ -18,8 +18,29 @@ permissions: contents: read jobs: + changes: + runs-on: ubuntu-latest-low + permissions: + contents: read + pull-requests: read + outputs: + backend: ${{ steps.changes.outputs.backend }} + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + fetch-depth: 1 + sparse-checkout: .github/changes-filters.yml + sparse-checkout-cone-mode: false + - uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3 + id: changes + continue-on-error: true + with: + filters: .github/changes-filters.yml + matrix: runs-on: ubuntu-latest-low + needs: changes + if: needs.changes.outputs.backend != 'false' outputs: ocp-matrix: ${{ steps.versions.outputs.ocp-matrix }} steps: @@ -86,4 +107,4 @@ jobs: steps: - name: Summary status - run: if ${{ needs.static-analysis.result != 'success' }}; then exit 1; fi + run: if ${{ needs.static-analysis.result != 'success' && needs.static-analysis.result != 'skipped' }}; then exit 1; fi