From 68fbd35ac2963fe73f5e7bd44e844a6cf9d85b39 Mon Sep 17 00:00:00 2001 From: moilanik Date: Tue, 16 Jun 2026 06:46:40 +0300 Subject: [PATCH 1/5] hello world manuaalisesti --- .gitea/workflows/example-manual-hello.yml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .gitea/workflows/example-manual-hello.yml diff --git a/.gitea/workflows/example-manual-hello.yml b/.gitea/workflows/example-manual-hello.yml new file mode 100644 index 0000000..86a7617 --- /dev/null +++ b/.gitea/workflows/example-manual-hello.yml @@ -0,0 +1,7 @@ +name: Hello World (Manual) +on: workflow_dispatch +jobs: + greet: + runs-on: ubuntu-latest + steps: + - run: echo "Hello from manual dispatch, ${{ github.actor }}" -- 2.52.0 From 0bc4348b04325555a525aa063650df95088c64cd Mon Sep 17 00:00:00 2001 From: moilanik Date: Tue, 16 Jun 2026 06:51:38 +0300 Subject: [PATCH 2/5] sadg --- .gitea/workflows/example-manual-hello.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/example-manual-hello.yml b/.gitea/workflows/example-manual-hello.yml index 86a7617..0c3fa75 100644 --- a/.gitea/workflows/example-manual-hello.yml +++ b/.gitea/workflows/example-manual-hello.yml @@ -1,7 +1,11 @@ name: Hello World (Manual) -on: workflow_dispatch +on: + workflow_dispatch: + push: + # branches: [ main ] # Tai [ feature/ci-container ] + branches: [feature/ci-container] jobs: greet: runs-on: ubuntu-latest steps: - - run: echo "Hello from manual dispatch, ${{ github.actor }}" + - run: echo "Hello" -- 2.52.0 From 223c9b8abcfcb5e51f01ae3d881cd97d36b59957 Mon Sep 17 00:00:00 2001 From: moilanik Date: Tue, 16 Jun 2026 08:16:08 +0300 Subject: [PATCH 3/5] manual jobit ci konteille --- .gitea/workflows/ci-container-build-push.yml | 57 +++++++++++++++++++ .gitea/workflows/example-build-ci-bats.yml | 21 +++++++ .../workflows/example-build-ci-cucumber.yml | 21 +++++++ .gitea/workflows/example-feature.yml | 2 +- .gitea/workflows/example-main.yml | 2 +- ...-report-summary.yml => report-summary.yml} | 0 Dockerfile.ci-bats | 3 + Dockerfile.ci-cucumber | 6 ++ docs/ai-context.md | 4 +- docs/architecture.md | 2 +- docs/workflows.md | 2 +- 11 files changed, 114 insertions(+), 6 deletions(-) create mode 100644 .gitea/workflows/ci-container-build-push.yml create mode 100644 .gitea/workflows/example-build-ci-bats.yml create mode 100644 .gitea/workflows/example-build-ci-cucumber.yml rename .gitea/workflows/{example-report-summary.yml => report-summary.yml} (100%) create mode 100644 Dockerfile.ci-bats create mode 100644 Dockerfile.ci-cucumber diff --git a/.gitea/workflows/ci-container-build-push.yml b/.gitea/workflows/ci-container-build-push.yml new file mode 100644 index 0000000..da2c2fd --- /dev/null +++ b/.gitea/workflows/ci-container-build-push.yml @@ -0,0 +1,57 @@ +name: CI Container Build & Push +on: + workflow_call: + inputs: + env_json: + required: true + type: string + dockerfile_path: + required: true + type: string + image_name: + required: true + type: string + tag: + required: true + type: string + secrets: + DOCKER_USERNAME: + required: false + DOCKER_PASSWORD: + required: true + +env: + DOCKER_REGISTRY: ${{ fromJson(inputs.env_json).DOCKER_REGISTRY || '' }} + IMAGE_NAME: ${{ inputs.image_name }} + TAG: ${{ inputs.tag }} + DOCKERFILE: ${{ inputs.dockerfile_path }} + +jobs: + build-push: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Build and push CI container + env: + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME || github.actor }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + run: | + NOW=$(date -u +%Y-%m-%dT%H:%M:%SZ) + docker build \ + --label "git.commit=${{ github.sha }}" \ + --label "git.commitBy=${{ github.actor }}" \ + --label "build.date=${NOW}" \ + -f "${DOCKERFILE}" \ + -t "${IMAGE_NAME}:${TAG}" . + + REGISTRY="${DOCKER_REGISTRY:?DOCKER_REGISTRY not set in env.conf}" + REGISTRY_HOST="${REGISTRY%%/*}" + + FULL_IMAGE="${REGISTRY}/${IMAGE_NAME}:${TAG}" + echo "Pushing ${FULL_IMAGE} ..." + + docker tag "${IMAGE_NAME}:${TAG}" "$FULL_IMAGE" + echo "$DOCKER_PASSWORD" | docker login "$REGISTRY_HOST" -u "$DOCKER_USERNAME" --password-stdin + docker push "$FULL_IMAGE" + docker logout "$REGISTRY_HOST" diff --git a/.gitea/workflows/example-build-ci-bats.yml b/.gitea/workflows/example-build-ci-bats.yml new file mode 100644 index 0000000..ead2697 --- /dev/null +++ b/.gitea/workflows/example-build-ci-bats.yml @@ -0,0 +1,21 @@ +name: Build CI Bats Container (Manual) +on: workflow_dispatch + +jobs: + load-config: + name: Load config + uses: niko/gitea-ci-library/.gitea/workflows/config-provider.yml@main + secrets: inherit + with: + config_path: .gitea/workflows/example-gitea-env.conf + + build-push: + name: Build & Push + needs: [load-config] + uses: niko/gitea-ci-library/.gitea/workflows/ci-container-build-push.yml@main + secrets: inherit + with: + env_json: ${{ needs.load-config.outputs.env_json }} + dockerfile_path: Dockerfile.ci-bats + image_name: ci-bats + tag: latest diff --git a/.gitea/workflows/example-build-ci-cucumber.yml b/.gitea/workflows/example-build-ci-cucumber.yml new file mode 100644 index 0000000..cd3f45b --- /dev/null +++ b/.gitea/workflows/example-build-ci-cucumber.yml @@ -0,0 +1,21 @@ +name: Build CI Cucumber Container (Manual) +on: workflow_dispatch + +jobs: + load-config: + name: Load config + uses: niko/gitea-ci-library/.gitea/workflows/config-provider.yml@main + secrets: inherit + with: + config_path: .gitea/workflows/example-gitea-env.conf + + build-push: + name: Build & Push + needs: [load-config] + uses: niko/gitea-ci-library/.gitea/workflows/ci-container-build-push.yml@main + secrets: inherit + with: + env_json: ${{ needs.load-config.outputs.env_json }} + dockerfile_path: Dockerfile.ci-cucumber + image_name: ci-cucumber + tag: latest diff --git a/.gitea/workflows/example-feature.yml b/.gitea/workflows/example-feature.yml index c571def..2751a2e 100644 --- a/.gitea/workflows/example-feature.yml +++ b/.gitea/workflows/example-feature.yml @@ -35,7 +35,7 @@ jobs: name: Report Summary needs: [load-config, bats, cucumber] if: always() - uses: niko/gitea-ci-library/.gitea/workflows/example-report-summary.yml@main + uses: niko/gitea-ci-library/.gitea/workflows/report-summary.yml@main with: env_json: ${{ needs.load-config.outputs.env_json }} suites: bats cucumber diff --git a/.gitea/workflows/example-main.yml b/.gitea/workflows/example-main.yml index 81d7ca6..9d5ed8e 100644 --- a/.gitea/workflows/example-main.yml +++ b/.gitea/workflows/example-main.yml @@ -55,7 +55,7 @@ jobs: name: Report Summary needs: [load-config, build-push] if: always() - uses: niko/gitea-ci-library/.gitea/workflows/example-report-summary.yml@main + uses: niko/gitea-ci-library/.gitea/workflows/report-summary.yml@main with: env_json: ${{ needs.load-config.outputs.env_json }} suites: bats cucumber diff --git a/.gitea/workflows/example-report-summary.yml b/.gitea/workflows/report-summary.yml similarity index 100% rename from .gitea/workflows/example-report-summary.yml rename to .gitea/workflows/report-summary.yml diff --git a/Dockerfile.ci-bats b/Dockerfile.ci-bats new file mode 100644 index 0000000..1ca8e17 --- /dev/null +++ b/Dockerfile.ci-bats @@ -0,0 +1,3 @@ +FROM bats/bats:latest +RUN apk add --no-cache lsof python3 jq curl ruby && \ + gem install bashcov -v 3.3.0 diff --git a/Dockerfile.ci-cucumber b/Dockerfile.ci-cucumber new file mode 100644 index 0000000..f556ac3 --- /dev/null +++ b/Dockerfile.ci-cucumber @@ -0,0 +1,6 @@ +FROM node:22 +RUN apt-get update -qq && \ + apt-get install -y -qq --no-install-recommends lsof jq && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + npm install -g @cucumber/cucumber diff --git a/docs/ai-context.md b/docs/ai-context.md index 52c1dc5..c9cde1e 100644 --- a/docs/ai-context.md +++ b/docs/ai-context.md @@ -34,13 +34,14 @@ kuuluu `git-pages/docs/`-alle, ei juuren `docs/`-kansioon. | `git-pages/` | Raporttien hostaus (Helm-chartti) | | `tests/` | Bats-testit skripteille | -### Provider workflowt (3 kpl) +### Provider workflowt (4 kpl) | Workflow | Input | Output | Kuvaus | |---|---|---|---| | `config-provider.yml` | `config_path` | `env_json`, `config_path` | Validoi ja jäsentää `.conf` → JSON. Sama kutsu hoitaa validoinnin. | | `check-version.yml` | `env_json` | `artifact_exists`, `version` | Tarkistaa git-tagit ja `package.json`:n, laskee seuraavan version. Vain main-haarassa. | | `docker-build-push.yml` | `env_json`, `version` | — | Buildaa Docker-imagen, puskea rekisteriin, tagittaa commitin. | +| `report-summary.yml` | `env_json`, `suites` | — | Generoi `GITHUB_STEP_SUMMARY`-taulukon raporttilinkeillä (Gitea 1.27+) | ### Example-tiedostot (consumer-referenssi) @@ -50,7 +51,6 @@ kuuluu `git-pages/docs/`-alle, ei juuren `docs/`-kansioon. | `example-main.yml` | push [main] | load-config → check-version → bats + cucumber → report-summary → docker-build-push | | `example-bats-tests.yml` | workflow_call | Unit-testit Batsilla, raportit git-pagesiin, status linkillä | | `example-cucumber-tests.yml` | workflow_call | Hyväksymätestit Cucumberilla, raportit git-pagesiin, status linkillä | -| `example-report-summary.yml` | workflow_call | `GITHUB_STEP_SUMMARY`-taulukko raporttilinkeillä (Gitea 1.27+) | | `example-gitea-env.conf` | — | KEY=VALUE config tälle repolle | ## Key Technical Decisions diff --git a/docs/architecture.md b/docs/architecture.md index 54d7113..60fcc93 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -33,7 +33,7 @@ Tarkemmin: ADR 0005. | `example-main.yml` | Consumer | Main-haaran CI: load-config → check-version → bats + cucumber → summary → docker | | `example-bats-tests.yml` | Consumer | Unit-testit Batsilla | | `example-cucumber-tests.yml` | Consumer | Hyväksymätestit Cucumberilla | -| `example-report-summary.yml` | Consumer | `GITHUB_STEP_SUMMARY`-taulukko (Gitea 1.27+) | +| `report-summary.yml` | Provider | `GITHUB_STEP_SUMMARY`-taulukko raporttilinkeillä (Gitea 1.27+) | | `publish-git-pages.sh` | Provider-skripti | PATCH tar git-pagesiin | | `report-status.sh` | Provider-skripti | POSTaa commit-status (vain custom-linkkiin) | | `ci-validate.sh` | Provider-skripti | Validoi `.conf`-tiedoston ja tarkistaa secretit | diff --git a/docs/workflows.md b/docs/workflows.md index 17f329b..d41d861 100644 --- a/docs/workflows.md +++ b/docs/workflows.md @@ -108,7 +108,7 @@ raportit git-pagesiin, asettaa commit-statuksen linkillä raporttiin. Ajaa Cucumber-testit Node-kontissa, julkaisee raportit git-pagesiin, asettaa commit-statuksen linkillä raporttiin. -### `example-report-summary.yml` — Raporttien koontinäkymä +### `report-summary.yml` — Raporttien koontinäkymä **Trigger:** `workflow_call` — ajetaan `if: always()` testien jälkeen -- 2.52.0 From b91a5508ddee0c5fe4cfb6ad5fe16107b8f2bd53 Mon Sep 17 00:00:00 2001 From: moilanik Date: Tue, 16 Jun 2026 08:19:02 +0300 Subject: [PATCH 4/5] =?UTF-8?q?viel=C3=A4k=C3=B6=20ajautuu=20automaattises?= =?UTF-8?q?ti=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/example-manual-hello.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitea/workflows/example-manual-hello.yml b/.gitea/workflows/example-manual-hello.yml index 0c3fa75..b2626d3 100644 --- a/.gitea/workflows/example-manual-hello.yml +++ b/.gitea/workflows/example-manual-hello.yml @@ -1,9 +1,6 @@ name: Hello World (Manual) on: workflow_dispatch: - push: - # branches: [ main ] # Tai [ feature/ci-container ] - branches: [feature/ci-container] jobs: greet: runs-on: ubuntu-latest -- 2.52.0 From 5d8c21c88ac3bdad2274c09089cf535b1ec85d88 Mon Sep 17 00:00:00 2001 From: moilanik Date: Tue, 16 Jun 2026 09:13:07 +0300 Subject: [PATCH 5/5] pois --- .gitea/workflows/example-manual-hello.yml | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 .gitea/workflows/example-manual-hello.yml diff --git a/.gitea/workflows/example-manual-hello.yml b/.gitea/workflows/example-manual-hello.yml deleted file mode 100644 index b2626d3..0000000 --- a/.gitea/workflows/example-manual-hello.yml +++ /dev/null @@ -1,8 +0,0 @@ -name: Hello World (Manual) -on: - workflow_dispatch: -jobs: - greet: - runs-on: ubuntu-latest - steps: - - run: echo "Hello" -- 2.52.0