Skip to content

Commit e8ba1ea

Browse files
committed
ci: pause non-smoke workflows on draft PRs, add smoke preflight
1 parent f3632b7 commit e8ba1ea

48 files changed

Lines changed: 283 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: 'Wait for Smoke Test'
2+
description: 'Polls the Smoke Test workflow for the current commit and fails if it failed.'
3+
4+
# Designed to be the leading job in pull_request-triggered workflows so that
5+
# expensive integration CI does not run unless the smoke build passes.
6+
#
7+
# Push events bypass the wait entirely (we still get smoke results for those
8+
# pushes, but other CI is not gated on push). For drafts, callers should
9+
# skip dependent jobs via `if: github.event.pull_request.draft == false` -
10+
# this action will still pass through if smoke is skipped or absent.
11+
12+
inputs:
13+
workflow:
14+
description: 'Name of the smoke workflow file to wait on'
15+
required: false
16+
default: 'smoke-test.yml'
17+
timeout-seconds:
18+
description: 'Maximum time to wait for smoke to complete'
19+
required: false
20+
default: '1800'
21+
poll-seconds:
22+
description: 'Polling interval'
23+
required: false
24+
default: '20'
25+
github-token:
26+
description: 'GITHUB_TOKEN with actions:read permission'
27+
required: true
28+
29+
runs:
30+
using: 'composite'
31+
steps:
32+
- name: Wait for smoke
33+
shell: bash
34+
env:
35+
GH_TOKEN: ${{ inputs.github-token }}
36+
SMOKE_WORKFLOW: ${{ inputs.workflow }}
37+
TIMEOUT: ${{ inputs.timeout-seconds }}
38+
POLL: ${{ inputs.poll-seconds }}
39+
REPO: ${{ github.repository }}
40+
run: |
41+
set -u
42+
# Only gate pull_request events. Push events are not gated.
43+
if [ "${{ github.event_name }}" != "pull_request" ]; then
44+
echo "Not a pull_request event - skipping smoke gate."
45+
exit 0
46+
fi
47+
48+
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
49+
echo "Waiting for $SMOKE_WORKFLOW on $HEAD_SHA (timeout ${TIMEOUT}s)"
50+
51+
START=$(date +%s)
52+
while :; do
53+
NOW=$(date +%s)
54+
ELAPSED=$((NOW - START))
55+
if [ "$ELAPSED" -ge "$TIMEOUT" ]; then
56+
echo "::error::Timed out after ${TIMEOUT}s waiting for $SMOKE_WORKFLOW on $HEAD_SHA"
57+
exit 1
58+
fi
59+
60+
# Look up the latest run for this workflow + head SHA.
61+
RUN_JSON=$(gh api \
62+
"repos/${REPO}/actions/workflows/${SMOKE_WORKFLOW}/runs?head_sha=${HEAD_SHA}&per_page=1" \
63+
2>/dev/null || echo '{}')
64+
65+
STATUS=$(echo "$RUN_JSON" | jq -r '.workflow_runs[0].status // "missing"')
66+
CONCLUSION=$(echo "$RUN_JSON" | jq -r '.workflow_runs[0].conclusion // ""')
67+
RUN_URL=$(echo "$RUN_JSON" | jq -r '.workflow_runs[0].html_url // ""')
68+
69+
case "$STATUS" in
70+
completed)
71+
case "$CONCLUSION" in
72+
success)
73+
echo "Smoke test passed: $RUN_URL"
74+
exit 0
75+
;;
76+
skipped|neutral)
77+
echo "Smoke test was $CONCLUSION - treating as pass: $RUN_URL"
78+
exit 0
79+
;;
80+
*)
81+
echo "::error::Smoke test concluded as '$CONCLUSION': $RUN_URL"
82+
exit 1
83+
;;
84+
esac
85+
;;
86+
missing)
87+
echo "[$ELAPSED s] No smoke run yet for $HEAD_SHA"
88+
;;
89+
*)
90+
echo "[$ELAPSED s] Smoke status=$STATUS ($RUN_URL)"
91+
;;
92+
esac
93+
94+
sleep "$POLL"
95+
done

.github/workflows/bind9.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
branches: [ 'master', 'main', 'release/**' ]
77
pull_request:
88
branches: [ '*' ]
9+
types: [opened, synchronize, reopened, ready_for_review]
910

1011
concurrency:
1112
group: ${{ github.workflow }}-${{ github.ref }}
@@ -14,6 +15,7 @@ concurrency:
1415

1516
jobs:
1617
build_wolfprovider:
18+
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
1719
uses: ./.github/workflows/build-wolfprovider.yml
1820
with:
1921
wolfssl_ref: ${{ matrix.wolfssl_ref }}
@@ -28,6 +30,7 @@ jobs:
2830
replace_default: [ true ]
2931

3032
test_bind:
33+
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
3134
runs-on: ubuntu-22.04
3235
needs: build_wolfprovider
3336
container:

.github/workflows/cjose.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
branches: [ 'master', 'main', 'release/**' ]
77
pull_request:
88
branches: [ '*' ]
9+
types: [opened, synchronize, reopened, ready_for_review]
910

1011
concurrency:
1112
group: ${{ github.workflow }}-${{ github.ref }}
@@ -14,6 +15,7 @@ concurrency:
1415

1516
jobs:
1617
build_wolfprovider:
18+
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
1719
uses: ./.github/workflows/build-wolfprovider.yml
1820
with:
1921
wolfssl_ref: ${{ matrix.wolfssl_ref }}
@@ -28,6 +30,7 @@ jobs:
2830
replace_default: [ true ]
2931

3032
test_cjose:
33+
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
3134
runs-on: ubuntu-22.04
3235
needs: build_wolfprovider
3336
# Run inside Debian Bookworm to match packaging environment

.github/workflows/cmdline.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
branches: [ 'master', 'main', 'release/**' ]
77
pull_request:
88
branches: [ '*' ]
9+
types: [opened, synchronize, reopened, ready_for_review]
910

1011
concurrency:
1112
group: ${{ github.workflow }}-${{ github.ref }}
@@ -14,6 +15,7 @@ concurrency:
1415

1516
jobs:
1617
cmdtest_test:
18+
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
1719
name: Command line test
1820
runs-on: ubuntu-22.04
1921
timeout-minutes: 20

.github/workflows/codespell.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
branches: [ 'master', 'main', 'release/**' ]
77
pull_request:
88
branches: [ '*' ]
9+
types: [opened, synchronize, reopened, ready_for_review]
910

1011
concurrency:
1112
group: ${{ github.workflow }}-${{ github.ref }}
@@ -14,6 +15,7 @@ concurrency:
1415

1516
jobs:
1617
codespell:
18+
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
1719
name: Check for spelling errors
1820
runs-on: ubuntu-22.04
1921
timeout-minutes: 5

.github/workflows/curl.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
branches: [ 'master', 'main', 'release/**' ]
77
pull_request:
88
branches: [ '*' ]
9+
types: [opened, synchronize, reopened, ready_for_review]
910

1011
concurrency:
1112
group: ${{ github.workflow }}-${{ github.ref }}
@@ -14,6 +15,7 @@ concurrency:
1415

1516
jobs:
1617
build_wolfprovider:
18+
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
1719
uses: ./.github/workflows/build-wolfprovider.yml
1820
with:
1921
wolfssl_ref: ${{ matrix.wolfssl_ref }}
@@ -28,6 +30,7 @@ jobs:
2830
replace_default: [ true ]
2931

3032
test_curl:
33+
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
3134
runs-on: ubuntu-22.04
3235
needs: build_wolfprovider
3336
container:

.github/workflows/debian-package.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
branches: [ 'master', 'main', 'release/**' ]
77
pull_request:
88
branches: [ '*' ]
9+
types: [opened, synchronize, reopened, ready_for_review]
910

1011
concurrency:
1112
group: ${{ github.workflow }}-${{ github.ref }}
@@ -14,6 +15,7 @@ concurrency:
1415

1516
jobs:
1617
build_wolfprovider:
18+
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
1719
uses: ./.github/workflows/build-wolfprovider.yml
1820
with:
1921
wolfssl_ref: ${{ matrix.wolfssl_ref }}
@@ -28,6 +30,7 @@ jobs:
2830
replace_default: [ true, false ]
2931

3032
libwolfprov-replace-default:
33+
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
3134
name: libwolfprov ${{ matrix.replace_default && 'replace-default' || 'standalone' }} ${{ matrix.fips_ref }}
3235
runs-on: ubuntu-22.04
3336
needs: build_wolfprovider

.github/workflows/fips-ready.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
branches: [ 'master', 'main', 'release/**' ]
77
pull_request:
88
branches: [ '*' ]
9+
types: [opened, synchronize, reopened, ready_for_review]
910

1011
concurrency:
1112
group: ${{ github.workflow }}-${{ github.ref }}
@@ -14,6 +15,7 @@ concurrency:
1415

1516
jobs:
1617
fips_ready_test:
18+
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
1719
name: FIPS Ready Bundle Test
1820
runs-on: ubuntu-22.04
1921
timeout-minutes: 20

.github/workflows/git-ssh-dr.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ on:
55
branches: [ 'master', 'main', 'release/**' ]
66
pull_request:
77
branches: [ '*' ]
8+
types: [opened, synchronize, reopened, ready_for_review]
89

910
concurrency:
1011
group: ${{ github.workflow }}-${{ github.ref }}
1112
cancel-in-progress: true
1213

1314
jobs:
1415
build_wolfprovider:
16+
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
1517
uses: ./.github/workflows/build-wolfprovider.yml
1618
with:
1719
wolfssl_ref: ${{ matrix.wolfssl_ref }}
@@ -26,6 +28,7 @@ jobs:
2628
replace_default: [ true ]
2729

2830
git-ssh-default-replace-test:
31+
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
2932
runs-on: ubuntu-22.04
3033
container:
3134
image: debian:bookworm

.github/workflows/grpc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
branches: [ 'master', 'main', 'release/**' ]
77
pull_request:
88
branches: [ '*' ]
9+
types: [opened, synchronize, reopened, ready_for_review]
910

1011
concurrency:
1112
group: ${{ github.workflow }}-${{ github.ref }}
@@ -14,6 +15,7 @@ concurrency:
1415

1516
jobs:
1617
build_wolfprovider:
18+
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
1719
uses: ./.github/workflows/build-wolfprovider.yml
1820
with:
1921
wolfssl_ref: ${{ matrix.wolfssl_ref }}
@@ -28,6 +30,7 @@ jobs:
2830
replace_default: [ true ]
2931

3032
test_grpc:
33+
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
3134
runs-on: ubuntu-22.04
3235
needs: build_wolfprovider
3336
container:

0 commit comments

Comments
 (0)