Files
EventHubFrontAdmin/.gitea/workflows/ci.yml
T
aleksey db1417332d
CI / test (push) Successful in 3m10s
CI / push-image (push) Successful in 1m54s
CI / ci-done (push) Successful in 0s
Deploy stage (admin) / deploy-stage-admin (push) Successful in 1m17s
fix(ci,deploy-ift): artifact v3 для Gitea, deploy без conclusion check
upload-artifact@v4 не работает на Gitea (GHES). deploy-ift skipped из-за
пустого workflow_run.conclusion — проверка образа вместо if success.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-11 23:18:27 +03:00

140 lines
4.2 KiB
YAML

name: CI
on:
push:
branches: [master, main]
pull_request:
workflow_dispatch:
# Один runner (DESKTOP-SIR8B3R): параллельные workflow ломают кэш act/actions.
concurrency:
group: eventhub-frontadmin-ci-${{ github.ref }}
cancel-in-progress: false
env:
BUILDKIT_PROGRESS: quiet
DOCKER_BUILDKIT: 1
REGISTRY: git.sabilin.com/eventhub
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 20
outputs:
ci_test_ok: ${{ steps.mark_test.outputs.ok }}
steps:
- uses: actions/checkout@v4
# Без cache: npm — act_runner отменяет шаг на распаковке ~546MB (exit -1).
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm ci
- run: npm run lint
- run: npm run build
- name: Upload dist for docker job
if: github.event_name == 'push'
uses: actions/upload-artifact@v3
with:
name: admin-ui-dist
path: dist/
retention-days: 1
- name: Mark test complete
id: mark_test
if: success()
run: echo "ok=1" >> "$GITHUB_OUTPUT"
push-image:
needs: test
if: github.event_name == 'push' && needs.test.outputs.ci_test_ok == '1'
runs-on: ubuntu-latest
timeout-minutes: 30
outputs:
ci_push_ok: ${{ steps.mark_push.outputs.ok }}
steps:
- uses: actions/checkout@v4
- name: Download dist from test job
uses: actions/download-artifact@v3
with:
name: admin-ui-dist
path: dist
- name: Wait for Docker daemon
run: bash scripts/ensure-docker-daemon.sh 240
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build admin-ui image
run: |
set -euo pipefail
bash scripts/retry-docker-build.sh 5 60 -- \
docker buildx build \
--network=host \
--file Dockerfile \
--tag eventhub-admin-ui:local \
--load \
--provenance=false \
--sbom=false \
.
- name: Login to registry
uses: docker/login-action@v2
with:
registry: git.sabilin.com
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Push admin-ui image
run: |
set -euo pipefail
TAG="sha-${GITHUB_SHA:0:12}"
docker tag eventhub-admin-ui:local "${REGISTRY}/eventhub-admin-ui:${TAG}"
docker tag eventhub-admin-ui:local "${REGISTRY}/eventhub-admin-ui:ift"
docker tag eventhub-admin-ui:local "${REGISTRY}/eventhub-admin-ui:dev"
bash scripts/retry-docker-build.sh 5 30 -- docker push "${REGISTRY}/eventhub-admin-ui:${TAG}"
bash scripts/retry-docker-build.sh 5 30 -- docker push "${REGISTRY}/eventhub-admin-ui:ift"
bash scripts/retry-docker-build.sh 5 30 -- docker push "${REGISTRY}/eventhub-admin-ui:dev"
- name: Prune old registry images
continue-on-error: true
env:
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
run: bash scripts/run-registry-prune.sh
- name: Mark push complete
id: mark_push
if: success()
run: echo "ok=1" >> "$GITHUB_OUTPUT"
ci-done:
needs: [test, push-image]
if: always()
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Enforce CI completion
run: |
set -euo pipefail
TEST_OK="${{ needs.test.outputs.ci_test_ok }}"
if [ "${TEST_OK}" != "1" ]; then
echo "::error::test job incomplete (runner reported success without output)"
exit 1
fi
if [ "${{ github.event_name }}" = "push" ]; then
if [ "${{ needs.push-image.result }}" != "success" ]; then
echo "::error::push-image must succeed, got: ${{ needs.push-image.result }}"
exit 1
fi
if [ "${{ needs.push-image.outputs.ci_push_ok }}" != "1" ]; then
echo "::error::push-image incomplete (output missing)"
exit 1
fi
fi
echo "CI gate OK"