Merge pull request #10187 from Roasbeef/skip-labels-green-check

build: make special label checks auto-pass instead of skip
This commit is contained in:
Yong
2025-09-06 04:36:48 +08:00
committed by GitHub
2 changed files with 96 additions and 22 deletions

30
.github/actions/check-label/action.yml vendored Normal file
View File

@@ -0,0 +1,30 @@
name: "Check PR labels"
description: "Checks if specific labels are present on a PR and sets outputs accordingly."
inputs:
label:
description: "The label to check for"
required: true
skip-message:
description: "The message to display when skipping due to label"
required: true
outputs:
skip:
description: "Whether to skip the tests (true/false)"
value: ${{ steps.check.outputs.skip }}
runs:
using: "composite"
steps:
- name: Check for label
id: check
shell: bash
run: |
if [[ "${{ contains(github.event.pull_request.labels.*.name, inputs.label) }}" == "true" ]]; then
echo "::notice::${{ inputs.skip-message }}"
echo "${{ inputs.skip-message }}" >> $GITHUB_STEP_SUMMARY
echo "skip=true" >> $GITHUB_OUTPUT
else
echo "skip=false" >> $GITHUB_OUTPUT
fi

View File

@@ -269,7 +269,6 @@ jobs:
basic-integration-test: basic-integration-test:
name: Run basic itests name: Run basic itests
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: '!contains(github.event.pull_request.labels.*.name, ''no-itest'')'
strategy: strategy:
# Allow other tests in the matrix to continue if one fails. # Allow other tests in the matrix to continue if one fails.
fail-fast: false fail-fast: false
@@ -289,31 +288,42 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Check for no-itest label
id: check-label
uses: ./.github/actions/check-label
with:
label: 'no-itest'
skip-message: "Tests auto-passed due to 'no-itest' label"
- name: Clean up runner space - name: Clean up runner space
if: steps.check-label.outputs.skip != 'true'
uses: ./.github/actions/cleanup-space uses: ./.github/actions/cleanup-space
- name: Fetch and rebase on ${{ github.base_ref }} - name: Fetch and rebase on ${{ github.base_ref }}
if: github.event_name == 'pull_request' if: github.event_name == 'pull_request' && steps.check-label.outputs.skip != 'true'
uses: ./.github/actions/rebase uses: ./.github/actions/rebase
- name: Setup go ${{ env.GO_VERSION }} - name: Setup go ${{ env.GO_VERSION }}
if: steps.check-label.outputs.skip != 'true'
uses: ./.github/actions/setup-go uses: ./.github/actions/setup-go
with: with:
go-version: '${{ env.GO_VERSION }}' go-version: '${{ env.GO_VERSION }}'
key-prefix: integration-test key-prefix: integration-test
- name: Install bitcoind - name: Install bitcoind
if: steps.check-label.outputs.skip != 'true'
run: ./scripts/install_bitcoind.sh $BITCOIN_VERSION run: ./scripts/install_bitcoind.sh $BITCOIN_VERSION
- name: Run ${{ matrix.name }} - name: Run ${{ matrix.name }}
if: steps.check-label.outputs.skip != 'true'
run: make itest-parallel tranches=${{ env.TRANCHES }} ${{ matrix.args }} shuffleseed=${{ github.run_id }}${{ strategy.job-index }} run: make itest-parallel tranches=${{ env.TRANCHES }} ${{ matrix.args }} shuffleseed=${{ github.run_id }}${{ strategy.job-index }}
- name: Clean coverage - name: Clean coverage
run: grep -Ev '(\.pb\.go|\.pb\.json\.go|\.pb\.gw\.go)' coverage.txt > coverage-norpc.txt run: grep -Ev '(\.pb\.go|\.pb\.json\.go|\.pb\.gw\.go)' coverage.txt > coverage-norpc.txt
if: ${{ contains(matrix.args, 'cover=1') }} if: ${{ contains(matrix.args, 'cover=1') && steps.check-label.outputs.skip != 'true' }}
- name: Send coverage - name: Send coverage
if: ${{ contains(matrix.args, 'cover=1') }} if: ${{ contains(matrix.args, 'cover=1') && steps.check-label.outputs.skip != 'true' }}
continue-on-error: true continue-on-error: true
uses: coverallsapp/github-action@v2 uses: coverallsapp/github-action@v2
with: with:
@@ -323,13 +333,13 @@ jobs:
parallel: true parallel: true
- name: Zip log files on failure - name: Zip log files on failure
if: ${{ failure() }} if: ${{ failure() && steps.check-label.outputs.skip != 'true' }}
timeout-minutes: 5 # timeout after 5 minute timeout-minutes: 5 # timeout after 5 minute
run: 7z a logs-itest-${{ matrix.name }}.zip itest/**/*.log itest/postgres.log run: 7z a logs-itest-${{ matrix.name }}.zip itest/**/*.log itest/postgres.log
- name: Upload log files on failure - name: Upload log files on failure
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
if: ${{ failure() }} if: ${{ failure() && steps.check-label.outputs.skip != 'true' }}
with: with:
name: logs-itest-${{ matrix.name }} name: logs-itest-${{ matrix.name }}
path: logs-itest-${{ matrix.name }}.zip path: logs-itest-${{ matrix.name }}.zip
@@ -341,7 +351,6 @@ jobs:
integration-test: integration-test:
name: Run itests name: Run itests
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: '!contains(github.event.pull_request.labels.*.name, ''no-itest'')'
strategy: strategy:
# Allow other tests in the matrix to continue if one fails. # Allow other tests in the matrix to continue if one fails.
fail-fast: false fail-fast: false
@@ -369,31 +378,42 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Check for no-itest label
id: check-label
uses: ./.github/actions/check-label
with:
label: 'no-itest'
skip-message: "Tests auto-passed due to 'no-itest' label"
- name: Clean up runner space - name: Clean up runner space
if: steps.check-label.outputs.skip != 'true'
uses: ./.github/actions/cleanup-space uses: ./.github/actions/cleanup-space
- name: Fetch and rebase on ${{ github.base_ref }} - name: Fetch and rebase on ${{ github.base_ref }}
if: github.event_name == 'pull_request' if: github.event_name == 'pull_request' && steps.check-label.outputs.skip != 'true'
uses: ./.github/actions/rebase uses: ./.github/actions/rebase
- name: Setup go ${{ env.GO_VERSION }} - name: Setup go ${{ env.GO_VERSION }}
if: steps.check-label.outputs.skip != 'true'
uses: ./.github/actions/setup-go uses: ./.github/actions/setup-go
with: with:
go-version: '${{ env.GO_VERSION }}' go-version: '${{ env.GO_VERSION }}'
key-prefix: integration-test key-prefix: integration-test
- name: Install bitcoind - name: Install bitcoind
if: steps.check-label.outputs.skip != 'true'
run: ./scripts/install_bitcoind.sh $BITCOIN_VERSION run: ./scripts/install_bitcoind.sh $BITCOIN_VERSION
- name: Run ${{ matrix.name }} - name: Run ${{ matrix.name }}
if: steps.check-label.outputs.skip != 'true'
run: make itest-parallel tranches=${{ env.SMALL_TRANCHES }} ${{ matrix.args }} shuffleseed=${{ github.run_id }}${{ strategy.job-index }} run: make itest-parallel tranches=${{ env.SMALL_TRANCHES }} ${{ matrix.args }} shuffleseed=${{ github.run_id }}${{ strategy.job-index }}
- name: Clean coverage - name: Clean coverage
run: grep -Ev '(\.pb\.go|\.pb\.json\.go|\.pb\.gw\.go)' coverage.txt > coverage-norpc.txt run: grep -Ev '(\.pb\.go|\.pb\.json\.go|\.pb\.gw\.go)' coverage.txt > coverage-norpc.txt
if: ${{ contains(matrix.args, 'cover=1') }} if: ${{ contains(matrix.args, 'cover=1') && steps.check-label.outputs.skip != 'true' }}
- name: Send coverage - name: Send coverage
if: ${{ contains(matrix.args, 'cover=1') }} if: ${{ contains(matrix.args, 'cover=1') && steps.check-label.outputs.skip != 'true' }}
continue-on-error: true continue-on-error: true
uses: coverallsapp/github-action@v2 uses: coverallsapp/github-action@v2
with: with:
@@ -403,13 +423,13 @@ jobs:
parallel: true parallel: true
- name: Zip log files on failure - name: Zip log files on failure
if: ${{ failure() }} if: ${{ failure() && steps.check-label.outputs.skip != 'true' }}
timeout-minutes: 5 # timeout after 5 minute timeout-minutes: 5 # timeout after 5 minute
run: 7z a logs-itest-${{ matrix.name }}.zip itest/**/*.log run: 7z a logs-itest-${{ matrix.name }}.zip itest/**/*.log
- name: Upload log files on failure - name: Upload log files on failure
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
if: ${{ failure() }} if: ${{ failure() && steps.check-label.outputs.skip != 'true' }}
with: with:
name: logs-itest-${{ matrix.name }} name: logs-itest-${{ matrix.name }}
path: logs-itest-${{ matrix.name }}.zip path: logs-itest-${{ matrix.name }}.zip
@@ -422,39 +442,47 @@ jobs:
windows-integration-test: windows-integration-test:
name: Run windows itest name: Run windows itest
runs-on: windows-latest runs-on: windows-latest
if: '!contains(github.event.pull_request.labels.*.name, ''no-itest'')'
steps: steps:
- name: Git checkout - name: Git checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Check for no-itest label
id: check-label
uses: ./.github/actions/check-label
with:
label: 'no-itest'
skip-message: "Tests auto-passed due to 'no-itest' label"
- name: Fetch and rebase on ${{ github.base_ref }} - name: Fetch and rebase on ${{ github.base_ref }}
if: github.event_name == 'pull_request' if: github.event_name == 'pull_request' && steps.check-label.outputs.skip != 'true'
uses: ./.github/actions/rebase uses: ./.github/actions/rebase
- name: Setup go ${{ env.GO_VERSION }} - name: Setup go ${{ env.GO_VERSION }}
if: steps.check-label.outputs.skip != 'true'
uses: ./.github/actions/setup-go uses: ./.github/actions/setup-go
with: with:
go-version: '${{ env.GO_VERSION }}' go-version: '${{ env.GO_VERSION }}'
key-prefix: integration-test key-prefix: integration-test
- name: Run itest - name: Run itest
if: steps.check-label.outputs.skip != 'true'
run: make itest-parallel tranches=${{ env.SMALL_TRANCHES }} windows=1 shuffleseed=${{ github.run_id }} run: make itest-parallel tranches=${{ env.SMALL_TRANCHES }} windows=1 shuffleseed=${{ github.run_id }}
- name: Kill any remaining lnd processes - name: Kill any remaining lnd processes
if: ${{ failure() }} if: ${{ failure() && steps.check-label.outputs.skip != 'true' }}
shell: powershell shell: powershell
run: taskkill /IM lnd-itest.exe /T /F run: taskkill /IM lnd-itest.exe /T /F
- name: Zip log files on failure - name: Zip log files on failure
if: ${{ failure() }} if: ${{ failure() && steps.check-label.outputs.skip != 'true' }}
timeout-minutes: 5 # timeout after 5 minute timeout-minutes: 5 # timeout after 5 minute
run: 7z a logs-itest-windows.zip itest/**/*.log run: 7z a logs-itest-windows.zip itest/**/*.log
- name: Upload log files on failure - name: Upload log files on failure
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
if: ${{ failure() }} if: ${{ failure() && steps.check-label.outputs.skip != 'true' }}
with: with:
name: logs-itest-windows name: logs-itest-windows
path: logs-itest-windows.zip path: logs-itest-windows.zip
@@ -466,34 +494,42 @@ jobs:
macos-integration-test: macos-integration-test:
name: Run macOS itest name: Run macOS itest
runs-on: macos-14 runs-on: macos-14
if: '!contains(github.event.pull_request.labels.*.name, ''no-itest'')'
steps: steps:
- name: Git checkout - name: Git checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Check for no-itest label
id: check-label
uses: ./.github/actions/check-label
with:
label: 'no-itest'
skip-message: "Tests auto-passed due to 'no-itest' label"
- name: Fetch and rebase on ${{ github.base_ref }} - name: Fetch and rebase on ${{ github.base_ref }}
if: github.event_name == 'pull_request' if: github.event_name == 'pull_request' && steps.check-label.outputs.skip != 'true'
uses: ./.github/actions/rebase uses: ./.github/actions/rebase
- name: Setup go ${{ env.GO_VERSION }} - name: Setup go ${{ env.GO_VERSION }}
if: steps.check-label.outputs.skip != 'true'
uses: ./.github/actions/setup-go uses: ./.github/actions/setup-go
with: with:
go-version: '${{ env.GO_VERSION }}' go-version: '${{ env.GO_VERSION }}'
key-prefix: integration-test key-prefix: integration-test
- name: Run itest - name: Run itest
if: steps.check-label.outputs.skip != 'true'
run: make itest-parallel tranches=${{ env.SMALL_TRANCHES }} shuffleseed=${{ github.run_id }} run: make itest-parallel tranches=${{ env.SMALL_TRANCHES }} shuffleseed=${{ github.run_id }}
- name: Zip log files on failure - name: Zip log files on failure
if: ${{ failure() }} if: ${{ failure() && steps.check-label.outputs.skip != 'true' }}
timeout-minutes: 5 # timeout after 5 minute timeout-minutes: 5 # timeout after 5 minute
run: 7z a logs-itest-macos.zip itest/**/*.log run: 7z a logs-itest-macos.zip itest/**/*.log
- name: Upload log files on failure - name: Upload log files on failure
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
if: ${{ failure() }} if: ${{ failure() && steps.check-label.outputs.skip != 'true' }}
with: with:
name: logs-itest-macos name: logs-itest-macos
path: logs-itest-macos.zip path: logs-itest-macos.zip
@@ -529,15 +565,23 @@ jobs:
milestone-check: milestone-check:
name: Check release notes updated name: Check release notes updated
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: '!contains(github.event.pull_request.labels.*.name, ''no-changelog'')'
steps: steps:
- name: Git checkout - name: Git checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Check for no-changelog label
id: check-label
uses: ./.github/actions/check-label
with:
label: 'no-changelog'
skip-message: "Changelog check auto-passed due to 'no-changelog' label"
- name: Clean up runner space - name: Clean up runner space
if: steps.check-label.outputs.skip != 'true'
uses: ./.github/actions/cleanup-space uses: ./.github/actions/cleanup-space
- name: Release notes check - name: Release notes check
if: steps.check-label.outputs.skip != 'true'
run: scripts/check-release-notes.sh run: scripts/check-release-notes.sh
######################## ########################