Skip to content

Commit c540f38

Browse files
authored
Merge pull request #4 from ZestCommunity/fix/meson-setup-failure-not-exiting
Fix meson setup failure not exiting build script when it should
2 parents 37461a8 + 959b7e2 commit c540f38

File tree

3 files changed

+41
-4
lines changed

3 files changed

+41
-4
lines changed

.github/workflows/build-image.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,21 @@ jobs:
113113
repository: ["ZestCommunity/ZestCode"]
114114
ref: ["main"]
115115
caller_token: ["${{ github.token }}"]
116+
clone_repo: [true]
117+
expect_error: [false]
118+
include:
119+
# Specific case of setup command failure
120+
- write_job_summary: true
121+
clone_repo: false
122+
expect_error: true
123+
116124
with:
117125
write_job_summary: ${{ matrix.write_job_summary }}
118126
repository: ${{ matrix.repository }}
119127
ref: ${{ matrix.ref }}
120128
caller_token: ${{ matrix.caller_token }}
129+
clone_repo: ${{ matrix.clone_repo }}
130+
expect_error: ${{ matrix.expect_error }}
121131

122132
Upload_Image:
123133
name: Upload Docker Image to ghcr.io Registry

.github/workflows/test.yml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,37 @@ on:
1818
description: Whether to write the artifact URL to the job summary
1919
default: true
2020
type: boolean
21+
clone_repo:
22+
description: Whether to clone the repo
23+
default: true
24+
type: boolean
25+
expect_error:
26+
description: Whether to expect an error
27+
default: false
28+
type: boolean
2129

2230
jobs:
2331
test:
2432
name: "Testing Container: Write Job Summary?${{ inputs.write_job_summary }}"
2533
runs-on: ubuntu-latest
2634
steps:
27-
- name: Checkout
35+
- name: Print Inputs
36+
run: |
37+
echo "Inputs(repository): ${{ inputs.repository }}"
38+
echo "Inputs(ref): ${{ inputs.ref }}"
39+
echo "Inputs(caller_token): ${{ inputs.caller_token }}"
40+
echo "Inputs(write_job_summary): ${{ inputs.write_job_summary }}"
41+
echo "Inputs(clone_repo): ${{ inputs.clone_repo }}"
42+
echo "Inputs(expect_error): ${{ inputs.expect_error }}"
43+
44+
- name: Checkout Repository to Test
2845
uses: actions/checkout@v4
46+
if: ${{ inputs.clone_repo }}
2947
with:
3048
repository: ${{ inputs.repository }}
3149
ref: ${{ inputs.ref }}
3250

33-
- name: Checkout
51+
- name: Checkout Action
3452
uses: actions/checkout@v4
3553
with:
3654
path: ./action/
@@ -55,6 +73,16 @@ jobs:
5573
- name: Test Action
5674
id: test-action
5775
uses: ./action/
58-
continue-on-error: False
76+
continue-on-error: ${{ inputs.expect_error }}
5977
with:
6078
write_job_summary: ${{ inputs.write_job_summary }}
79+
80+
- name: Check for Failure If Expected
81+
if: ${{ inputs.expect_error }}
82+
run: |
83+
if [ "${{ (steps.test-action.outcome == 'success') }}" == "true" ]; then
84+
echo "Test Action step succeeded when it was expected to fail. Failing job.."
85+
exit 1
86+
else
87+
echo "Test Action step failed as expected."
88+
fi

build-tools/build.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ git config --global --add safe.directory /github/workspace
3030
COMPILE_STD_OUTPUT=$(mktemp)
3131
echo "::group::Build Project"
3232
meson setup --cross-file scripts/v5.ini build | tee $COMPILE_STD_OUTPUT
33-
echo "PIPESTATUS: ${PIPESTATUS[@]}"
3433
meson_exit_code=${PIPESTATUS[0]}
3534
echo "Meson setup exit code: $meson_exit_code"
3635
if [ $meson_exit_code -ne 0 ]; then

0 commit comments

Comments
 (0)