Skip to content

Commit 810d8b4

Browse files
Merge pull request #59319 from nextcloud/jtr/ci-perf-static-code-analysis-changes-check
ci: add path filtering to static-code-analysis workflow
2 parents 32a2648 + 330ae40 commit 810d8b4

1 file changed

Lines changed: 59 additions & 5 deletions

File tree

.github/workflows/static-code-analysis.yml

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,35 @@ concurrency:
2121
cancel-in-progress: true
2222

2323
jobs:
24+
changes:
25+
runs-on: ubuntu-latest-low
26+
27+
outputs:
28+
src: ${{ steps.changes.outputs.src }}
29+
30+
steps:
31+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
32+
id: changes
33+
continue-on-error: true
34+
with:
35+
filters: |
36+
src:
37+
- '.github/workflows/**'
38+
- '3rdparty/**'
39+
- '**/appinfo/**'
40+
- '**/lib/**'
41+
- '**/templates/**'
42+
- 'vendor/**'
43+
- 'vendor-bin/**'
44+
- 'composer.json'
45+
- 'composer.lock'
46+
- '**.php'
47+
2448
static-code-analysis:
2549
runs-on: ubuntu-latest
2650

27-
if: ${{ github.event_name != 'push' && github.repository_owner != 'nextcloud-gmbh' }}
51+
needs: changes
52+
if: ${{ needs.changes.outputs.src != 'false' && github.event_name != 'push' && github.repository_owner != 'nextcloud-gmbh' }}
2853

2954
steps:
3055
- name: Checkout
@@ -56,7 +81,8 @@ jobs:
5681
static-code-analysis-security:
5782
runs-on: ubuntu-latest
5883

59-
if: ${{ github.repository_owner != 'nextcloud-gmbh' }}
84+
needs: changes
85+
if: ${{ needs.changes.outputs.src != 'false' && github.repository_owner != 'nextcloud-gmbh' }}
6086

6187
permissions:
6288
security-events: write
@@ -95,7 +121,8 @@ jobs:
95121
static-code-analysis-ocp:
96122
runs-on: ubuntu-latest
97123

98-
if: ${{ github.event_name != 'push' && github.repository_owner != 'nextcloud-gmbh' }}
124+
needs: changes
125+
if: ${{ needs.changes.outputs.src != 'false' && github.event_name != 'push' && github.repository_owner != 'nextcloud-gmbh' }}
99126

100127
steps:
101128
- name: Checkout
@@ -127,7 +154,8 @@ jobs:
127154
static-code-analysis-ncu:
128155
runs-on: ubuntu-latest
129156

130-
if: ${{ github.event_name != 'push' && github.repository_owner != 'nextcloud-gmbh' }}
157+
needs: changes
158+
if: ${{ needs.changes.outputs.src != 'false' && github.event_name != 'push' && github.repository_owner != 'nextcloud-gmbh' }}
131159

132160
steps:
133161
- name: Checkout
@@ -155,7 +183,8 @@ jobs:
155183
static-code-analysis-strict:
156184
runs-on: ubuntu-latest
157185

158-
if: ${{ github.event_name != 'push' && github.repository_owner != 'nextcloud-gmbh' }}
186+
needs: changes
187+
if: ${{ needs.changes.outputs.src != 'false' && github.event_name != 'push' && github.repository_owner != 'nextcloud-gmbh' }}
159188

160189
steps:
161190
- name: Checkout
@@ -178,3 +207,28 @@ jobs:
178207

179208
- name: Psalm
180209
run: composer run psalm:strict -- --threads=1 --monochrome --no-progress --output-format=github
210+
211+
summary:
212+
permissions:
213+
contents: none
214+
runs-on: ubuntu-latest-low
215+
needs: [changes, static-code-analysis, static-code-analysis-security, static-code-analysis-ocp, static-code-analysis-ncu, static-code-analysis-strict]
216+
217+
if: always()
218+
219+
name: static-code-analysis-summary
220+
221+
steps:
222+
- name: Summary status
223+
run: |
224+
if ${{ needs.changes.outputs.src != 'false' && (
225+
needs.static-code-analysis-security.result != 'success' ||
226+
(github.event_name != 'push' && (
227+
needs.static-code-analysis.result != 'success' ||
228+
needs.static-code-analysis-ocp.result != 'success' ||
229+
needs.static-code-analysis-ncu.result != 'success' ||
230+
needs.static-code-analysis-strict.result != 'success'
231+
))
232+
) }}; then
233+
exit 1
234+
fi

0 commit comments

Comments
 (0)