diff --git a/.gitea/workflows/build-feature.yml b/.gitea/workflows/build-feature.yml
index 23274b8..9b6698d 100644
--- a/.gitea/workflows/build-feature.yml
+++ b/.gitea/workflows/build-feature.yml
@@ -27,7 +27,15 @@ jobs:
repository: niko/gitea-ci-library
path: .ci
+ - name: Prepare bats
+ id: prepare-bats
+ shell: bash
+ run: |
+ docker run --rm ${{ inputs.bats-image }} --help
+ echo "TOOL_OK=true" >> "${GITHUB_ENV}"
+
- name: Run bats tests
+ if: env.TOOL_OK == 'true'
id: bats-tests
shell: bash
run: |
@@ -39,7 +47,9 @@ jobs:
{
echo "
Bats tests
"
for f in reports/${GITHUB_SHA:0:8}/bats/*; do
- echo "- $(basename $f)
"
+ b="$(basename $f)"
+ [ "$b" = "index.html" ] && continue
+ echo "- $b
"
done
echo "
"
} > "reports/${GITHUB_SHA:0:8}/bats/index.html"
@@ -47,7 +57,7 @@ jobs:
exit ${BATS_EXIT}
- name: Publish bats reports
- if: always()
+ if: env.TOOL_OK == 'true'
shell: bash
run: |
bash .ci/scripts/publish-git-pages.sh "reports/${GITHUB_SHA:0:8}/bats"
@@ -56,17 +66,20 @@ jobs:
if: always()
shell: bash
run: |
- if [ "${BATS_EXIT}" = "0" ]; then
+ if [ "${TOOL_OK}" != "true" ]; then
+ STATUS="failure"
+ DESC="Bats tool unavailable"
+ URL="https://gitea.app.keskikuja.site/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
+ elif [ "${BATS_EXIT}" = "0" ]; then
STATUS="success"
DESC="Bats tests"
+ URL="https://${PAGES_HOST}/${GITHUB_REPOSITORY}/reports/${GITHUB_SHA:0:8}/bats/"
else
STATUS="failure"
DESC="Bats tests FAILED"
+ URL="https://${PAGES_HOST}/${GITHUB_REPOSITORY}/reports/${GITHUB_SHA:0:8}/bats/"
fi
- bash .ci/scripts/report-status.sh "$STATUS" \
- "$DESC" \
- "https://${PAGES_HOST}/${GITHUB_REPOSITORY}/reports/${GITHUB_SHA:0:8}/bats/" \
- ci-bats
+ bash .ci/scripts/report-status.sh "$STATUS" "$DESC" "$URL" ci-bats
cucumber:
runs-on: ubuntu-latest
@@ -85,7 +98,15 @@ jobs:
repository: niko/gitea-ci-library
path: .ci
+ - name: Prepare cucumber
+ id: prepare-cucumber
+ shell: bash
+ run: |
+ npx --package @cucumber/cucumber cucumber-js --help
+ echo "TOOL_OK=true" >> "${GITHUB_ENV}"
+
- name: Run cucumber tests
+ if: env.TOOL_OK == 'true'
id: cucumber-tests
shell: bash
run: |
@@ -99,7 +120,7 @@ jobs:
exit ${CUCUMBER_EXIT}
- name: Publish cucumber reports
- if: always()
+ if: env.TOOL_OK == 'true'
shell: bash
run: |
bash .ci/scripts/publish-git-pages.sh "reports/${GITHUB_SHA:0:8}/cucumber"
@@ -108,17 +129,20 @@ jobs:
if: always()
shell: bash
run: |
- if [ "${CUCUMBER_EXIT}" = "0" ]; then
+ if [ "${TOOL_OK}" != "true" ]; then
+ STATUS="failure"
+ DESC="Cucumber tool unavailable"
+ URL="https://gitea.app.keskikuja.site/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
+ elif [ "${CUCUMBER_EXIT}" = "0" ]; then
STATUS="success"
DESC="Cucumber tests passed"
+ URL="https://${PAGES_HOST}/${GITHUB_REPOSITORY}/reports/${GITHUB_SHA:0:8}/cucumber/"
else
STATUS="failure"
DESC="Cucumber tests FAILED"
+ URL="https://${PAGES_HOST}/${GITHUB_REPOSITORY}/reports/${GITHUB_SHA:0:8}/cucumber/"
fi
- bash .ci/scripts/report-status.sh "$STATUS" \
- "$DESC" \
- "https://${PAGES_HOST}/${GITHUB_REPOSITORY}/reports/${GITHUB_SHA:0:8}/cucumber/" \
- ci-cucumber
+ bash .ci/scripts/report-status.sh "$STATUS" "$DESC" "$URL" ci-cucumber
build:
runs-on: ubuntu-latest