@@ -8,6 +8,29 @@ name: Pull request
88' on ' :
99 pull_request :
1010jobs :
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+
1134 tox :
1235 runs-on : ubuntu-20.04
1336 permissions : {}
@@ -36,38 +59,55 @@ jobs:
3659 - name : Run Tox ${{ matrix.environment }} 🧪
3760 run : tox -e ${{ matrix.environment }}
3861
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+
3970 build-kayobe-image :
4071 name : Build Kayobe Image
72+ needs :
73+ - check-changes
4174 uses : ./.github/workflows/stackhpc-build-kayobe-image.yml
75+ with :
76+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
4277 if : github.repository == 'stackhpc/stackhpc-kayobe-config'
4378
4479 all-in-one-centos-ovs :
4580 name : aio (CentOS OVS)
4681 needs :
82+ - check-changes
4783 - build-kayobe-image
4884 uses : ./.github/workflows/stackhpc-all-in-one.yml
4985 with :
5086 kayobe_image : ${{ needs.build-kayobe-image.outputs.kayobe_image }}
5187 neutron_plugin : ovs
5288 OS_CLOUD : sms-lab-release
89+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
5390 secrets : inherit
54- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
91+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
5592
5693 all-in-one-centos-ovn :
5794 name : aio (CentOS OVN)
5895 needs :
96+ - check-changes
5997 - build-kayobe-image
6098 uses : ./.github/workflows/stackhpc-all-in-one.yml
6199 with :
62100 kayobe_image : ${{ needs.build-kayobe-image.outputs.kayobe_image }}
63101 neutron_plugin : ovn
64102 OS_CLOUD : sms-lab-release
103+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
65104 secrets : inherit
66- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
105+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
67106
68107 all-in-one-rocky-ovs :
69108 name : aio (Rocky OVS)
70109 needs :
110+ - check-changes
71111 - build-kayobe-image
72112 uses : ./.github/workflows/stackhpc-all-in-one.yml
73113 with :
@@ -79,12 +119,14 @@ jobs:
79119 vm_image : Rocky8-2022-11-08
80120 vm_interface : ens3
81121 OS_CLOUD : sms-lab-release
122+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
82123 secrets : inherit
83- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
124+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
84125
85126 all-in-one-rocky-ovn :
86127 name : aio (Rocky OVN)
87128 needs :
129+ - check-changes
88130 - build-kayobe-image
89131 uses : ./.github/workflows/stackhpc-all-in-one.yml
90132 with :
@@ -96,12 +138,14 @@ jobs:
96138 vm_image : Rocky8-2022-11-08
97139 vm_interface : ens3
98140 OS_CLOUD : sms-lab-release
141+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
99142 secrets : inherit
100- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
143+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
101144
102145 all-in-one-ubuntu-ovs :
103146 name : aio (Ubuntu OVS)
104147 needs :
148+ - check-changes
105149 - build-kayobe-image
106150 uses : ./.github/workflows/stackhpc-all-in-one.yml
107151 with :
@@ -110,12 +154,14 @@ jobs:
110154 neutron_plugin : ovs
111155 vm_image : Ubuntu-20.04
112156 OS_CLOUD : sms-lab-release
157+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
113158 secrets : inherit
114- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
159+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
115160
116161 all-in-one-ubuntu-ovn :
117162 name : aio (Ubuntu OVN)
118163 needs :
164+ - check-changes
119165 - build-kayobe-image
120166 uses : ./.github/workflows/stackhpc-all-in-one.yml
121167 with :
@@ -124,5 +170,6 @@ jobs:
124170 neutron_plugin : ovn
125171 vm_image : Ubuntu-20.04
126172 OS_CLOUD : sms-lab-release
173+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
127174 secrets : inherit
128- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
175+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
0 commit comments