POC: test reusable workflow job visibility in Gitea Actions
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
# ci-engine-test.yml — POC: testaa kuinka Gitea raportoi reusable workflow'n jobit
|
||||
#
|
||||
# Tämä on väliaikainen testimoottori. Poistetaan POC:n jälkeen.
|
||||
# Tarkistetaan näkyykö commitissa:
|
||||
# - ci-engine-test.yml / hello-one
|
||||
# - ci-engine-test.yml / hello-two
|
||||
# vai pelkkä yksi check kutsuvan jobin nimellä.
|
||||
|
||||
name: CI Engine Test
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
hello-one:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: echo "hello one"
|
||||
|
||||
hello-two:
|
||||
needs: hello-one
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: echo "hello two"
|
||||
+5
-13
@@ -1,12 +1,10 @@
|
||||
# .gitea/workflows/ci.yml — Kirjaston oma CI (eat your own dogfood)
|
||||
#
|
||||
# Tämä workflow on kirjaston ENSIMMÄINEN kuluttaja.
|
||||
# Jokainen push ajaa kirjaston omat reusable workflowt:
|
||||
# - feature-branch → ci-feature.yml
|
||||
# - master-branch → ci-master.yml
|
||||
# Jokainen push ajaa kirjaston omat reusable workflowt.
|
||||
#
|
||||
# Näin kirjasto testaa itse itsensä — sama mekanismi
|
||||
# kuin mitä mikropalvelut käyttävät.
|
||||
# POC: testataan ci-engine-test.yml — nähdään miten Gitea
|
||||
# raportoi reusable workflow'n sisäiset jobit.
|
||||
|
||||
name: CI — gitea-ci-library
|
||||
|
||||
@@ -16,18 +14,12 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
# --- Feature-branch: testit + raportit, ei konttia ---
|
||||
feature:
|
||||
if: github.ref != 'refs/heads/master'
|
||||
uses: ./.gitea/workflows/ci-feature.yml
|
||||
uses: ./.gitea/workflows/ci-engine-test.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
config-file: ci-flow-values.yaml
|
||||
|
||||
# --- Master-branch: build + kontti + test flow ---
|
||||
master:
|
||||
if: github.ref == 'refs/heads/master'
|
||||
uses: ./.gitea/workflows/ci-master.yml
|
||||
uses: ./.gitea/workflows/ci-engine-test.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
config-file: ci-flow-values.yaml
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# Ticket 0006: `ci-feature.yml` (reusable workflow)
|
||||
# Ticket 0006: Pipeline as conf
|
||||
|
||||
**Vaihe:** 6/12
|
||||
**Status:** pending
|
||||
**Feature branch:** `feature/0006-ci-feature-yml`
|
||||
**Feature branch:** `feature/0006-pipeline-as-conf`
|
||||
**TDD required:** Yes
|
||||
**Feature file required:** Yes
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
- `tests/features/0006-ci-feature.feature`
|
||||
- Skills: `tdd`, `implementation`, `clean-code`
|
||||
|
||||
**Pre-requisite (estotiketti):**
|
||||
- Pipeline-as-conf -suunnitelma (`docs/tickets/0006-plan.md` tai vastaava) on valmis ja hyväksytty. Toteutusta ei aloiteta ennen kuin `ci-flow-values.yaml`-skeema ja `ci-feature.yml`-jobirakenne on suunniteltu.
|
||||
|
||||
---
|
||||
|
||||
## TDD — Red-Green-Refactor + Dogfood
|
||||
@@ -27,7 +30,7 @@ bats tests/workflows.bats
|
||||
```
|
||||
|
||||
### Green
|
||||
Toteuta `gitea/workflows/ci-feature.yml`.
|
||||
Toteuta `.gitea/workflows/ci-feature.yml`.
|
||||
|
||||
```bash
|
||||
bats tests/workflows.bats
|
||||
@@ -35,12 +38,12 @@ bats tests/workflows.bats
|
||||
```
|
||||
|
||||
### Dogfood
|
||||
Lisää kutsu `gitea/workflows/ci.yml`:stä:
|
||||
Lisää kutsu `.gitea/workflows/ci.yml`:stä:
|
||||
|
||||
```yaml
|
||||
feature:
|
||||
if: github.ref != 'refs/heads/master'
|
||||
uses: ./gitea/workflows/ci-feature.yml@main
|
||||
uses: ./.gitea/workflows/ci-feature.yml
|
||||
```
|
||||
|
||||
Jokainen push feature-branchiin ajaa `ci-feature.yml`:n.
|
||||
@@ -48,16 +51,19 @@ Jokainen push feature-branchiin ajaa `ci-feature.yml`:n.
|
||||
## DoD
|
||||
- [ ] Cucumber: `@ticket-0006 and @mock` → kaikki skenaariot GREEN
|
||||
- [ ] `tests/workflows.bats` — YAML-validointi läpi
|
||||
- [ ] Kaikki stepit määritelty: start → unit-test → code-coverage → publish-html → end
|
||||
- [ ] 4 jobia: `start` → `unit-test` → `code-coverage` → `end`
|
||||
- [ ] `concurrency` estää rinnakkaiset ajot samalle branchille
|
||||
- [ ] Dogfood: kirjaston oma CI käyttää tätä workflow'ta
|
||||
- [ ] Statusviestit raportoivat jokaisen stepin tilan
|
||||
- [ ] Jokainen job postaa oman commit-statuksen `report-status.sh`:lla (eri `context`-avain per job)
|
||||
- [ ] Branch protection: `ci/unit-test` ja `ci/code-coverage` näkyvät erillisinä checkeinä
|
||||
|
||||
---
|
||||
|
||||
## Toiminto
|
||||
|
||||
Feature-branchin CI-workflow. Kutsuu `report-status.sh` ja `push-reports.sh` (Ticket 0001 ja 0003).
|
||||
Feature-branchin CI-workflow. Kutsuu vain `report-status.sh`:ta (Ticket 0001). Ei raporttien julkaisua MinIO:hon.
|
||||
|
||||
**Huom:** Raporttien julkaisu (`push-reports.sh`) lisätään erillisessä tiketissä (0013).
|
||||
|
||||
## Trigger
|
||||
|
||||
@@ -71,20 +77,18 @@ Feature-branchin CI-workflow. Kutsuu `report-status.sh` ja `push-reports.sh` (Ti
|
||||
| `maven-image` | Ei | Maven-kontti (esim. `maven:3.9-eclipse-temurin-21`) |
|
||||
| `node-image` | Ei | Node-kontti (npm-projektit) |
|
||||
|
||||
## Steppit
|
||||
## Steppit (4 jobia, jokainen oma check)
|
||||
|
||||
```
|
||||
start → unit-test → code-coverage → publish-html → end
|
||||
start → unit-test → code-coverage → end
|
||||
```
|
||||
|
||||
| Steppi | Skripti | Status |
|
||||
|--------|---------|--------|
|
||||
| `start` | `report-status.sh pending "Building..."` | INPROGRESS |
|
||||
| `unit-test` | Projektin oma testiajo | — |
|
||||
| `code-coverage` | JaCoCo / vastaava | — |
|
||||
| `publish-html` | `push-reports.sh cucumber; push-reports.sh jacoco` | — |
|
||||
| `end` | `report-status.sh success/failure` | Lopullinen status |
|
||||
| `fail` (catch) | `report-status.sh failure` | FAILURE |
|
||||
| Job | `context` | Toiminto |
|
||||
|-----|-----------|----------|
|
||||
| `start` | `ci/start` | `report-status.sh pending "Build started"` |
|
||||
| `unit-test` | `ci/unit-test` | Projektin oma testiajo → `report-status.sh success/failure` |
|
||||
| `code-coverage` | `ci/code-coverage` | JaCoCo / vastaava → `report-status.sh success/failure` |
|
||||
| `end` | `ci/end` | `report-status.sh success/failure` (kokonaistulos) |
|
||||
|
||||
## Concurrency
|
||||
|
||||
@@ -97,10 +101,10 @@ concurrency:
|
||||
## Verifiointi
|
||||
|
||||
Simuloi paikallisesti (act-runner tai manuaalinen steppien ajo):
|
||||
1. `report-status.sh pending` → commitin status = pending
|
||||
2. Testit ajetaan
|
||||
3. `push-reports.sh` → raportit MinIO:ssa
|
||||
4. `report-status.sh success` → statusviesti + URL
|
||||
1. `report-status.sh pending` → commitin status = pending (`ci/start`)
|
||||
2. Testit ajetaan → `ci/unit-test` = success/failure
|
||||
3. Coverage ajetaan → `ci/code-coverage` = success/failure
|
||||
4. `report-status.sh success/failure` → `ci/end` = lopullinen status
|
||||
|
||||
## Viitteet
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
# Ticket 0013: Raporttien julkaisu `ci-feature.yml`:ään
|
||||
|
||||
**Vaihe:** 13 (riippuu 0003 ja 0005)
|
||||
**Status:** pending
|
||||
**Feature branch:** `feature/0013-ci-feature-report-publish`
|
||||
**TDD required:** Yes
|
||||
**Feature file required:** Yes
|
||||
|
||||
**Required context:**
|
||||
- `docs/test-plan/tdd-guide.md`
|
||||
- `tests/features/0013-ci-feature-report-publish.feature`
|
||||
- Skills: `tdd`, `implementation`, `clean-code`
|
||||
|
||||
**Pre-requisite (estotiketti):**
|
||||
- Tiketti 0003 (`push-reports.sh`) — valmis
|
||||
- Tiketti 0005 (`report-service/generate-index.sh`) — valmis
|
||||
- Tiketti 0006 (`ci-feature.yml`) — valmis (perusstepit ilman raportteja)
|
||||
|
||||
---
|
||||
|
||||
## TDD — Red-Green-Refactor
|
||||
|
||||
### Red
|
||||
Ennen muutoksia, kirjoita validointitestit (`tests/workflows.bats`):
|
||||
- `publish-html`-job lisätty `ci-feature.yml`:ään
|
||||
- `push-reports.sh`-kutsut oikeilla parametreilla
|
||||
- `end`-jobin URL-parametri sisältää raportti-URL:n
|
||||
|
||||
```bash
|
||||
bats tests/workflows.bats
|
||||
# FAIL: publish-html -steppiä ei ole
|
||||
```
|
||||
|
||||
### Green
|
||||
Lisää `publish-html`-job `ci-feature.yml`:ään.
|
||||
|
||||
```bash
|
||||
bats tests/workflows.bats
|
||||
# PASS
|
||||
```
|
||||
|
||||
## DoD
|
||||
- [ ] Cucumber: `@ticket-0013 and @mock` → kaikki skenaariot GREEN
|
||||
- [ ] `tests/workflows.bats` — YAML-validointi läpi
|
||||
- [ ] `publish-html`-job puskaa raportit MinIO:hon
|
||||
- [ ] `end`-jobin statusviesti sisältää raportti-URL:n
|
||||
- [ ] `ci-flow-values.yaml`-skeema tukee raporttityyppejä (`cucumber`, `jacoco`, `site`)
|
||||
|
||||
---
|
||||
|
||||
## Toiminto
|
||||
|
||||
Lisää `ci-feature.yml`:ään `publish-html`-job, joka kutsuu `push-reports.sh`:ta (Ticket 0003) jokaiselle raporttityypille. Raporttityypit konfiguroidaan `ci-flow-values.yaml`:ssa.
|
||||
|
||||
## Muutokset `ci-feature.yml`:ään
|
||||
|
||||
Uusi steppijärjestys:
|
||||
|
||||
```
|
||||
start → unit-test → code-coverage → publish-html → end
|
||||
```
|
||||
|
||||
| Job | `context` | Toiminto |
|
||||
|-----|-----------|----------|
|
||||
| `start` | `ci/start` | `report-status.sh pending` |
|
||||
| `unit-test` | `ci/unit-test` | Projektin oma testiajo |
|
||||
| `code-coverage` | `ci/code-coverage` | JaCoCo / vastaava |
|
||||
| `publish-html` | `ci/publish-html` | `push-reports.sh` jokaiselle raporttityypille |
|
||||
| `end` | `ci/end` | `report-status.sh success/failure` + raportti-URL |
|
||||
|
||||
## `ci-flow-values.yaml`-laajennus
|
||||
|
||||
```yaml
|
||||
build:
|
||||
ecosystem: maven
|
||||
java-version: "21"
|
||||
|
||||
test:
|
||||
unit: "mvn test"
|
||||
coverage: "mvn jacoco:report"
|
||||
|
||||
reports:
|
||||
- type: cucumber
|
||||
source: target/cucumber-report
|
||||
- type: jacoco
|
||||
source: target/site/jacoco
|
||||
- type: site
|
||||
source: target/site
|
||||
```
|
||||
|
||||
## Verifiointi
|
||||
|
||||
1. `push-reports.sh cucumber target/cucumber-report` → onnistuu
|
||||
2. `push-reports.sh jacoco target/site/jacoco` → onnistuu
|
||||
3. `end`-jobin statusviestin URL osoittaa raporttiin
|
||||
|
||||
## Viitteet
|
||||
|
||||
- `docs/tickets/0003-push-reports-sh.md` — `push-reports.sh`
|
||||
- `docs/tickets/0005-report-service-index-generation.md` — `generate-index.sh`
|
||||
- `docs/tickets/0006-pipeline-as-conf.md` — Pipeline as conf (perusstepit)
|
||||
- `docs/report-hosting.md` — Raporttien URL-rakenne
|
||||
Reference in New Issue
Block a user