tiketit ja featuret vaihe 1
CI — gitea-ci-library / feature (push) Failing after 1s
CI — gitea-ci-library / master (push) Has been skipped

This commit is contained in:
moilanik
2026-06-08 09:34:47 +03:00
parent 2f1e983c9d
commit 9a59cbc185
18 changed files with 1666 additions and 0 deletions
+108
View File
@@ -0,0 +1,108 @@
# Ticket 0006: `ci-feature.yml` (reusable workflow)
**Vaihe:** 6/12
**Status:** pending
**Feature branch:** `feature/0006-ci-feature-yml`
**TDD required:** Yes
**Feature file required:** Yes
**Required context:**
- `docs/test-plan/tdd-guide.md`
- `tests/features/0006-ci-feature.feature`
- Skills: `tdd`, `implementation`, `clean-code`
---
## TDD — Red-Green-Refactor + Dogfood
### Red
Ennen workflow'ta, kirjoita validointitestit (`tests/workflows.bats`):
- YAML-skeema: kaikki vaaditut `inputs` määritelty
- `concurrency`-ryhmä estää rinnakkaiset ajot
- `uses:`-viittaukset oikeisiin skripteihin
```bash
bats tests/workflows.bats
# FAIL: workflow-tiedostoa ei ole
```
### Green
Toteuta `gitea/workflows/ci-feature.yml`.
```bash
bats tests/workflows.bats
# PASS: YAML validi, skeema täsmää
```
### Dogfood
Lisää kutsu `gitea/workflows/ci.yml`:stä:
```yaml
feature:
if: github.ref != 'refs/heads/master'
uses: ./gitea/workflows/ci-feature.yml@main
```
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
- [ ] `concurrency` estää rinnakkaiset ajot samalle branchille
- [ ] Dogfood: kirjaston oma CI käyttää tätä workflow'ta
- [ ] Statusviestit raportoivat jokaisen stepin tilan
---
## Toiminto
Feature-branchin CI-workflow. Kutsuu `report-status.sh` ja `push-reports.sh` (Ticket 0001 ja 0003).
## Trigger
`workflow_call` (reusable workflow)
## Inputs
| Parametri | Pakollinen | Kuvaus |
|-----------|------------|--------|
| `config-file` | Kyllä | Polku `ci-flow-values.yaml`:aan |
| `maven-image` | Ei | Maven-kontti (esim. `maven:3.9-eclipse-temurin-21`) |
| `node-image` | Ei | Node-kontti (npm-projektit) |
## Steppit
```
start → unit-test → code-coverage → publish-html → 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 |
## Concurrency
```yaml
concurrency:
group: feature-${{ github.ref }}
cancel-in-progress: false
```
## 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
## Viitteet
- `docs/workflows.md``ci-feature.yml` — Feature-branch
- `docs/architecture.md` — Järjestelmäkaavio