Skip to content

Commit 7e356ec

Browse files
committed
impr(ci): move some kinds of tests to PR runs only
1 parent 136cae7 commit 7e356ec

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

.github/workflows/build_and_test.yml

+24-14
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,16 @@ jobs:
7777
secrets: inherit
7878

7979
check-codestyle-python:
80-
needs: [ check-permissions, build-build-tools-image ]
80+
needs: [ meta, check-permissions, build-build-tools-image ]
81+
if: ${{ needs.meta.outputs.run-kind == 'pr' }}
8182
uses: ./.github/workflows/_check-codestyle-python.yml
8283
with:
8384
build-tools-image: ${{ needs.build-build-tools-image.outputs.image }}-bookworm
8485
secrets: inherit
8586

8687
check-codestyle-jsonnet:
87-
needs: [ check-permissions, build-build-tools-image ]
88+
needs: [ meta, check-permissions, build-build-tools-image ]
89+
if: ${{ needs.meta.outputs.run-kind == 'pr' }}
8890
runs-on: [ self-hosted, small ]
8991
container:
9092
image: ${{ needs.build-build-tools-image.outputs.image }}
@@ -156,23 +158,25 @@ jobs:
156158
pass_if_unchanged: true
157159

158160
check-codestyle-rust:
159-
needs: [ check-permissions, build-build-tools-image ]
161+
needs: [ meta, check-permissions, build-build-tools-image ]
162+
if: ${{ needs.meta.outputs.run-kind == 'pr' }}
160163
uses: ./.github/workflows/_check-codestyle-rust.yml
161164
with:
162165
build-tools-image: ${{ needs.build-build-tools-image.outputs.image }}-bookworm
163166
archs: '["x64", "arm64"]'
164167
secrets: inherit
165168

166169
check-dependencies-rust:
167-
needs: [ files-changed, build-build-tools-image ]
168-
if: ${{ needs.files-changed.outputs.check-rust-dependencies == 'true' }}
170+
needs: [ meta, files-changed, build-build-tools-image ]
171+
if: ${{ needs.files-changed.outputs.check-rust-dependencies == 'true' && needs.meta.outputs.run-kind == 'pr' }}
169172
uses: ./.github/workflows/cargo-deny.yml
170173
with:
171174
build-tools-image: ${{ needs.build-build-tools-image.outputs.image }}-bookworm
172175
secrets: inherit
173176

174177
build-and-test-locally:
175178
needs: [ meta, build-build-tools-image ]
179+
if: ${{ needs.meta.outputs.run-kind == 'pr' }}
176180
strategy:
177181
fail-fast: false
178182
matrix:
@@ -470,14 +474,20 @@ jobs:
470474
})
471475
472476
trigger-e2e-tests:
473-
# Depends on jobs that can get skipped
477+
# !failure() && !cancelled() because it depends on jobs that can get skipped
474478
if: >-
475479
${{
476480
(
477-
!github.event.pull_request.draft
478-
|| contains( github.event.pull_request.labels.*.name, 'run-e2e-tests-in-draft')
479-
|| needs.meta.outputs.run-kind == 'push-main'
480-
) && !failure() && !cancelled()
481+
(
482+
needs.meta.outputs.run-kind == 'pr'
483+
&& (
484+
!github.event.pull_request.draft
485+
|| contains(github.event.pull_request.labels.*.name, 'run-e2e-tests-in-draft')
486+
)
487+
)
488+
|| contains(fromJSON('["push-main", "storage-rc-pr", "proxy-rc-pr", "compute-rc-pr"]'), needs.meta.outputs.run-kind)
489+
)
490+
&& !failure() && !cancelled()
481491
}}
482492
needs: [ check-permissions, push-neon-image-dev, push-compute-image-dev, meta ]
483493
uses: ./.github/workflows/trigger-e2e-tests.yml
@@ -1388,10 +1398,10 @@ jobs:
13881398
if: |
13891399
contains(needs.*.result, 'failure')
13901400
|| contains(needs.*.result, 'cancelled')
1391-
|| (needs.check-dependencies-rust.result == 'skipped' && needs.files-changed.outputs.check-rust-dependencies == 'true')
1392-
|| needs.build-and-test-locally.result == 'skipped'
1393-
|| needs.check-codestyle-python.result == 'skipped'
1394-
|| needs.check-codestyle-rust.result == 'skipped'
1401+
|| (needs.check-dependencies-rust.result == 'skipped' && needs.files-changed.outputs.check-rust-dependencies == 'true' && needs.meta.outputs.run-kind == 'pr')
1402+
|| (needs.build-and-test-locally.result == 'skipped' && needs.meta.outputs.run-kind == 'pr')
1403+
|| (needs.check-codestyle-python.result == 'skipped' && needs.meta.outputs.run-kind == 'pr')
1404+
|| (needs.check-codestyle-rust.result == 'skipped' && needs.meta.outputs.run-kind == 'pr')
13951405
|| needs.files-changed.result == 'skipped'
13961406
|| (needs.push-compute-image-dev.result == 'skipped' && contains(fromJSON('["push-main", "pr", "compute-release", "compute-rc-pr"]'), needs.meta.outputs.run-kind))
13971407
|| (needs.push-neon-image-dev.result == 'skipped' && contains(fromJSON('["push-main", "pr", "storage-release", "storage-rc-pr", "proxy-release", "proxy-rc-pr"]'), needs.meta.outputs.run-kind))

0 commit comments

Comments
 (0)