Skip to content

Commit 33406bc

Browse files
committed
build: make special label checks auto-pass instead of skip
In this commit, we revamp the way our skip-labels worked to instead mark certain stages as green, instead of skipping them. Skipped changes didn't count towards the set of required checks, which slowed down PR velocity. Previously, when PRs were labeled with 'no-itest' or 'no-changelog', the corresponding CI jobs would be completely skipped. This caused the GitHub checks to show as skipped rather than successful, which could be confusing and prevented certain merge rules from working properly. This commit changes the behavior so that these jobs still run but immediately report success when the special labels are detected. Each affected job now starts with a label check step that sets a skip flag, and all subsequent steps are conditionally executed based on this flag. When skipped, the jobs add a notice to the GitHub step summary explaining that tests were auto-passed due to the label. The change affects five jobs: basic-integration-test, integration-test, windows-integration-test, macos-integration-test, and milestone-check.
1 parent d5f70c0 commit 33406bc

File tree

2 files changed

+96
-22
lines changed

2 files changed

+96
-22
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: "Check PR labels"
2+
description: "Checks if specific labels are present on a PR and sets outputs accordingly."
3+
4+
inputs:
5+
label:
6+
description: "The label to check for"
7+
required: true
8+
skip-message:
9+
description: "The message to display when skipping due to label"
10+
required: true
11+
12+
outputs:
13+
skip:
14+
description: "Whether to skip the tests (true/false)"
15+
value: ${{ steps.check.outputs.skip }}
16+
17+
runs:
18+
using: "composite"
19+
steps:
20+
- name: Check for label
21+
id: check
22+
shell: bash
23+
run: |
24+
if [[ "${{ contains(github.event.pull_request.labels.*.name, inputs.label) }}" == "true" ]]; then
25+
echo "::notice::${{ inputs.skip-message }}"
26+
echo "${{ inputs.skip-message }}" >> $GITHUB_STEP_SUMMARY
27+
echo "skip=true" >> $GITHUB_OUTPUT
28+
else
29+
echo "skip=false" >> $GITHUB_OUTPUT
30+
fi

.github/workflows/main.yml

Lines changed: 66 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,6 @@ jobs:
269269
basic-integration-test:
270270
name: Run basic itests
271271
runs-on: ubuntu-latest
272-
if: '!contains(github.event.pull_request.labels.*.name, ''no-itest'')'
273272
strategy:
274273
# Allow other tests in the matrix to continue if one fails.
275274
fail-fast: false
@@ -289,31 +288,42 @@ jobs:
289288
with:
290289
fetch-depth: 0
291290

291+
- name: Check for no-itest label
292+
id: check-label
293+
uses: ./.github/actions/check-label
294+
with:
295+
label: 'no-itest'
296+
skip-message: "Tests auto-passed due to 'no-itest' label"
297+
292298
- name: Clean up runner space
299+
if: steps.check-label.outputs.skip != 'true'
293300
uses: ./.github/actions/cleanup-space
294301

295302
- name: Fetch and rebase on ${{ github.base_ref }}
296-
if: github.event_name == 'pull_request'
303+
if: github.event_name == 'pull_request' && steps.check-label.outputs.skip != 'true'
297304
uses: ./.github/actions/rebase
298305

299306
- name: Setup go ${{ env.GO_VERSION }}
307+
if: steps.check-label.outputs.skip != 'true'
300308
uses: ./.github/actions/setup-go
301309
with:
302310
go-version: '${{ env.GO_VERSION }}'
303311
key-prefix: integration-test
304312

305313
- name: Install bitcoind
314+
if: steps.check-label.outputs.skip != 'true'
306315
run: ./scripts/install_bitcoind.sh $BITCOIN_VERSION
307316

308317
- name: Run ${{ matrix.name }}
318+
if: steps.check-label.outputs.skip != 'true'
309319
run: make itest-parallel tranches=${{ env.TRANCHES }} ${{ matrix.args }} shuffleseed=${{ github.run_id }}${{ strategy.job-index }}
310320

311321
- name: Clean coverage
312322
run: grep -Ev '(\.pb\.go|\.pb\.json\.go|\.pb\.gw\.go)' coverage.txt > coverage-norpc.txt
313-
if: ${{ contains(matrix.args, 'cover=1') }}
323+
if: ${{ contains(matrix.args, 'cover=1') && steps.check-label.outputs.skip != 'true' }}
314324

315325
- name: Send coverage
316-
if: ${{ contains(matrix.args, 'cover=1') }}
326+
if: ${{ contains(matrix.args, 'cover=1') && steps.check-label.outputs.skip != 'true' }}
317327
continue-on-error: true
318328
uses: coverallsapp/github-action@v2
319329
with:
@@ -323,13 +333,13 @@ jobs:
323333
parallel: true
324334

325335
- name: Zip log files on failure
326-
if: ${{ failure() }}
336+
if: ${{ failure() && steps.check-label.outputs.skip != 'true' }}
327337
timeout-minutes: 5 # timeout after 5 minute
328338
run: 7z a logs-itest-${{ matrix.name }}.zip itest/**/*.log itest/postgres.log
329339

330340
- name: Upload log files on failure
331341
uses: actions/upload-artifact@v4
332-
if: ${{ failure() }}
342+
if: ${{ failure() && steps.check-label.outputs.skip != 'true' }}
333343
with:
334344
name: logs-itest-${{ matrix.name }}
335345
path: logs-itest-${{ matrix.name }}.zip
@@ -341,7 +351,6 @@ jobs:
341351
integration-test:
342352
name: Run itests
343353
runs-on: ubuntu-latest
344-
if: '!contains(github.event.pull_request.labels.*.name, ''no-itest'')'
345354
strategy:
346355
# Allow other tests in the matrix to continue if one fails.
347356
fail-fast: false
@@ -369,31 +378,42 @@ jobs:
369378
with:
370379
fetch-depth: 0
371380

381+
- name: Check for no-itest label
382+
id: check-label
383+
uses: ./.github/actions/check-label
384+
with:
385+
label: 'no-itest'
386+
skip-message: "Tests auto-passed due to 'no-itest' label"
387+
372388
- name: Clean up runner space
389+
if: steps.check-label.outputs.skip != 'true'
373390
uses: ./.github/actions/cleanup-space
374391

375392
- name: Fetch and rebase on ${{ github.base_ref }}
376-
if: github.event_name == 'pull_request'
393+
if: github.event_name == 'pull_request' && steps.check-label.outputs.skip != 'true'
377394
uses: ./.github/actions/rebase
378395

379396
- name: Setup go ${{ env.GO_VERSION }}
397+
if: steps.check-label.outputs.skip != 'true'
380398
uses: ./.github/actions/setup-go
381399
with:
382400
go-version: '${{ env.GO_VERSION }}'
383401
key-prefix: integration-test
384402

385403
- name: Install bitcoind
404+
if: steps.check-label.outputs.skip != 'true'
386405
run: ./scripts/install_bitcoind.sh $BITCOIN_VERSION
387406

388407
- name: Run ${{ matrix.name }}
408+
if: steps.check-label.outputs.skip != 'true'
389409
run: make itest-parallel tranches=${{ env.SMALL_TRANCHES }} ${{ matrix.args }} shuffleseed=${{ github.run_id }}${{ strategy.job-index }}
390410

391411
- name: Clean coverage
392412
run: grep -Ev '(\.pb\.go|\.pb\.json\.go|\.pb\.gw\.go)' coverage.txt > coverage-norpc.txt
393-
if: ${{ contains(matrix.args, 'cover=1') }}
413+
if: ${{ contains(matrix.args, 'cover=1') && steps.check-label.outputs.skip != 'true' }}
394414

395415
- name: Send coverage
396-
if: ${{ contains(matrix.args, 'cover=1') }}
416+
if: ${{ contains(matrix.args, 'cover=1') && steps.check-label.outputs.skip != 'true' }}
397417
continue-on-error: true
398418
uses: coverallsapp/github-action@v2
399419
with:
@@ -403,13 +423,13 @@ jobs:
403423
parallel: true
404424

405425
- name: Zip log files on failure
406-
if: ${{ failure() }}
426+
if: ${{ failure() && steps.check-label.outputs.skip != 'true' }}
407427
timeout-minutes: 5 # timeout after 5 minute
408428
run: 7z a logs-itest-${{ matrix.name }}.zip itest/**/*.log
409429

410430
- name: Upload log files on failure
411431
uses: actions/upload-artifact@v4
412-
if: ${{ failure() }}
432+
if: ${{ failure() && steps.check-label.outputs.skip != 'true' }}
413433
with:
414434
name: logs-itest-${{ matrix.name }}
415435
path: logs-itest-${{ matrix.name }}.zip
@@ -422,39 +442,47 @@ jobs:
422442
windows-integration-test:
423443
name: Run windows itest
424444
runs-on: windows-latest
425-
if: '!contains(github.event.pull_request.labels.*.name, ''no-itest'')'
426445
steps:
427446
- name: Git checkout
428447
uses: actions/checkout@v4
429448
with:
430449
fetch-depth: 0
431450

451+
- name: Check for no-itest label
452+
id: check-label
453+
uses: ./.github/actions/check-label
454+
with:
455+
label: 'no-itest'
456+
skip-message: "Tests auto-passed due to 'no-itest' label"
457+
432458
- name: Fetch and rebase on ${{ github.base_ref }}
433-
if: github.event_name == 'pull_request'
459+
if: github.event_name == 'pull_request' && steps.check-label.outputs.skip != 'true'
434460
uses: ./.github/actions/rebase
435461

436462
- name: Setup go ${{ env.GO_VERSION }}
463+
if: steps.check-label.outputs.skip != 'true'
437464
uses: ./.github/actions/setup-go
438465
with:
439466
go-version: '${{ env.GO_VERSION }}'
440467
key-prefix: integration-test
441468

442469
- name: Run itest
470+
if: steps.check-label.outputs.skip != 'true'
443471
run: make itest-parallel tranches=${{ env.SMALL_TRANCHES }} windows=1 shuffleseed=${{ github.run_id }}
444472

445473
- name: Kill any remaining lnd processes
446-
if: ${{ failure() }}
474+
if: ${{ failure() && steps.check-label.outputs.skip != 'true' }}
447475
shell: powershell
448476
run: taskkill /IM lnd-itest.exe /T /F
449477

450478
- name: Zip log files on failure
451-
if: ${{ failure() }}
479+
if: ${{ failure() && steps.check-label.outputs.skip != 'true' }}
452480
timeout-minutes: 5 # timeout after 5 minute
453481
run: 7z a logs-itest-windows.zip itest/**/*.log
454482

455483
- name: Upload log files on failure
456484
uses: actions/upload-artifact@v4
457-
if: ${{ failure() }}
485+
if: ${{ failure() && steps.check-label.outputs.skip != 'true' }}
458486
with:
459487
name: logs-itest-windows
460488
path: logs-itest-windows.zip
@@ -466,34 +494,42 @@ jobs:
466494
macos-integration-test:
467495
name: Run macOS itest
468496
runs-on: macos-14
469-
if: '!contains(github.event.pull_request.labels.*.name, ''no-itest'')'
470497
steps:
471498
- name: Git checkout
472499
uses: actions/checkout@v4
473500
with:
474501
fetch-depth: 0
475502

503+
- name: Check for no-itest label
504+
id: check-label
505+
uses: ./.github/actions/check-label
506+
with:
507+
label: 'no-itest'
508+
skip-message: "Tests auto-passed due to 'no-itest' label"
509+
476510
- name: Fetch and rebase on ${{ github.base_ref }}
477-
if: github.event_name == 'pull_request'
511+
if: github.event_name == 'pull_request' && steps.check-label.outputs.skip != 'true'
478512
uses: ./.github/actions/rebase
479513

480514
- name: Setup go ${{ env.GO_VERSION }}
515+
if: steps.check-label.outputs.skip != 'true'
481516
uses: ./.github/actions/setup-go
482517
with:
483518
go-version: '${{ env.GO_VERSION }}'
484519
key-prefix: integration-test
485520

486521
- name: Run itest
522+
if: steps.check-label.outputs.skip != 'true'
487523
run: make itest-parallel tranches=${{ env.SMALL_TRANCHES }} shuffleseed=${{ github.run_id }}
488524

489525
- name: Zip log files on failure
490-
if: ${{ failure() }}
526+
if: ${{ failure() && steps.check-label.outputs.skip != 'true' }}
491527
timeout-minutes: 5 # timeout after 5 minute
492528
run: 7z a logs-itest-macos.zip itest/**/*.log
493529

494530
- name: Upload log files on failure
495531
uses: actions/upload-artifact@v4
496-
if: ${{ failure() }}
532+
if: ${{ failure() && steps.check-label.outputs.skip != 'true' }}
497533
with:
498534
name: logs-itest-macos
499535
path: logs-itest-macos.zip
@@ -529,15 +565,23 @@ jobs:
529565
milestone-check:
530566
name: Check release notes updated
531567
runs-on: ubuntu-latest
532-
if: '!contains(github.event.pull_request.labels.*.name, ''no-changelog'')'
533568
steps:
534569
- name: Git checkout
535570
uses: actions/checkout@v4
536571

572+
- name: Check for no-changelog label
573+
id: check-label
574+
uses: ./.github/actions/check-label
575+
with:
576+
label: 'no-changelog'
577+
skip-message: "Changelog check auto-passed due to 'no-changelog' label"
578+
537579
- name: Clean up runner space
580+
if: steps.check-label.outputs.skip != 'true'
538581
uses: ./.github/actions/cleanup-space
539582

540583
- name: Release notes check
584+
if: steps.check-label.outputs.skip != 'true'
541585
run: scripts/check-release-notes.sh
542586

543587
########################

0 commit comments

Comments
 (0)