testiä
CI Feature / Load gitea-env.conf to pipeline env (push) Successful in 12s
ci-validate CI validation FAILED
CI Feature / Validate CI config (push) Failing after 17s
ci-bats Bats tests OK
CI Feature / Bats tests (push) Successful in 1m38s
ci-cucumber Running Cucumber tests...
CI Feature / Cucumber tests (push) Failing after 1m14s
CI Feature / Report Index (push) Has been skipped
CI Feature / Load gitea-env.conf to pipeline env (push) Successful in 12s
ci-validate CI validation FAILED
CI Feature / Validate CI config (push) Failing after 17s
ci-bats Bats tests OK
CI Feature / Bats tests (push) Successful in 1m38s
ci-cucumber Running Cucumber tests...
CI Feature / Cucumber tests (push) Failing after 1m14s
CI Feature / Report Index (push) Has been skipped
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
name: CI Feature
|
||||
on:
|
||||
push:
|
||||
branches-ignore:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
load-config:
|
||||
name: Load gitea-env.conf to pipeline env
|
||||
uses: niko/gitea-ci-library/.gitea/workflows/config-provider.yml@main
|
||||
with:
|
||||
config_path: .gitea/workflows/gitea-env.conf
|
||||
|
||||
quality-gate:
|
||||
name: Quality Gate
|
||||
needs: [load-config]
|
||||
uses: niko/gitea-ci-library/.gitea/workflows/quality-gate.yml@main
|
||||
secrets: inherit
|
||||
with:
|
||||
env_json: ${{ needs.load-config.outputs.env_json }}
|
||||
bats-image: bats/bats:latest
|
||||
cucumber-node-image: node:22
|
||||
@@ -1,42 +0,0 @@
|
||||
name: CI Main
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
load-config:
|
||||
name: Load gitea-env.conf to pipeline env
|
||||
uses: niko/gitea-ci-library/.gitea/workflows/config-provider.yml@main
|
||||
with:
|
||||
config_path: .gitea/workflows/gitea-env.conf
|
||||
|
||||
check-version:
|
||||
name: Check existing artifact
|
||||
needs: [load-config]
|
||||
uses: niko/gitea-ci-library/.gitea/workflows/check-version.yml@feature/docker-kuntoon
|
||||
secrets: inherit
|
||||
with:
|
||||
env_json: ${{ needs.load-config.outputs.env_json }}
|
||||
|
||||
quality-gate:
|
||||
name: Quality Gate
|
||||
needs: [load-config, check-version]
|
||||
if: needs.check-version.outputs.artifact_exists != 'true'
|
||||
uses: niko/gitea-ci-library/.gitea/workflows/quality-gate.yml@main
|
||||
secrets: inherit
|
||||
with:
|
||||
env_json: ${{ needs.load-config.outputs.env_json }}
|
||||
bats-image: bats/bats:latest
|
||||
cucumber-node-image: node:22
|
||||
|
||||
build-push:
|
||||
name: Build & Push Docker
|
||||
needs: [load-config, check-version, quality-gate]
|
||||
if: needs.check-version.outputs.artifact_exists != 'true'
|
||||
uses: niko/gitea-ci-library/.gitea/workflows/docker-build-push.yml@feature/docker-kuntoon
|
||||
secrets: inherit
|
||||
with:
|
||||
env_json: ${{ needs.load-config.outputs.env_json }}
|
||||
version: ${{ needs.check-version.outputs.version }}
|
||||
@@ -0,0 +1,41 @@
|
||||
name: CI Validate
|
||||
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:
|
||||
validate:
|
||||
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 "Validating CI config..." ci-validate
|
||||
|
||||
- name: Validate CI config
|
||||
id: validate
|
||||
run: bash .ci/scripts/ci-validate.sh
|
||||
|
||||
- name: Report status
|
||||
if: always()
|
||||
run: |
|
||||
if [ "${{ steps.validate.outcome }}" = "success" ]; then
|
||||
bash .ci/scripts/report-status.sh success "CI config valid" ci-validate
|
||||
else
|
||||
bash .ci/scripts/report-status.sh failure "CI validation FAILED" ci-validate
|
||||
exit 1
|
||||
fi
|
||||
@@ -29,7 +29,7 @@ concurrency:
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
build-push:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -40,10 +40,13 @@ jobs:
|
||||
|
||||
- name: Set Gitea status to PENDING
|
||||
run: |
|
||||
echo "===== gitea-ci-library - Docker Build | begin ====="
|
||||
bash .ci/scripts/report-status.sh pending "Building Docker image..." ci-docker-build
|
||||
echo "===== gitea-ci-library - Docker Build & Push | begin ====="
|
||||
bash .ci/scripts/report-status.sh pending "Building and pushing Docker image..." ci-docker-build-push
|
||||
|
||||
- name: Build container
|
||||
- name: Build and push 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 \
|
||||
@@ -52,56 +55,6 @@ jobs:
|
||||
--label "build.date=${NOW}" \
|
||||
-t "${DOCKER_IMAGE_NAME}:${VERSION}" .
|
||||
|
||||
- name: Report status SUCCESS
|
||||
if: success()
|
||||
run: bash .ci/scripts/report-status.sh success "Docker build ${VERSION} OK" ci-docker-build
|
||||
|
||||
- name: Report status FAILURE
|
||||
if: failure()
|
||||
run: bash .ci/scripts/report-status.sh failure "Docker build ${VERSION} FAILED" ci-docker-build
|
||||
|
||||
- name: Save Docker image
|
||||
if: success()
|
||||
run: |
|
||||
mkdir -p /tmp/image
|
||||
docker save "${DOCKER_IMAGE_NAME}:${VERSION}" -o /tmp/image/artifact.tar
|
||||
|
||||
- name: Upload Docker image artifact
|
||||
if: success()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: docker-image
|
||||
path: /tmp/image/artifact.tar
|
||||
retention-days: 1
|
||||
|
||||
push:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: niko/gitea-ci-library
|
||||
path: .ci
|
||||
|
||||
- name: Load saved Docker image
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: docker-image
|
||||
path: /tmp/image
|
||||
|
||||
- name: Set Gitea status to PENDING
|
||||
run: |
|
||||
echo "===== gitea-ci-library - Docker Push | begin ====="
|
||||
bash .ci/scripts/report-status.sh pending "Pushing to registry..." ci-docker-push
|
||||
|
||||
- name: Push to Docker Registry
|
||||
env:
|
||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME || github.actor }}
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||
run: |
|
||||
docker load -i /tmp/image/artifact.tar
|
||||
|
||||
REGISTRY="${DOCKER_REGISTRY:?DOCKER_REGISTRY not set in env.conf}"
|
||||
IMAGE="${DOCKER_IMAGE_NAME:?DOCKER_IMAGE_NAME not set in env.conf}"
|
||||
REGISTRY_HOST="${REGISTRY%%/*}"
|
||||
@@ -121,15 +74,15 @@ jobs:
|
||||
if [ -n "${DOCKER_UI_URL:-}" ] && [ -n "${VERSION:-}" ]; then
|
||||
CONTAINER_URL="${DOCKER_UI_URL}/${VERSION}"
|
||||
fi
|
||||
bash .ci/scripts/report-status.sh success "Docker push ${VERSION} OK" ci-docker-push "" "$CONTAINER_URL"
|
||||
bash .ci/scripts/report-status.sh success "Docker build & push ${VERSION} OK" ci-docker-build-push "" "$CONTAINER_URL"
|
||||
|
||||
- name: Report status FAILURE
|
||||
if: failure()
|
||||
run: bash .ci/scripts/report-status.sh failure "Docker push ${VERSION} FAILED" ci-docker-push
|
||||
run: bash .ci/scripts/report-status.sh failure "Docker build & push ${VERSION} FAILED" ci-docker-build-push
|
||||
|
||||
tag-commit:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [push]
|
||||
needs: [build-push]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
name: Bats Tests
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
env_json:
|
||||
required: true
|
||||
type: string
|
||||
bats-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:
|
||||
bats:
|
||||
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 "Running Bats tests..." ci-bats
|
||||
|
||||
- name: Run bats tests
|
||||
id: bats-tests
|
||||
shell: bash
|
||||
run: |
|
||||
docker volume create bats-workspace
|
||||
tar c . | docker run --rm -i -v bats-workspace:/data alpine tar x -C /data
|
||||
mkdir -p "reports/${GITHUB_SHA:0:8}/bats"
|
||||
set +e
|
||||
docker run --rm \
|
||||
-v bats-workspace:/data \
|
||||
--entrypoint bash ${{ inputs.bats-image }} \
|
||||
-c 'apk add -q lsof python3 jq curl ruby && cd /data && gem install bashcov -v 3.3.0 2>&1 | tail -1 && bashcov -- bats tests/' \
|
||||
> "reports/${GITHUB_SHA:0:8}/bats/results.txt" 2>&1
|
||||
BATS_EXIT=$?
|
||||
bash .ci/.gitea/scripts/bats-coverage.sh bats-workspace "reports/${GITHUB_SHA:0:8}/bats"
|
||||
docker volume rm bats-workspace > /dev/null 2>&1
|
||||
bash .ci/.gitea/scripts/bats-report.sh "reports/${GITHUB_SHA:0:8}/bats"
|
||||
echo "BATS_EXIT=${BATS_EXIT}" >> "${GITHUB_ENV}"
|
||||
exit ${BATS_EXIT}
|
||||
|
||||
- name: Publish bats reports
|
||||
if: always()
|
||||
run: bash .ci/scripts/publish-git-pages.sh bats
|
||||
|
||||
- name: Report status
|
||||
if: always()
|
||||
run: |
|
||||
if [ "${BATS_EXIT}" = "0" ]; then
|
||||
bash .ci/scripts/report-status.sh success "Bats tests OK" ci-bats bats
|
||||
else
|
||||
bash .ci/scripts/report-status.sh failure "Bats tests FAILED" ci-bats bats
|
||||
fi
|
||||
@@ -0,0 +1,72 @@
|
||||
name: Cucumber Tests
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
env_json:
|
||||
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:
|
||||
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: Pending
|
||||
run: bash .ci/scripts/report-status.sh pending "Running Cucumber tests..." ci-cucumber
|
||||
|
||||
- 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=$?
|
||||
echo "CUCUMBER_EXIT=${CUCUMBER_EXIT}" >> "${GITHUB_ENV}"
|
||||
exit ${CUCUMBER_EXIT}
|
||||
|
||||
- name: Publish cucumber reports
|
||||
if: always()
|
||||
run: bash .ci/scripts/publish-git-pages.sh cucumber
|
||||
|
||||
- name: Report status
|
||||
if: always()
|
||||
run: |
|
||||
if [ "${CUCUMBER_EXIT}" = "0" ]; then
|
||||
if [ -f "reports/${GITHUB_SHA:0:8}/cucumber/index.html" ]; then
|
||||
bash .ci/scripts/report-status.sh success "Cucumber tests OK" ci-cucumber cucumber
|
||||
else
|
||||
bash .ci/scripts/report-status.sh success "Cucumber tests OK" ci-cucumber
|
||||
fi
|
||||
else
|
||||
if [ -f "reports/${GITHUB_SHA:0:8}/cucumber/index.html" ]; then
|
||||
bash .ci/scripts/report-status.sh failure "Cucumber tests FAILED" ci-cucumber cucumber
|
||||
else
|
||||
bash .ci/scripts/report-status.sh failure "Cucumber tests FAILED" ci-cucumber
|
||||
fi
|
||||
fi
|
||||
@@ -0,0 +1,47 @@
|
||||
name: CI Feature
|
||||
on:
|
||||
push:
|
||||
branches-ignore:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
load-config:
|
||||
name: Load gitea-env.conf to pipeline env
|
||||
uses: niko/gitea-ci-library/.gitea/workflows/config-provider.yml@main
|
||||
with:
|
||||
config_path: .gitea/workflows/gitea-env.conf
|
||||
|
||||
validate:
|
||||
name: Validate CI config
|
||||
needs: [load-config]
|
||||
uses: niko/gitea-ci-library/.gitea/workflows/ci-validate.yml@feature/docker-kuntoon
|
||||
secrets: inherit
|
||||
with:
|
||||
env_json: ${{ needs.load-config.outputs.env_json }}
|
||||
|
||||
bats:
|
||||
name: Bats tests
|
||||
needs: [load-config]
|
||||
uses: niko/gitea-ci-library/.gitea/workflows/eat-own-dogfood-bats-tests.yml@feature/docker-kuntoon
|
||||
secrets: inherit
|
||||
with:
|
||||
env_json: ${{ needs.load-config.outputs.env_json }}
|
||||
bats-image: bats/bats:latest
|
||||
|
||||
cucumber:
|
||||
name: Cucumber tests
|
||||
needs: [load-config]
|
||||
uses: niko/gitea-ci-library/.gitea/workflows/eat-own-dogfood-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, bats, cucumber]
|
||||
uses: niko/gitea-ci-library/.gitea/workflows/report-index.yml@feature/docker-kuntoon
|
||||
secrets: inherit
|
||||
with:
|
||||
env_json: ${{ needs.load-config.outputs.env_json }}
|
||||
@@ -0,0 +1,69 @@
|
||||
name: CI Main
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
load-config:
|
||||
name: Load gitea-env.conf to pipeline env
|
||||
uses: niko/gitea-ci-library/.gitea/workflows/config-provider.yml@main
|
||||
with:
|
||||
config_path: .gitea/workflows/gitea-env.conf
|
||||
|
||||
check-version:
|
||||
name: Check existing artifact
|
||||
needs: [load-config]
|
||||
uses: niko/gitea-ci-library/.gitea/workflows/check-version.yml@feature/docker-kuntoon
|
||||
secrets: inherit
|
||||
with:
|
||||
env_json: ${{ needs.load-config.outputs.env_json }}
|
||||
|
||||
validate:
|
||||
name: Validate CI config
|
||||
needs: [load-config, check-version]
|
||||
if: needs.check-version.outputs.artifact_exists != 'true'
|
||||
uses: niko/gitea-ci-library/.gitea/workflows/ci-validate.yml@feature/docker-kuntoon
|
||||
secrets: inherit
|
||||
with:
|
||||
env_json: ${{ needs.load-config.outputs.env_json }}
|
||||
|
||||
bats:
|
||||
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
|
||||
secrets: inherit
|
||||
with:
|
||||
env_json: ${{ needs.load-config.outputs.env_json }}
|
||||
bats-image: bats/bats:latest
|
||||
|
||||
cucumber:
|
||||
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
|
||||
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
|
||||
with:
|
||||
env_json: ${{ needs.load-config.outputs.env_json }}
|
||||
|
||||
build-push:
|
||||
name: Build & Push Docker
|
||||
needs: [load-config, check-version, report-index]
|
||||
if: needs.check-version.outputs.artifact_exists != 'true'
|
||||
uses: niko/gitea-ci-library/.gitea/workflows/docker-build-push.yml@feature/docker-kuntoon
|
||||
secrets: inherit
|
||||
with:
|
||||
env_json: ${{ needs.load-config.outputs.env_json }}
|
||||
version: ${{ needs.check-version.outputs.version }}
|
||||
@@ -1,173 +0,0 @@
|
||||
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: Pending
|
||||
run: bash .ci/scripts/report-status.sh pending "Validating CI config..." ci-validate
|
||||
|
||||
- name: Validate CI config
|
||||
id: validate
|
||||
run: bash .ci/scripts/ci-validate.sh
|
||||
|
||||
- name: Report status
|
||||
if: always()
|
||||
run: |
|
||||
if [ "${{ steps.validate.outcome }}" = "success" ]; then
|
||||
bash .ci/scripts/report-status.sh success "CI config valid" ci-validate
|
||||
else
|
||||
bash .ci/scripts/report-status.sh failure "CI validation FAILED" ci-validate
|
||||
exit 1
|
||||
fi
|
||||
|
||||
bats:
|
||||
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 "Running Bats tests..." ci-bats
|
||||
|
||||
- name: Run bats tests
|
||||
id: bats-tests
|
||||
shell: bash
|
||||
run: |
|
||||
docker volume create bats-workspace
|
||||
tar c . | docker run --rm -i -v bats-workspace:/data alpine tar x -C /data
|
||||
mkdir -p "reports/${GITHUB_SHA:0:8}/bats"
|
||||
set +e
|
||||
docker run --rm \
|
||||
-v bats-workspace:/data \
|
||||
--entrypoint bash ${{ inputs.bats-image }} \
|
||||
-c 'apk add -q lsof python3 jq curl ruby && cd /data && gem install bashcov -v 3.3.0 2>&1 | tail -1 && bashcov -- bats tests/' \
|
||||
> "reports/${GITHUB_SHA:0:8}/bats/results.txt" 2>&1
|
||||
BATS_EXIT=$?
|
||||
bash .ci/.gitea/scripts/bats-coverage.sh bats-workspace "reports/${GITHUB_SHA:0:8}/bats"
|
||||
docker volume rm bats-workspace > /dev/null 2>&1
|
||||
bash .ci/.gitea/scripts/bats-report.sh "reports/${GITHUB_SHA:0:8}/bats"
|
||||
echo "BATS_EXIT=${BATS_EXIT}" >> "${GITHUB_ENV}"
|
||||
exit ${BATS_EXIT}
|
||||
|
||||
- name: Publish bats reports
|
||||
if: always()
|
||||
run: bash .ci/scripts/publish-git-pages.sh bats
|
||||
|
||||
- name: Report status
|
||||
if: always()
|
||||
run: |
|
||||
if [ "${BATS_EXIT}" = "0" ]; then
|
||||
bash .ci/scripts/report-status.sh success "Bats tests OK" ci-bats bats
|
||||
else
|
||||
bash .ci/scripts/report-status.sh failure "Bats tests FAILED" ci-bats bats
|
||||
fi
|
||||
|
||||
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: Pending
|
||||
run: bash .ci/scripts/report-status.sh pending "Running Cucumber tests..." ci-cucumber
|
||||
|
||||
- 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=$?
|
||||
echo "CUCUMBER_EXIT=${CUCUMBER_EXIT}" >> "${GITHUB_ENV}"
|
||||
exit ${CUCUMBER_EXIT}
|
||||
|
||||
- name: Publish cucumber reports
|
||||
if: always()
|
||||
run: bash .ci/scripts/publish-git-pages.sh cucumber
|
||||
|
||||
- name: Report status
|
||||
if: always()
|
||||
run: |
|
||||
if [ "${CUCUMBER_EXIT}" = "0" ]; then
|
||||
if [ -f "reports/${GITHUB_SHA:0:8}/cucumber/index.html" ]; then
|
||||
bash .ci/scripts/report-status.sh success "Cucumber tests OK" ci-cucumber cucumber
|
||||
else
|
||||
bash .ci/scripts/report-status.sh success "Cucumber tests OK" ci-cucumber
|
||||
fi
|
||||
else
|
||||
if [ -f "reports/${GITHUB_SHA:0:8}/cucumber/index.html" ]; then
|
||||
bash .ci/scripts/report-status.sh failure "Cucumber tests FAILED" ci-cucumber cucumber
|
||||
else
|
||||
bash .ci/scripts/report-status.sh failure "Cucumber tests FAILED" ci-cucumber
|
||||
fi
|
||||
fi
|
||||
|
||||
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: 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
|
||||
if: always()
|
||||
run: |
|
||||
if [ "${{ steps.report-index.outcome }}" = "success" ]; then
|
||||
bash .ci/scripts/report-status.sh success "Build complete" ci-build
|
||||
else
|
||||
bash .ci/scripts/report-status.sh failure "Build FAILED" ci-build
|
||||
exit 1
|
||||
fi
|
||||
@@ -0,0 +1,41 @@
|
||||
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
|
||||
if: always()
|
||||
run: |
|
||||
if [ "${{ steps.report-index.outcome }}" = "success" ]; then
|
||||
bash .ci/scripts/report-status.sh success "Build complete" ci-build
|
||||
else
|
||||
bash .ci/scripts/report-status.sh failure "Build FAILED" ci-build
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user