forked from mtusi2026/mtusi2026lab2
fix: isolate Docker services in CI
This commit is contained in:
+11
-5
@@ -15,6 +15,8 @@ jobs:
|
||||
verify:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
env:
|
||||
COMPOSE_FILE: compose.ci.yaml
|
||||
steps:
|
||||
- name: Checkout exact commit
|
||||
run: |
|
||||
@@ -55,21 +57,23 @@ jobs:
|
||||
- name: Prepare local stack
|
||||
run: |
|
||||
cp lab2.env.example .env
|
||||
./scripts/init-local-secrets.sh
|
||||
docker compose config --quiet
|
||||
docker compose up -d --build --wait --wait-timeout 120
|
||||
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
|
||||
|
||||
- name: Public smoke
|
||||
run: make test
|
||||
run: make test BASE_URL=http://api:8080
|
||||
|
||||
- name: PostgreSQL and Valkey integration tests
|
||||
run: docker compose --profile tests run --rm --build tests
|
||||
|
||||
- name: Dependency outage recovery
|
||||
run: go run ./cmd/dependencycheck
|
||||
run: go run ./cmd/dependencycheck -base-url=http://api:8080
|
||||
|
||||
- name: Persistence test
|
||||
run: make test-persistence ACTION_SCRIPT=scripts/restart.sh
|
||||
run: make test-persistence ACTION_SCRIPT=scripts/restart.sh BASE_URL=http://api:8080
|
||||
|
||||
- name: Container logs
|
||||
if: failure()
|
||||
@@ -77,4 +81,6 @@ jobs:
|
||||
|
||||
- name: Stop local 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
|
||||
|
||||
@@ -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