@@ -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 : {}
@@ -34,38 +57,55 @@ jobs:
34
57
- name : Run Tox ${{ matrix.environment }} 🧪
35
58
run : tox -e ${{ matrix.environment }}
36
59
60
+ # A skipped job is treated as success when used as a required status check.
61
+ # The registered required status checks refer to the name of the job in the
62
+ # called reusable workflow rather than the jobs in this file. The following
63
+ # jobs need to run unconditionally to allow GitHub required status checks to
64
+ # pass even when there are changed files. The `! failure()` condition runs
65
+ # when the parent jobs completed successfully or were skipped. We pass an
66
+ # 'if' argument to the called workflow to allow running it conditionally.
67
+
37
68
build-kayobe-image :
38
69
name : Build Kayobe Image
70
+ needs :
71
+ - check-changes
39
72
uses : ./.github/workflows/stackhpc-build-kayobe-image.yml
73
+ with :
74
+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
40
75
if : github.repository == 'stackhpc/stackhpc-kayobe-config'
41
76
42
77
all-in-one-centos-ovs :
43
78
name : aio (CentOS OVS)
44
79
needs :
80
+ - check-changes
45
81
- build-kayobe-image
46
82
uses : ./.github/workflows/stackhpc-all-in-one.yml
47
83
with :
48
84
kayobe_image : ${{ needs.build-kayobe-image.outputs.kayobe_image }}
49
85
neutron_plugin : ovs
50
86
OS_CLOUD : sms-lab-release
87
+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
51
88
secrets : inherit
52
- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
89
+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
53
90
54
91
all-in-one-centos-ovn :
55
92
name : aio (CentOS OVN)
56
93
needs :
94
+ - check-changes
57
95
- build-kayobe-image
58
96
uses : ./.github/workflows/stackhpc-all-in-one.yml
59
97
with :
60
98
kayobe_image : ${{ needs.build-kayobe-image.outputs.kayobe_image }}
61
99
neutron_plugin : ovn
62
100
OS_CLOUD : sms-lab-release
101
+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
63
102
secrets : inherit
64
- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
103
+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
65
104
66
105
all-in-one-rocky-ovs :
67
106
name : aio (Rocky OVS)
68
107
needs :
108
+ - check-changes
69
109
- build-kayobe-image
70
110
uses : ./.github/workflows/stackhpc-all-in-one.yml
71
111
with :
@@ -77,12 +117,14 @@ jobs:
77
117
vm_image : Rocky8-2022-11-08
78
118
vm_interface : ens3
79
119
OS_CLOUD : sms-lab-release
120
+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
80
121
secrets : inherit
81
- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
122
+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
82
123
83
124
all-in-one-rocky-ovn :
84
125
name : aio (Rocky OVN)
85
126
needs :
127
+ - check-changes
86
128
- build-kayobe-image
87
129
uses : ./.github/workflows/stackhpc-all-in-one.yml
88
130
with :
@@ -94,12 +136,14 @@ jobs:
94
136
vm_image : Rocky8-2022-11-08
95
137
vm_interface : ens3
96
138
OS_CLOUD : sms-lab-release
139
+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
97
140
secrets : inherit
98
- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
141
+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
99
142
100
143
all-in-one-ubuntu-ovs :
101
144
name : aio (Ubuntu OVS)
102
145
needs :
146
+ - check-changes
103
147
- build-kayobe-image
104
148
uses : ./.github/workflows/stackhpc-all-in-one.yml
105
149
with :
@@ -108,12 +152,13 @@ jobs:
108
152
neutron_plugin : ovs
109
153
vm_image : Ubuntu-20.04
110
154
OS_CLOUD : sms-lab-release
155
+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
111
156
secrets : inherit
112
- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
113
157
114
158
all-in-one-ubuntu-ovn :
115
159
name : aio (Ubuntu OVN)
116
160
needs :
161
+ - check-changes
117
162
- build-kayobe-image
118
163
uses : ./.github/workflows/stackhpc-all-in-one.yml
119
164
with :
@@ -122,5 +167,6 @@ jobs:
122
167
neutron_plugin : ovn
123
168
vm_image : Ubuntu-20.04
124
169
OS_CLOUD : sms-lab-release
170
+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
125
171
secrets : inherit
126
- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
172
+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
0 commit comments