feat(workflows): set the status of PR build checks (#1659)
This commit is contained in:
parent
7842b14931
commit
b03ac83556
43
.github/workflows/build_pull_request.yml
vendored
43
.github/workflows/build_pull_request.yml
vendored
@ -98,6 +98,8 @@ jobs:
|
|||||||
needs: prepare
|
needs: prepare
|
||||||
if: ${{ needs.prepare.outputs.isMultisrcChanged == '1' }}
|
if: ${{ needs.prepare.outputs.isMultisrcChanged == '1' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
status: ${{ steps.status.outputs.status }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix: ${{ fromJSON(needs.prepare.outputs.multisrcMatrix) }}
|
matrix: ${{ fromJSON(needs.prepare.outputs.multisrcMatrix) }}
|
||||||
steps:
|
steps:
|
||||||
@ -127,11 +129,19 @@ jobs:
|
|||||||
arguments: assembleDebug
|
arguments: assembleDebug
|
||||||
cache-read-only: true
|
cache-read-only: true
|
||||||
|
|
||||||
|
- name: Set status output
|
||||||
|
id: status
|
||||||
|
if: ${{ success() }}
|
||||||
|
run: |
|
||||||
|
echo "status=success" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
build_individual:
|
build_individual:
|
||||||
name: Build individual modules
|
name: Build individual modules
|
||||||
needs: prepare
|
needs: prepare
|
||||||
if: ${{ needs.prepare.outputs.isIndividualChanged == '1' }}
|
if: ${{ needs.prepare.outputs.isIndividualChanged == '1' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
status: ${{ steps.status.outputs.status }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix: ${{ fromJSON(needs.prepare.outputs.individualMatrix) }}
|
matrix: ${{ fromJSON(needs.prepare.outputs.individualMatrix) }}
|
||||||
steps:
|
steps:
|
||||||
@ -152,3 +162,36 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
arguments: assembleDebug
|
arguments: assembleDebug
|
||||||
cache-read-only: true
|
cache-read-only: true
|
||||||
|
|
||||||
|
- name: Set status output
|
||||||
|
id: status
|
||||||
|
if: ${{ success() }}
|
||||||
|
run: |
|
||||||
|
echo "status=success" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
status:
|
||||||
|
name: Workflow status
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ always() }}
|
||||||
|
needs: [prepare, build_individual, build_multisrc]
|
||||||
|
steps:
|
||||||
|
- name: Set the status of this workflow (used for branch protection rules)
|
||||||
|
env:
|
||||||
|
INDIVIDUAL_CHANGED: ${{ needs.prepare.outputs.isIndividualChanged }}
|
||||||
|
MULTISRC_CHANGED: ${{ needs.prepare.outputs.isMultisrcChanged }}
|
||||||
|
STATUS_INDIVIDUAL: ${{needs.build_individual.outputs.status}}
|
||||||
|
STATUS_MULTISRC: ${{needs.build_multisrc.outputs.status}}
|
||||||
|
uses: actions/github-script@v6
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const isIndividualChanged = process.env.INDIVIDUAL_CHANGED == '1';
|
||||||
|
const isMultisrcChanged = process.env.MULTISRC_CHANGED == '1';
|
||||||
|
|
||||||
|
const individualStatus = !isIndividualChanged || process.env.STATUS_INDIVIDUAL == 'success';
|
||||||
|
const multisrcStatus = !isMultisrcChanged || process.env.STATUS_MULTISRC == 'success';
|
||||||
|
|
||||||
|
const success = individualStatus && multisrcStatus;
|
||||||
|
|
||||||
|
if (!success) {
|
||||||
|
core.setFailed('Build failed');
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user