refaktorointia
CI Feature / Load gitea-env.conf to pipeline env (push) Successful in 11s
ci-validate CI config valid
CI Feature / Validate CI config (push) Successful in 16s
ci-bats Bats tests OK
CI Feature / Bats tests (push) Successful in 1m39s
ci-cucumber Cucumber tests OK
CI Feature / Cucumber tests (push) Successful in 1m7s
CI Feature / Report Summary (push) Successful in 5s
CI Feature / Load gitea-env.conf to pipeline env (push) Successful in 11s
ci-validate CI config valid
CI Feature / Validate CI config (push) Successful in 16s
ci-bats Bats tests OK
CI Feature / Bats tests (push) Successful in 1m39s
ci-cucumber Cucumber tests OK
CI Feature / Cucumber tests (push) Successful in 1m7s
CI Feature / Report Summary (push) Successful in 5s
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
SHA8="${GITHUB_SHA:0:8}"
|
||||
REPORTS_DIR="reports/${SHA8}"
|
||||
|
||||
mkdir -p "${REPORTS_DIR}"
|
||||
|
||||
BATS_PASS=$(grep -c 'ok' "${REPORTS_DIR}/bats/results.txt" 2>/dev/null || echo 0)
|
||||
BATS_FAIL=$(grep -c 'not ok' "${REPORTS_DIR}/bats/results.txt" 2>/dev/null || echo 0)
|
||||
CUCUMBER_PASS=$(jq '.summary.passed // 0' "${REPORTS_DIR}/cucumber/report.json" 2>/dev/null || echo 0)
|
||||
CUCUMBER_FAIL=$(jq '.summary.failed // 0' "${REPORTS_DIR}/cucumber/report.json" 2>/dev/null || echo 0)
|
||||
|
||||
{
|
||||
echo "<!DOCTYPE html><html><head><meta charset='utf-8'>"
|
||||
echo "<title>CI report ${SHA8}</title>"
|
||||
echo "<style>body{font-family:sans-serif;margin:2em}a{color:#2563eb}table{border-collapse:collapse}"
|
||||
echo "th,td{border:1px solid #ccc;padding:8px;text-align:left}"
|
||||
echo ".pass{color:#059669}.fail{color:#dc2626}</style></head><body>"
|
||||
echo "<h1>CI report <code>${SHA8}</code></h1>"
|
||||
echo "<p>Commit: ${GITHUB_SHA}<br>Branch: ${GITHUB_REF_NAME}<br>Run: ${GITHUB_RUN_ID}</p>"
|
||||
echo "<table><tr><th>Suite</th><th>Passed</th><th>Failed</th><th>Report</th></tr>"
|
||||
echo "<tr><td>Bats</td><td class='pass'>${BATS_PASS}</td><td class='fail'>${BATS_FAIL}</td>"
|
||||
echo "<td><a href='bats/results.txt'>results.txt</a>"
|
||||
echo " | <a href='bats/junit.xml'>junit.xml</a></td></tr>"
|
||||
echo "<tr><td>Cucumber</td><td class='pass'>${CUCUMBER_PASS}</td><td class='fail'>${CUCUMBER_FAIL}</td>"
|
||||
echo "<td><a href='cucumber/index.html'>report</a>"
|
||||
echo " | <a href='cucumber/report.json'>json</a></td></tr>"
|
||||
echo "</table></body></html>"
|
||||
} > "${REPORTS_DIR}/index.html"
|
||||
@@ -23,7 +23,7 @@ jobs:
|
||||
bats:
|
||||
name: Bats tests
|
||||
needs: [load-config]
|
||||
uses: niko/gitea-ci-library/.gitea/workflows/eat-own-dogfood-bats-tests.yml@feature/docker-kuntoon
|
||||
uses: niko/gitea-ci-library/.gitea/workflows/example-bats-tests.yml@feature/docker-kuntoon
|
||||
secrets: inherit
|
||||
with:
|
||||
env_json: ${{ needs.load-config.outputs.env_json }}
|
||||
@@ -32,16 +32,16 @@ jobs:
|
||||
cucumber:
|
||||
name: Cucumber tests
|
||||
needs: [load-config]
|
||||
uses: niko/gitea-ci-library/.gitea/workflows/eat-own-dogfood-cucumber-tests.yml@feature/docker-kuntoon
|
||||
uses: niko/gitea-ci-library/.gitea/workflows/example-cucumber-tests.yml@feature/docker-kuntoon
|
||||
secrets: inherit
|
||||
with:
|
||||
env_json: ${{ needs.load-config.outputs.env_json }}
|
||||
cucumber-node-image: node:22
|
||||
|
||||
report-index:
|
||||
name: Report Index
|
||||
report-summary:
|
||||
name: Report Summary
|
||||
needs: [load-config, bats, cucumber]
|
||||
uses: niko/gitea-ci-library/.gitea/workflows/report-index.yml@feature/docker-kuntoon
|
||||
secrets: inherit
|
||||
if: always()
|
||||
uses: niko/gitea-ci-library/.gitea/workflows/example-report-summary.yml@feature/docker-kuntoon
|
||||
with:
|
||||
env_json: ${{ needs.load-config.outputs.env_json }}
|
||||
@@ -33,7 +33,7 @@ jobs:
|
||||
name: Bats tests
|
||||
needs: [load-config, check-version]
|
||||
if: needs.check-version.outputs.artifact_exists != 'true'
|
||||
uses: niko/gitea-ci-library/.gitea/workflows/eat-own-dogfood-bats-tests.yml@feature/docker-kuntoon
|
||||
uses: niko/gitea-ci-library/.gitea/workflows/example-bats-tests.yml@feature/docker-kuntoon
|
||||
secrets: inherit
|
||||
with:
|
||||
env_json: ${{ needs.load-config.outputs.env_json }}
|
||||
@@ -43,24 +43,23 @@ jobs:
|
||||
name: Cucumber tests
|
||||
needs: [load-config, check-version]
|
||||
if: needs.check-version.outputs.artifact_exists != 'true'
|
||||
uses: niko/gitea-ci-library/.gitea/workflows/eat-own-dogfood-cucumber-tests.yml@feature/docker-kuntoon
|
||||
uses: niko/gitea-ci-library/.gitea/workflows/example-cucumber-tests.yml@feature/docker-kuntoon
|
||||
secrets: inherit
|
||||
with:
|
||||
env_json: ${{ needs.load-config.outputs.env_json }}
|
||||
cucumber-node-image: node:22
|
||||
|
||||
report-index:
|
||||
name: Report Index
|
||||
needs: [load-config, check-version, bats, cucumber]
|
||||
if: needs.check-version.outputs.artifact_exists != 'true'
|
||||
uses: niko/gitea-ci-library/.gitea/workflows/report-index.yml@feature/docker-kuntoon
|
||||
secrets: inherit
|
||||
report-summary:
|
||||
name: Report Summary
|
||||
needs: [load-config, bats, cucumber]
|
||||
if: always()
|
||||
uses: niko/gitea-ci-library/.gitea/workflows/example-report-summary.yml@feature/docker-kuntoon
|
||||
with:
|
||||
env_json: ${{ needs.load-config.outputs.env_json }}
|
||||
|
||||
build-push:
|
||||
name: Build & Push Docker
|
||||
needs: [load-config, check-version, report-index]
|
||||
needs: [load-config, check-version, bats, cucumber]
|
||||
if: needs.check-version.outputs.artifact_exists != 'true'
|
||||
uses: niko/gitea-ci-library/.gitea/workflows/docker-build-push.yml@feature/docker-kuntoon
|
||||
secrets: inherit
|
||||
@@ -0,0 +1,29 @@
|
||||
name: Report Summary
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
env_json:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
env:
|
||||
GIT_PAGES_URL: ${{ fromJson(inputs.env_json).GIT_PAGES_URL }}
|
||||
|
||||
jobs:
|
||||
summary:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Generate report links
|
||||
shell: bash
|
||||
run: |
|
||||
SHA8="${GITHUB_SHA:0:8}"
|
||||
BASE="${GIT_PAGES_URL}/${GITHUB_REPOSITORY}/reports/${SHA8}"
|
||||
|
||||
{
|
||||
echo "## Test Reports"
|
||||
echo ""
|
||||
echo "| Suite | Report |"
|
||||
echo "|-------|--------|"
|
||||
echo "| Bats (unit) | [View report](${BASE}/bats/) |"
|
||||
echo "| Cucumber | [View report](${BASE}/cucumber/) |"
|
||||
} >> "${GITHUB_STEP_SUMMARY}"
|
||||
@@ -1,39 +0,0 @@
|
||||
name: Report Index
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
env_json:
|
||||
required: true
|
||||
type: string
|
||||
secrets:
|
||||
GITEA_TOKEN:
|
||||
required: true
|
||||
|
||||
env:
|
||||
GITEA_API_URL: ${{ fromJson(inputs.env_json).GITEA_API_URL }}
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
|
||||
jobs:
|
||||
generate:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: niko/gitea-ci-library
|
||||
path: .ci
|
||||
|
||||
- name: Pending
|
||||
run: bash .ci/scripts/report-status.sh pending "Generating report index..." ci-build
|
||||
|
||||
- name: Generate report index
|
||||
id: report-index
|
||||
run: bash .ci/.gitea/scripts/generate-report-index.sh
|
||||
|
||||
- name: Report status SUCCESS
|
||||
if: success()
|
||||
run: bash .ci/scripts/report-status.sh success "Build complete" ci-build
|
||||
|
||||
- name: Report status FAILURE
|
||||
if: failure()
|
||||
run: bash .ci/scripts/report-status.sh failure "Build FAILED" ci-build
|
||||
Reference in New Issue
Block a user