Files
gitea-ci-library/.gitea/workflows/quality-gate.yml
T
moilanik b685f3616e
CI / Load gitea-env.conf to pipeline env (push) Successful in 13s
ci-bats Bats tests
ci-cucumber Cucumber tests
CI / Quality Gate (push) Failing after 1m20s
CI / Build & Push Artifact (push) Has been skipped
fix(quality-gate): tee bats output for debug visibility
Replace `>` redirect with `2>&1 | tee` so bats test output
appears in the pipeline log while still saving to results.txt.

chore(ci.yml): name load-config and main jobs for clarity
2026-06-14 07:45:20 +03:00

128 lines
3.7 KiB
YAML

name: Quality Gate
on:
workflow_call:
inputs:
env_json:
required: true
type: string
bats-image:
required: true
type: string
cucumber-node-image:
required: true
type: string
secrets:
GITEA_TOKEN:
required: true
GIT_PAGES_PUBLISH_TOKEN:
required: true
env:
GITEA_API_URL: ${{ fromJson(inputs.env_json).GITEA_API_URL }}
GIT_PAGES_URL: ${{ fromJson(inputs.env_json).GIT_PAGES_URL }}
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
GIT_PAGES_PUBLISH_TOKEN: ${{ secrets.GIT_PAGES_PUBLISH_TOKEN }}
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: niko/gitea-ci-library
path: .ci
- name: Validate CI config
run: bash .ci/scripts/ci-validate.sh
bats:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: niko/gitea-ci-library
path: .ci
- name: Run bats tests
id: bats-tests
shell: bash
run: |
set +e
mkdir -p "reports/${GITHUB_SHA:0:8}/bats"
docker run --rm \
-v "$(pwd):/repo" \
-v "$(pwd)/reports/${GITHUB_SHA:0:8}/bats:/reports" \
-w /repo \
--entrypoint bash ${{ inputs.bats-image }} \
-c 'apk add -q lsof python3 jq curl ruby && \
bats tests/' \
2>&1 | tee "reports/${GITHUB_SHA:0:8}/bats/results.txt"
BATS_EXIT=$?
bash .ci/.gitea/scripts/bats-report.sh "reports/${GITHUB_SHA:0:8}/bats" || true
STATE="success"
[ "${BATS_EXIT}" != "0" ] && STATE="failure"
bash .ci/scripts/report-status.sh "${STATE}" "Bats tests" ci-bats
exit ${BATS_EXIT}
- name: Publish bats reports
if: always()
run: bash .ci/scripts/publish-git-pages.sh bats
cucumber:
runs-on: ubuntu-latest
container:
image: ${{ inputs.cucumber-node-image }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: niko/gitea-ci-library
path: .ci
- name: Run cucumber tests
id: cucumber-tests
shell: bash
run: |
apt-get update -qq && apt-get install -y -qq --no-install-recommends lsof jq
npm install @cucumber/cucumber > /dev/null 2>&1
mkdir -p "reports/${GITHUB_SHA:0:8}/cucumber"
set +e
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
CUCUMBER_EXIT=$?
STATE="success"
[ "${CUCUMBER_EXIT}" != "0" ] && STATE="failure"
if [ -f "reports/${GITHUB_SHA:0:8}/cucumber/index.html" ]; then
bash .ci/scripts/report-status.sh "${STATE}" "Cucumber tests" ci-cucumber cucumber
else
bash .ci/scripts/report-status.sh "${STATE}" "Cucumber tests" ci-cucumber
fi
exit ${CUCUMBER_EXIT}
- name: Publish cucumber reports
if: always()
run: bash .ci/scripts/publish-git-pages.sh cucumber
build:
runs-on: ubuntu-latest
needs: [bats, cucumber]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: niko/gitea-ci-library
path: .ci
- name: Generate report index
run: bash .ci/.gitea/scripts/generate-report-index.sh
- name: Set build commit status
run: bash .ci/scripts/report-status.sh success "Build complete" ci-build