@@ -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 : {}
@@ -34,38 +57,55 @@ jobs:
3457 - name : Run Tox ${{ matrix.environment }} 🧪
3558 run : tox -e ${{ matrix.environment }}
3659
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+
3768 build-kayobe-image :
3869 name : Build Kayobe Image
70+ needs :
71+ - check-changes
3972 uses : ./.github/workflows/stackhpc-build-kayobe-image.yml
73+ with :
74+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
4075 if : github.repository == 'stackhpc/stackhpc-kayobe-config'
4176
4277 all-in-one-centos-ovs :
4378 name : aio (CentOS OVS)
4479 needs :
80+ - check-changes
4581 - build-kayobe-image
4682 uses : ./.github/workflows/stackhpc-all-in-one.yml
4783 with :
4884 kayobe_image : ${{ needs.build-kayobe-image.outputs.kayobe_image }}
4985 neutron_plugin : ovs
5086 OS_CLOUD : sms-lab-release
87+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
5188 secrets : inherit
52- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
89+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
5390
5491 all-in-one-centos-ovn :
5592 name : aio (CentOS OVN)
5693 needs :
94+ - check-changes
5795 - build-kayobe-image
5896 uses : ./.github/workflows/stackhpc-all-in-one.yml
5997 with :
6098 kayobe_image : ${{ needs.build-kayobe-image.outputs.kayobe_image }}
6199 neutron_plugin : ovn
62100 OS_CLOUD : sms-lab-release
101+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
63102 secrets : inherit
64- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
103+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
65104
66105 all-in-one-rocky-ovs :
67106 name : aio (Rocky OVS)
68107 needs :
108+ - check-changes
69109 - build-kayobe-image
70110 uses : ./.github/workflows/stackhpc-all-in-one.yml
71111 with :
@@ -77,12 +117,14 @@ jobs:
77117 vm_image : Rocky8-2022-11-08
78118 vm_interface : ens3
79119 OS_CLOUD : sms-lab-release
120+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
80121 secrets : inherit
81- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
122+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
82123
83124 all-in-one-rocky-ovn :
84125 name : aio (Rocky OVN)
85126 needs :
127+ - check-changes
86128 - build-kayobe-image
87129 uses : ./.github/workflows/stackhpc-all-in-one.yml
88130 with :
@@ -94,12 +136,14 @@ jobs:
94136 vm_image : Rocky8-2022-11-08
95137 vm_interface : ens3
96138 OS_CLOUD : sms-lab-release
139+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
97140 secrets : inherit
98- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
141+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
99142
100143 all-in-one-ubuntu-ovs :
101144 name : aio (Ubuntu OVS)
102145 needs :
146+ - check-changes
103147 - build-kayobe-image
104148 uses : ./.github/workflows/stackhpc-all-in-one.yml
105149 with :
@@ -108,12 +152,13 @@ jobs:
108152 neutron_plugin : ovs
109153 vm_image : Ubuntu-20.04
110154 OS_CLOUD : sms-lab-release
155+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
111156 secrets : inherit
112- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
113157
114158 all-in-one-ubuntu-ovn :
115159 name : aio (Ubuntu OVN)
116160 needs :
161+ - check-changes
117162 - build-kayobe-image
118163 uses : ./.github/workflows/stackhpc-all-in-one.yml
119164 with :
@@ -122,5 +167,6 @@ jobs:
122167 neutron_plugin : ovn
123168 vm_image : Ubuntu-20.04
124169 OS_CLOUD : sms-lab-release
170+ if : ${{ needs.check-changes.outputs.aio == 'true' }}
125171 secrets : inherit
126- if : github.repository == 'stackhpc/stackhpc-kayobe-config'
172+ if : ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
0 commit comments