fix: propagate tool errors through quality gate + cucumber shell fix
- Remove bashcov from CI bats job (crashed on read-only fs, masked BATS_EXIT)
- Remove stale bats-cov volume (no longer needed)
- Add shell: bash to commit-status steps (sh doesn't support ${VAR:0:8})
- set +e first in bats step to catch all errors (docker pull, apk, etc.)
- Tool error → BATS_EXIT != 0 → commit-status failure → PR merge blocked
This commit is contained in:
@@ -49,22 +49,16 @@ jobs:
|
||||
id: bats-tests
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p "reports/${GITHUB_SHA:0:8}/bats"
|
||||
docker volume create bats-cov
|
||||
set +e
|
||||
mkdir -p "reports/${GITHUB_SHA:0:8}/bats"
|
||||
docker run --rm \
|
||||
-v "$(pwd):/repo:ro" \
|
||||
-v bats-cov:/coverage \
|
||||
-v "$(pwd)/reports/${GITHUB_SHA:0:8}/bats:/reports" \
|
||||
-w /repo \
|
||||
-e COVERAGE_DIR=/coverage \
|
||||
--entrypoint bash ${{ inputs.bats-image }} \
|
||||
-c 'apk add -q lsof python3 jq curl ruby && \
|
||||
gem install bashcov -v 3.3.0 2>&1 | tail -1 && \
|
||||
bashcov -- bats tests/ | tee /reports/results.txt'
|
||||
bats tests/ | tee /reports/results.txt'
|
||||
BATS_EXIT=$?
|
||||
bash .ci/.gitea/scripts/bats-coverage.sh bats-cov "reports/${GITHUB_SHA:0:8}/bats" || true
|
||||
docker volume rm bats-cov > /dev/null 2>&1
|
||||
bash .ci/.gitea/scripts/bats-report.sh "reports/${GITHUB_SHA:0:8}/bats" || true
|
||||
echo "BATS_EXIT=${BATS_EXIT}" >> "${GITHUB_ENV}"
|
||||
exit ${BATS_EXIT}
|
||||
@@ -75,6 +69,7 @@ jobs:
|
||||
|
||||
- name: Set bats commit status
|
||||
if: always()
|
||||
shell: bash
|
||||
run: |
|
||||
STATE="success"
|
||||
[ "${BATS_EXIT}" != "0" ] && STATE="failure"
|
||||
@@ -116,6 +111,7 @@ jobs:
|
||||
|
||||
- name: Set cucumber commit status
|
||||
if: always()
|
||||
shell: bash
|
||||
run: |
|
||||
STATE="success"
|
||||
[ "${CUCUMBER_EXIT}" != "0" ] && STATE="failure"
|
||||
|
||||
Reference in New Issue
Block a user