diff --git a/.gitea/workflows/quality-gate.yml b/.gitea/workflows/quality-gate.yml index 720b9a6..67100b1 100644 --- a/.gitea/workflows/quality-gate.yml +++ b/.gitea/workflows/quality-gate.yml @@ -49,31 +49,35 @@ jobs: id: bats-tests shell: bash run: | - set +e - set -o pipefail + docker volume create bats-workspace + tar c . | docker run --rm -i -v bats-workspace:/data alpine tar x -C /data mkdir -p "reports/${GITHUB_SHA:0:8}/bats" - tar cf - . | docker run --rm -i \ + set +e + docker run --rm \ + -v bats-workspace:/data \ --entrypoint bash ${{ inputs.bats-image }} \ - -c ' - mkdir -p /repo - tar xf - -C /repo - cd /repo - apk add -q lsof python3 jq curl ruby - bats tests/ - ' 2>&1 | tee "reports/${GITHUB_SHA:0:8}/bats/results.txt" + -c 'apk add -q lsof python3 jq curl ruby && cd /data && bats tests/' \ + > "reports/${GITHUB_SHA:0:8}/bats/results.txt" 2>&1 BATS_EXIT=$? - bash .ci/.gitea/scripts/bats-report.sh "reports/${GITHUB_SHA:0:8}/bats" || true - - STATE="success" - [ "${BATS_EXIT}" != "0" ] && STATE="failure" - bash .ci/scripts/report-status.sh "${STATE}" "Bats tests" ci-bats - + bash .ci/.gitea/scripts/bats-coverage.sh bats-workspace "reports/${GITHUB_SHA:0:8}/bats" + docker volume rm bats-workspace > /dev/null 2>&1 + bash .ci/.gitea/scripts/bats-report.sh "reports/${GITHUB_SHA:0:8}/bats" + echo "BATS_EXIT=${BATS_EXIT}" >> "${GITHUB_ENV}" exit ${BATS_EXIT} - name: Publish bats reports if: always() run: bash .ci/scripts/publish-git-pages.sh bats + - name: Set bats commit status + if: always() + run: | + if [ "${BATS_EXIT}" = "0" ]; then + bash .ci/scripts/report-status.sh success "Bats tests" ci-bats bats + else + bash .ci/scripts/report-status.sh failure "Bats tests FAILED" ci-bats bats + fi + cucumber: runs-on: ubuntu-latest container: