61d45b318d
CI разбит на test + push-image; deploy-ift проверяет образ в registry. Gate-шаги ловят незавершённый job (exit -1 / context canceled). Co-authored-by: Cursor <cursoragent@cursor.com>
110 lines
3.2 KiB
YAML
110 lines
3.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
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: 'npm'
|
|
|
|
- run: npm ci
|
|
- run: npm run lint
|
|
- run: npm run build
|
|
|
|
- name: Mark test complete
|
|
if: success()
|
|
run: mkdir -p "${RUNNER_TEMP}/ci-gate" && touch "${RUNNER_TEMP}/ci-gate/test"
|
|
|
|
- name: Test completion gate
|
|
if: always()
|
|
run: |
|
|
if [ ! -f "${RUNNER_TEMP}/ci-gate/test" ]; then
|
|
echo "::error::Test job incomplete (step cancelled — act_runner bug?). Re-run CI."
|
|
exit 1
|
|
fi
|
|
|
|
push-image:
|
|
needs: test
|
|
if: github.event_name == 'push'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- 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
|
|
if: success()
|
|
run: mkdir -p "${RUNNER_TEMP}/ci-gate" && touch "${RUNNER_TEMP}/ci-gate/push"
|
|
|
|
- name: Push completion gate
|
|
if: always()
|
|
run: |
|
|
if [ ! -f "${RUNNER_TEMP}/ci-gate/push" ]; then
|
|
echo "::error::Push job incomplete (step cancelled — act_runner bug?). Re-run CI."
|
|
exit 1
|
|
fi
|