forked from mtusi2026/mtusi2026lab2
fix: isolate Docker services in CI
This commit is contained in:
@@ -16,6 +16,8 @@ jobs:
|
||||
if: github.ref == 'refs/heads/main' && inputs.confirmation == 'DEPLOY'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
env:
|
||||
COMPOSE_FILE: compose.ci.yaml
|
||||
steps:
|
||||
- name: Checkout exact commit
|
||||
run: |
|
||||
@@ -49,16 +51,20 @@ jobs:
|
||||
- name: Verify release stack
|
||||
run: |
|
||||
cp lab2.env.example .env
|
||||
./scripts/init-local-secrets.sh
|
||||
docker compose up -d --build --wait --wait-timeout 120
|
||||
make test
|
||||
network=$(docker inspect --format '{{range $name, $_ := .NetworkSettings.Networks}}{{$name}}{{end}}' "$(docker compose ps -q api)")
|
||||
docker network connect "$network" "$HOSTNAME"
|
||||
printf '%s\n' "$network" > .ci-network
|
||||
make test BASE_URL=http://api:8080
|
||||
docker compose --profile tests run --rm --build tests
|
||||
go run ./cmd/dependencycheck
|
||||
make test-persistence ACTION_SCRIPT=scripts/restart.sh
|
||||
go run ./cmd/dependencycheck -base-url=http://api:8080
|
||||
make test-persistence ACTION_SCRIPT=scripts/restart.sh BASE_URL=http://api:8080
|
||||
|
||||
- name: Stop release stack
|
||||
if: always()
|
||||
run: if [ -f .env ]; then docker compose --profile tests down -v --remove-orphans; fi
|
||||
run: |
|
||||
if [ -f .ci-network ]; then docker network disconnect "$(cat .ci-network)" "$HOSTNAME"; fi
|
||||
if [ -f .env ]; then docker compose --profile tests down -v --remove-orphans; fi
|
||||
|
||||
- name: Configure SSH
|
||||
run: |
|
||||
|
||||
Reference in New Issue
Block a user