bats moun non read only
This commit is contained in:
@@ -11,6 +11,7 @@ jobs:
|
|||||||
config_path: .gitea/workflows/gitea-env.conf
|
config_path: .gitea/workflows/gitea-env.conf
|
||||||
|
|
||||||
feature:
|
feature:
|
||||||
|
name: Quality Gate
|
||||||
if: github.ref != 'refs/heads/main'
|
if: github.ref != 'refs/heads/main'
|
||||||
needs: [load-config]
|
needs: [load-config]
|
||||||
uses: niko/gitea-ci-library/.gitea/workflows/quality-gate.yml@feture/docker-kyky
|
uses: niko/gitea-ci-library/.gitea/workflows/quality-gate.yml@feture/docker-kyky
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ jobs:
|
|||||||
set +e
|
set +e
|
||||||
mkdir -p "reports/${GITHUB_SHA:0:8}/bats"
|
mkdir -p "reports/${GITHUB_SHA:0:8}/bats"
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
-v "$(pwd):/repo:ro" \
|
-v "$(pwd):/repo" \
|
||||||
-v "$(pwd)/reports/${GITHUB_SHA:0:8}/bats:/reports" \
|
-v "$(pwd)/reports/${GITHUB_SHA:0:8}/bats:/reports" \
|
||||||
-w /repo \
|
-w /repo \
|
||||||
--entrypoint bash ${{ inputs.bats-image }} \
|
--entrypoint bash ${{ inputs.bats-image }} \
|
||||||
@@ -95,17 +95,7 @@ jobs:
|
|||||||
--format json:"reports/${GITHUB_SHA:0:8}/cucumber/report.json" \
|
--format json:"reports/${GITHUB_SHA:0:8}/cucumber/report.json" \
|
||||||
--format html:"reports/${GITHUB_SHA:0:8}/cucumber/index.html" 2>&1
|
--format html:"reports/${GITHUB_SHA:0:8}/cucumber/index.html" 2>&1
|
||||||
CUCUMBER_EXIT=$?
|
CUCUMBER_EXIT=$?
|
||||||
echo "CUCUMBER_EXIT=${CUCUMBER_EXIT}" >> "${GITHUB_ENV}"
|
|
||||||
exit ${CUCUMBER_EXIT}
|
|
||||||
|
|
||||||
- name: Publish cucumber reports
|
|
||||||
if: always()
|
|
||||||
run: bash .ci/scripts/publish-git-pages.sh cucumber
|
|
||||||
|
|
||||||
- name: Set cucumber commit status
|
|
||||||
if: always()
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
STATE="success"
|
STATE="success"
|
||||||
[ "${CUCUMBER_EXIT}" != "0" ] && STATE="failure"
|
[ "${CUCUMBER_EXIT}" != "0" ] && STATE="failure"
|
||||||
if [ -f "reports/${GITHUB_SHA:0:8}/cucumber/index.html" ]; then
|
if [ -f "reports/${GITHUB_SHA:0:8}/cucumber/index.html" ]; then
|
||||||
@@ -114,6 +104,12 @@ jobs:
|
|||||||
bash .ci/scripts/report-status.sh "${STATE}" "Cucumber tests" ci-cucumber
|
bash .ci/scripts/report-status.sh "${STATE}" "Cucumber tests" ci-cucumber
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
exit ${CUCUMBER_EXIT}
|
||||||
|
|
||||||
|
- name: Publish cucumber reports
|
||||||
|
if: always()
|
||||||
|
run: bash .ci/scripts/publish-git-pages.sh cucumber
|
||||||
|
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [bats, cucumber]
|
needs: [bats, cucumber]
|
||||||
|
|||||||
@@ -111,7 +111,43 @@ Avainkomponentit:
|
|||||||
- Jokainen testisetti omassa jobissaan
|
- Jokainen testisetti omassa jobissaan
|
||||||
- Finalize/build voi kerätä yhteenvedon (ei julkaista summarya jos kenelläkään ei ole linkkiä)
|
- Finalize/build voi kerätä yhteenvedon (ei julkaista summarya jos kenelläkään ei ole linkkiä)
|
||||||
|
|
||||||
## 7. Inline Logic Threshold
|
## 7. Commit Status Before Exit
|
||||||
|
|
||||||
|
Commit status (`ci-bats`, `ci-cucumber`) on asetettava **ennen** stepin
|
||||||
|
`exit`-komentoa, samassa shell-prosessissa. Ei `GITHUB_ENV`-propagointiin
|
||||||
|
luottamista stepien välillä — Gitea Actions ei välttämättä prosessoi
|
||||||
|
`GITHUB_ENV`-tiedostoa epäonnistuneen stepin jälkeen.
|
||||||
|
|
||||||
|
Käytäntö testi-stepissä:
|
||||||
|
|
||||||
|
```
|
||||||
|
testit_ajoon
|
||||||
|
EXIT=$?
|
||||||
|
|
||||||
|
STATE="success"
|
||||||
|
[ "${EXIT}" != "0" ] && STATE="failure"
|
||||||
|
|
||||||
|
# Jos raportti on kirjoitettu levylle → linkki git-pagesiin
|
||||||
|
if [ -f "reports/${SHA8}/sute/index.html" ]; then
|
||||||
|
bash .ci/scripts/report-status.sh "${STATE}" "Kuvaus" ci-{suite} {suite}
|
||||||
|
else
|
||||||
|
# Muuten linkki Gitea Actions logiin
|
||||||
|
bash .ci/scripts/report-status.sh "${STATE}" "Kuvaus" ci-{suite}
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit ${EXIT}
|
||||||
|
```
|
||||||
|
|
||||||
|
Tämä takaa:
|
||||||
|
|
||||||
|
- Aina commit status riippumatta siitä, onko kyseessä tool- vai test error
|
||||||
|
- Oikea URL: raportti git-pagesissa (jos tiedosto on kirjoitettu) tai Gitea Actions logeissa
|
||||||
|
- PR merge-esto toimii luotettavasti: branch protection näkee statuksen
|
||||||
|
aina, koska se kirjoitetaan ennen stepin failaamista
|
||||||
|
|
||||||
|
Julkaisu (`publish-git-pages.sh`) jää edelleen omaksi stepikseen `if: always()`:lla.
|
||||||
|
|
||||||
|
## 8. Inline Logic Threshold
|
||||||
|
|
||||||
Logiikka workflow YAML:ssa on hauras: YAML:n sisennys, heredocit ja
|
Logiikka workflow YAML:ssa on hauras: YAML:n sisennys, heredocit ja
|
||||||
kenoviivat tuottavat helposti toimimattomia steppejä.
|
kenoviivat tuottavat helposti toimimattomia steppejä.
|
||||||
|
|||||||
Reference in New Issue
Block a user