post process vain 1 asia per steppi
CI Feature / Load example-gitea-env.conf to pipeline env (push) Successful in 19s
unit-tests Link to Bats reports
CI Feature / Bats tests (push) Successful in 1m26s
acc-tests Link to Cucumber reports
CI Feature / Cucumber tests (push) Successful in 51s
CI Feature / Report Summary (push) Successful in 5s
CI Feature / Load example-gitea-env.conf to pipeline env (push) Successful in 19s
unit-tests Link to Bats reports
CI Feature / Bats tests (push) Successful in 1m26s
acc-tests Link to Cucumber reports
CI Feature / Cucumber tests (push) Successful in 51s
CI Feature / Report Summary (push) Successful in 5s
This commit is contained in:
@@ -37,11 +37,13 @@ jobs:
|
|||||||
mkdir -p reports/bats
|
mkdir -p reports/bats
|
||||||
bashcov -- bats tests/ > reports/bats/results.txt 2>&1
|
bashcov -- bats tests/ > reports/bats/results.txt 2>&1
|
||||||
|
|
||||||
- name: Post-process reports
|
- name: Post-process coverage
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: bash .ci/.gitea/scripts/bats-coverage.sh reports/bats
|
||||||
bash .ci/.gitea/scripts/bats-coverage.sh reports/bats
|
|
||||||
bash .ci/.gitea/scripts/bats-report.sh reports/bats
|
- name: Post-process test report
|
||||||
|
if: always()
|
||||||
|
run: bash .ci/.gitea/scripts/bats-report.sh reports/bats
|
||||||
|
|
||||||
- name: Report
|
- name: Report
|
||||||
if: always()
|
if: always()
|
||||||
|
|||||||
@@ -102,6 +102,27 @@ ja exit-koodi välittyy natiivisti. Ylimääräistä `EXIT=$?` + `echo >> GITHUB
|
|||||||
`set -e` ei pelasta pipe-tilanteessa — `|` syö exit-koodin kuten ennenkin. Redirectillä exit-koodi
|
`set -e` ei pelasta pipe-tilanteessa — `|` syö exit-koodin kuten ennenkin. Redirectillä exit-koodi
|
||||||
välittyy luonnollisesti.
|
välittyy luonnollisesti.
|
||||||
|
|
||||||
|
**Yksi asia per step:** Älä koskaan niputa useaa post-process-komentoa samaan `run:`-blockiin.
|
||||||
|
`bash -e` pysäyttää koko stepin jos yksi komento epäonnistuu — seuraavat jäävät ajamatta.
|
||||||
|
Käytä erillisiä steppejä `if: always()`:lla, jotta jokainen vaihe ajetaan itsenäisesti:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# VÄÄRIN — jos coverage epäonnistuu, report jää generoimatta
|
||||||
|
- name: Post-process reports
|
||||||
|
run: |
|
||||||
|
bash .ci/.gitea/scripts/bats-coverage.sh reports/bats
|
||||||
|
bash .ci/.gitea/scripts/bats-report.sh reports/bats
|
||||||
|
|
||||||
|
# OIKEIN — erilliset stepit if: always()
|
||||||
|
- name: Post-process coverage
|
||||||
|
if: always()
|
||||||
|
run: bash .ci/.gitea/scripts/bats-coverage.sh reports/bats
|
||||||
|
|
||||||
|
- name: Post-process test report
|
||||||
|
if: always()
|
||||||
|
run: bash .ci/.gitea/scripts/bats-report.sh reports/bats
|
||||||
|
```
|
||||||
|
|
||||||
## 4. Konttipolitiikka
|
## 4. Konttipolitiikka
|
||||||
|
|
||||||
1. **Julkiset registry-kontit kiinteällä versiolla** — `alpine/helm:3.19.0`, `node:22`, `maven:3.9-eclipse-temurin-21`.
|
1. **Julkiset registry-kontit kiinteällä versiolla** — `alpine/helm:3.19.0`, `node:22`, `maven:3.9-eclipse-temurin-21`.
|
||||||
@@ -182,7 +203,8 @@ Kun testi tuottaa raportit suoraan (kuten `pytest --html` tai `cucumber-js --for
|
|||||||
### Taso 2: Jälkikäsittely tarvitaan
|
### Taso 2: Jälkikäsittely tarvitaan
|
||||||
|
|
||||||
Kun testi tuottaa raakadataa (stdout, coverage-tiedostot) joka pitää muuntaa tai siirtää
|
Kun testi tuottaa raakadataa (stdout, coverage-tiedostot) joka pitää muuntaa tai siirtää
|
||||||
`reports/<suite>/`-hakemistoon, käytetään Post-process-steppiä:
|
`reports/<suite>/`-hakemistoon, käytetään Post-process-steppejä. **Jokainen operaatio
|
||||||
|
omassa stepissään** — älä koskaan niputa useaa post-process-komentoa samaan `run:`-blockiin:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
@@ -191,17 +213,24 @@ Kun testi tuottaa raakadataa (stdout, coverage-tiedostot) joka pitää muuntaa t
|
|||||||
mkdir -p "reports/<suite>"
|
mkdir -p "reports/<suite>"
|
||||||
<testikomento> > "reports/<suite>/results.txt" 2>&1
|
<testikomento> > "reports/<suite>/results.txt" 2>&1
|
||||||
|
|
||||||
- name: Post-process reports
|
- name: Post-process coverage
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: <coverage-extraktio>
|
||||||
<coverage-extraktio>
|
|
||||||
<HTML-generointi raa'asta outputista>
|
- name: Post-process test report
|
||||||
|
if: always()
|
||||||
|
run: <HTML-generointi raa'asta outputista>
|
||||||
|
|
||||||
- name: Report
|
- name: Report
|
||||||
if: always()
|
if: always()
|
||||||
run: bash .ci/scripts/ci-report.sh "<kuvaus>" <context> <suite>
|
run: bash .ci/scripts/ci-report.sh "<kuvaus>" <context> <suite>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Miksi:** Gitea Actions käyttää `bash -e`-oletusta. Jos yksi post-process-komento
|
||||||
|
epäonnistuu (esim. `set -euo pipefail`-skripti), koko stepi pysähtyy eivätkä seuraavat
|
||||||
|
komennot käynnisty — raportti jää julkaisematta. Erilliset stepit `if: always()` takaavat
|
||||||
|
että jokainen post-process-vaihe ajetaan itsenäisesti.
|
||||||
|
|
||||||
**Malli:** `example-bats-tests.yml`.
|
**Malli:** `example-bats-tests.yml`.
|
||||||
|
|
||||||
### Monta raportoitavaa tiedostoa
|
### Monta raportoitavaa tiedostoa
|
||||||
|
|||||||
Reference in New Issue
Block a user