kokeillaan eat your own dog food
CI / call-engine (push) Failing after 17s

This commit is contained in:
moilanik
2026-06-12 16:36:39 +03:00
parent 610cefbdfa
commit 2eac8209c3
2 changed files with 87 additions and 76 deletions
+71
View File
@@ -0,0 +1,71 @@
name: Build Feature
on:
workflow_call:
jobs:
pipeline:
runs-on: ubuntu-latest
env:
GITEA_API_URL: https://gitea.app.keskikuja.site
PAGES_HOST: ci-reports.helm-dev.keskikuja.site
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
GIT_PAGES_PUBLISH_TOKEN: ${{ secrets.GIT_PAGES_PUBLISH_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: niko/gitea-ci-library
path: .ci
- name: Bats tests
continue-on-error: true
run: |
mkdir -p "reports/${GITHUB_SHA:0:8}/bats"
bats --formatter junit tests/*.bats > "reports/${GITHUB_SHA:0:8}/bats/junit.xml" 2>&1 || \
bats tests/*.bats > "reports/${GITHUB_SHA:0:8}/bats/results.txt" 2>&1
- name: Cucumber tests
continue-on-error: true
run: |
mkdir -p "reports/${GITHUB_SHA:0:8}/cucumber"
npx cucumber-js \
--format json:"reports/${GITHUB_SHA:0:8}/cucumber/report.json" \
--format html:"reports/${GITHUB_SHA:0:8}/cucumber/index.html" 2>&1 || \
npx cucumber-js \
--format json:"reports/${GITHUB_SHA:0:8}/cucumber/report.json"
- name: Generate report index
run: |
SHA8="${GITHUB_SHA:0:8}"
BATS_PASS=$(grep -c 'ok' "reports/${SHA8}/bats/results.txt" 2>/dev/null || echo 0)
BATS_FAIL=$(grep -c 'not ok' "reports/${SHA8}/bats/results.txt" 2>/dev/null || echo 0)
CUCUMBER_PASS=$(jq '.summary.passed // 0' "reports/${SHA8}/cucumber/report.json" 2>/dev/null || echo 0)
CUCUMBER_FAIL=$(jq '.summary.failed // 0' "reports/${SHA8}/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/${SHA8}/index.html"
- name: Set commit status
run: |
bash .ci/scripts/report-status.sh success \
"Tests passed" \
"https://${PAGES_HOST}/${GITHUB_REPOSITORY}/reports/${GITHUB_SHA:0:8}/" \
ci-tests
- name: Publish reports
run: |
bash .ci/scripts/publish-git-pages.sh "reports/${GITHUB_SHA:0:8}"
+16 -76
View File
@@ -1,89 +1,29 @@
name: CI Engine name: CI Engine
on: on:
workflow_call: workflow_call:
inputs:
config-file:
required: true
type: string
secrets:
GITEA_TOKEN:
required: true
GIT_PAGES_PUBLISH_TOKEN:
required: true
jobs: jobs:
unit: publish:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
GITEA_API_URL: https://gitea.app.keskikuja.site
PAGES_HOST: ci-reports.helm-dev.keskikuja.site
GIT_PAGES_PUBLISH_URL: https://ci-reports.helm-dev.keskikuja.site
GIT_PAGES_PUBLISH_TOKEN: ${{ secrets.GIT_PAGES_PUBLISH_TOKEN }}
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
GIT_PAGES_PUBLISH_TOKEN: ${{ secrets.GIT_PAGES_PUBLISH_TOKEN }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Generate unit test report - name: Publish reports
run: | run: bash scripts/publish.sh reports
SHA8="${GITHUB_SHA:0:8}"
mkdir -p "reports/${SHA8}"
cat > "reports/${SHA8}/unit-tests.html" <<EOF
<!DOCTYPE html>
<html lang="fi">
<head><meta charset="utf-8"><title>Unit tests - ${SHA8}</title></head>
<body>
<h1>Unit Tests</h1>
<p>Commit: ${GITHUB_SHA}</p>
<p>Branch: ${GITHUB_REF_NAME}</p>
<p>Status: passed</p>
</body>
</html>
EOF
- name: Publish unit test report - name: Set commit status
id: publish-unit
run: | run: |
REPORT_BASE=$(bash scripts/publish-git-pages.sh "reports/${GITHUB_SHA:0:8}") REPORT_URL="https://${PAGES_HOST}/${GITHUB_REPOSITORY}/reports/${GITHUB_SHA:0:8}/"
echo "report_url=${REPORT_BASE}/unit-tests.html" >> "${GITHUB_OUTPUT}" bash scripts/report-status.sh success "Reports published" "$REPORT_URL" ci-publish
- name: Set unit test commit status
run: |
bash scripts/report-status.sh \
success \
"Unit tests passed" \
"${{ steps.publish-unit.outputs.report_url }}" \
"ci-unit"
build:
needs: [unit]
runs-on: ubuntu-latest
env:
GITEA_API_URL: https://gitea.app.keskikuja.site
PAGES_HOST: ci-reports.helm-dev.keskikuja.site
GIT_PAGES_PUBLISH_URL: https://ci-reports.helm-dev.keskikuja.site
GIT_PAGES_PUBLISH_TOKEN: ${{ secrets.GIT_PAGES_PUBLISH_TOKEN }}
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Generate build report
run: |
SHA8="${GITHUB_SHA:0:8}"
mkdir -p "reports/${SHA8}"
cat > "reports/${SHA8}/build-report.html" <<EOF
<!DOCTYPE html>
<html lang="fi">
<head><meta charset="utf-8"><title>Docker build - ${SHA8}</title></head>
<body>
<h1>Docker Build</h1>
<p>Commit: ${GITHUB_SHA}</p>
<p>Image: app:${GITHUB_RUN_NUMBER}</p>
<p>Status: pushed</p>
</body>
</html>
EOF
- name: Publish build report
id: publish-build
run: |
REPORT_BASE=$(bash scripts/publish-git-pages.sh "reports/${GITHUB_SHA:0:8}")
echo "report_url=${REPORT_BASE}/build-report.html" >> "${GITHUB_OUTPUT}"
- name: Set build commit status
run: |
bash scripts/report-status.sh \
success \
"Container built & pushed" \
"${{ steps.publish-build.outputs.report_url }}" \
"ci-build"