68 lines
1.8 KiB
YAML
68 lines
1.8 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [master, main]
|
|
pull_request:
|
|
|
|
# Один runner (DESKTOP-SIR8B3R): параллельные workflow ломают кэш act/actions.
|
|
concurrency:
|
|
group: eventhub-back-${{ 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: 60
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build eventhub image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: docker/Dockerfile
|
|
load: true
|
|
tags: eventhub:latest
|
|
provenance: false
|
|
sbom: false
|
|
|
|
- name: Build API test image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: docker/ApiTests.Dockerfile
|
|
load: true
|
|
tags: eventhub-api-tests:latest
|
|
provenance: false
|
|
sbom: false
|
|
|
|
- name: Run API tests (local CT)
|
|
run: docker run --rm eventhub-api-tests:latest
|
|
|
|
- name: Login to registry
|
|
if: github.event_name == 'push'
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: git.sabilin.com
|
|
username: ${{ secrets.REGISTRY_USER }}
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
- name: Push tested eventhub image
|
|
if: github.event_name == 'push'
|
|
run: |
|
|
set -euo pipefail
|
|
TAG="sha-${GITHUB_SHA:0:12}"
|
|
docker tag eventhub:latest "${REGISTRY}/eventhub:${TAG}"
|
|
docker tag eventhub:latest "${REGISTRY}/eventhub:ift"
|
|
docker push "${REGISTRY}/eventhub:${TAG}"
|
|
docker push "${REGISTRY}/eventhub:ift"
|