bats feilaa myös!
This commit is contained in:
@@ -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 "<html><body><h1>Bats tests</h1><ul>"
|
||||
for f in reports/${GITHUB_SHA:0:8}/bats/*; do
|
||||
echo "<li><a href=\"$(basename $f)\">$(basename $f)</a></li>"
|
||||
done
|
||||
echo "</ul></body></html>"
|
||||
} > "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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user