Skip to content
Merged
17 changes: 17 additions & 0 deletions .github/filters.yml
Original file line number Diff line number Diff line change
@@ -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'
35 changes: 35 additions & 0 deletions .github/workflows/lint-php-cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/filters.yml
sparse-checkout-cone-mode: false
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
id: changes
continue-on-error: true
with:
filters: .github/filters.yml

lint:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.backend != 'false'

name: php-cs

Expand Down Expand Up @@ -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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding this job, we will need to change the required jobs that gate merges.

From lint-php-cs/lint to lint-php-cs/summary

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need a different job gate? Your test Ci ran correctly

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#8823 did not open a PR to main so. I think we have the gates only for PRs to main (and maybe the stable branches?)


steps:
- name: Summary status
run: if ${{ needs.lint.result != 'success' && needs.lint.result != 'skipped' }}; then exit 1; fi
21 changes: 21 additions & 0 deletions .github/workflows/lint-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/filters.yml
sparse-checkout-cone-mode: false
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
id: changes
continue-on-error: true
with:
filters: .github/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 }}
Expand Down
25 changes: 24 additions & 1 deletion .github/workflows/php-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/filters.yml
sparse-checkout-cone-mode: false
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
id: changes
continue-on-error: true
with:
filters: .github/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' ]
Expand Down Expand Up @@ -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' ]
Expand Down Expand Up @@ -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
Expand Down
23 changes: 22 additions & 1 deletion .github/workflows/psalm-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/filters.yml
sparse-checkout-cone-mode: false
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
id: changes
continue-on-error: true
with:
filters: .github/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:
Expand Down Expand Up @@ -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
Loading