@@ -8,6 +8,29 @@ name: Pull request
8
8
' on ' :
9
9
pull_request :
10
10
jobs :
11
+ # Detect which files have changed and use this to run jobs conditionally.
12
+ # Note that we can't use the workflow-level paths attribute since this
13
+ # would skip the workflow entirely, and would prevent us from making the
14
+ # aio jobs required to pass (a skip counts as a pass).
15
+ check-changes :
16
+ runs-on : ubuntu-20.04
17
+ permissions :
18
+ pull-requests : read
19
+ name : Check changed files
20
+ if : github.repository == 'stackhpc/stackhpc-kayobe-config'
21
+ outputs :
22
+ aio : ${{ steps.changes.outputs.aio }}
23
+ steps :
24
+ - name : GitHub Checkout
25
+ uses : actions/checkout@v3
26
+
27
+ - name : Check changed files
28
+ uses : dorny/paths-filter@v2
29
+ id : changes
30
+ with :
31
+ # Filters are defined in this file.
32
+ filters : .github/path-filters.yml
33
+
11
34
tox :
12
35
runs-on : ubuntu-22.04
13
36
permissions : {}
@@ -36,14 +59,27 @@ jobs:
36
59
- name : Run Tox ${{ matrix.environment }} 🧪
37
60
run : tox -e ${{ matrix.environment }}
38
61
62
+ # A skipped job is treated as success when used as a required status check.
63
+ # The registered required status checks refer to the name of the job in the
64
+ # called reusable workflow rather than the jobs in this file. The following
65
+ # jobs need to run unconditionally to allow GitHub required status checks to
66
+ # pass even when there are changed files. The `! failure()` condition runs
67
+ # when the parent jobs completed successfully or were skipped. We pass an
68
+ # 'if' argument to the called workflow to allow running it conditionally.
69
+
39
70
build-kayobe-image :
40
71
name : Build Kayobe Image
72
+ needs :
73
+ - check-changes
41
74
uses : ./.github/workflows/stackhpc-build-kayobe-image.yml
75
+ with :
76
+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
42
77
if : github.repository == 'stackhpc/stackhpc-kayobe-config'
43
78
44
79
all-in-one-ubuntu-jammy-ovs :
45
80
name : aio (Ubuntu Jammy OVS)
46
81
needs :
82
+ - check-changes
47
83
- build-kayobe-image
48
84
uses : ./.github/workflows/stackhpc-all-in-one.yml
49
85
with :
@@ -53,12 +89,14 @@ jobs:
53
89
ssh_username : ubuntu
54
90
neutron_plugin : ovs
55
91
OS_CLOUD : sms-lab-release
92
+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
56
93
secrets : inherit
57
- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
94
+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
58
95
59
96
all-in-one-ubuntu-jammy-ovn :
60
97
name : aio (Ubuntu Jammy OVN)
61
98
needs :
99
+ - check-changes
62
100
- build-kayobe-image
63
101
uses : ./.github/workflows/stackhpc-all-in-one.yml
64
102
with :
@@ -68,12 +106,14 @@ jobs:
68
106
ssh_username : ubuntu
69
107
neutron_plugin : ovn
70
108
OS_CLOUD : sms-lab-release
109
+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
71
110
secrets : inherit
72
- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
111
+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
73
112
74
113
all-in-one-rocky-9-ovs :
75
114
name : aio (Rocky 9 OVS)
76
115
needs :
116
+ - check-changes
77
117
- build-kayobe-image
78
118
uses : ./.github/workflows/stackhpc-all-in-one.yml
79
119
with :
@@ -83,12 +123,14 @@ jobs:
83
123
ssh_username : cloud-user
84
124
neutron_plugin : ovs
85
125
OS_CLOUD : sms-lab-release
126
+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
86
127
secrets : inherit
87
- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
128
+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
88
129
89
130
all-in-one-rocky-9-ovn :
90
131
name : aio (Rocky 9 OVN)
91
132
needs :
133
+ - check-changes
92
134
- build-kayobe-image
93
135
uses : ./.github/workflows/stackhpc-all-in-one.yml
94
136
with :
98
140
ssh_username : cloud-user
99
141
neutron_plugin : ovn
100
142
OS_CLOUD : sms-lab-release
143
+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
101
144
secrets : inherit
102
- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
145
+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
0 commit comments