@@ -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-20.04
13
36
permissions : {}
@@ -36,38 +59,55 @@ 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-centos-ovs :
45
80
name : aio (CentOS 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 :
50
86
kayobe_image : ${{ needs.build-kayobe-image.outputs.kayobe_image }}
51
87
neutron_plugin : ovs
52
88
OS_CLOUD : sms-lab-release
89
+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
53
90
secrets : inherit
54
- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
91
+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
55
92
56
93
all-in-one-centos-ovn :
57
94
name : aio (CentOS OVN)
58
95
needs :
96
+ - check-changes
59
97
- build-kayobe-image
60
98
uses : ./.github/workflows/stackhpc-all-in-one.yml
61
99
with :
62
100
kayobe_image : ${{ needs.build-kayobe-image.outputs.kayobe_image }}
63
101
neutron_plugin : ovn
64
102
OS_CLOUD : sms-lab-release
103
+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
65
104
secrets : inherit
66
- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
105
+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
67
106
68
107
all-in-one-rocky-ovs :
69
108
name : aio (Rocky OVS)
70
109
needs :
110
+ - check-changes
71
111
- build-kayobe-image
72
112
uses : ./.github/workflows/stackhpc-all-in-one.yml
73
113
with :
@@ -79,12 +119,14 @@ jobs:
79
119
vm_image : Rocky8-2022-11-08
80
120
vm_interface : ens3
81
121
OS_CLOUD : sms-lab-release
122
+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
82
123
secrets : inherit
83
- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
124
+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
84
125
85
126
all-in-one-rocky-ovn :
86
127
name : aio (Rocky OVN)
87
128
needs :
129
+ - check-changes
88
130
- build-kayobe-image
89
131
uses : ./.github/workflows/stackhpc-all-in-one.yml
90
132
with :
@@ -96,12 +138,14 @@ jobs:
96
138
vm_image : Rocky8-2022-11-08
97
139
vm_interface : ens3
98
140
OS_CLOUD : sms-lab-release
141
+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
99
142
secrets : inherit
100
- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
143
+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
101
144
102
145
all-in-one-ubuntu-ovs :
103
146
name : aio (Ubuntu OVS)
104
147
needs :
148
+ - check-changes
105
149
- build-kayobe-image
106
150
uses : ./.github/workflows/stackhpc-all-in-one.yml
107
151
with :
@@ -110,12 +154,14 @@ jobs:
110
154
neutron_plugin : ovs
111
155
vm_image : Ubuntu-20.04
112
156
OS_CLOUD : sms-lab-release
157
+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
113
158
secrets : inherit
114
- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
159
+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
115
160
116
161
all-in-one-ubuntu-ovn :
117
162
name : aio (Ubuntu OVN)
118
163
needs :
164
+ - check-changes
119
165
- build-kayobe-image
120
166
uses : ./.github/workflows/stackhpc-all-in-one.yml
121
167
with :
@@ -124,5 +170,6 @@ jobs:
124
170
neutron_plugin : ovn
125
171
vm_image : Ubuntu-20.04
126
172
OS_CLOUD : sms-lab-release
173
+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
127
174
secrets : inherit
128
- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
175
+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
0 commit comments