diff --git a/.gitea/workflows/build-feature.yml b/.gitea/workflows/build-feature.yml index bf707c5..23274b8 100644 --- a/.gitea/workflows/build-feature.yml +++ b/.gitea/workflows/build-feature.yml @@ -28,25 +28,43 @@ jobs: path: .ci - name: Run bats tests - continue-on-error: true + id: bats-tests shell: bash run: | mkdir -p "reports/${GITHUB_SHA:0:8}/bats" - docker run --rm -v "$PWD:/code" ${{ inputs.bats-image }} /code/tests/*.bats > "reports/${GITHUB_SHA:0:8}/bats/results.txt" 2>&1 || true - if ls tests/*.bats 1> /dev/null 2>&1; then - docker run --rm -v "$PWD:/code" ${{ inputs.bats-image }} --formatter junit /code/tests/*.bats > "reports/${GITHUB_SHA:0:8}/bats/junit.xml" 2>&1 || true - fi + set +e + docker run --rm -v "$PWD:/code" ${{ inputs.bats-image }} /code/tests/*.bats \ + > "reports/${GITHUB_SHA:0:8}/bats/results.txt" 2>&1 + BATS_EXIT=$? + { + echo "

Bats tests

" + } > "reports/${GITHUB_SHA:0:8}/bats/index.html" + echo "BATS_EXIT=${BATS_EXIT}" >> "${GITHUB_ENV}" + exit ${BATS_EXIT} - name: Publish bats reports + if: always() shell: bash run: | bash .ci/scripts/publish-git-pages.sh "reports/${GITHUB_SHA:0:8}/bats" - name: Set bats commit status + if: always() shell: bash run: | - bash .ci/scripts/report-status.sh success \ - "Bats tests" \ + if [ "${BATS_EXIT}" = "0" ]; then + STATUS="success" + DESC="Bats tests" + else + STATUS="failure" + DESC="Bats tests FAILED" + fi + bash .ci/scripts/report-status.sh "$STATUS" \ + "$DESC" \ "https://${PAGES_HOST}/${GITHUB_REPOSITORY}/reports/${GITHUB_SHA:0:8}/bats/" \ ci-bats