Skip to content

Commit 8c9aea5

Browse files
Adjust CI
1 parent 3bae290 commit 8c9aea5

1 file changed

Lines changed: 56 additions & 29 deletions

File tree

.github/workflows/pr.yml

Lines changed: 56 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -34,34 +34,6 @@ jobs:
3434
run: |
3535
cd projects/policyengine-${{ matrix.service }}
3636
uv run pytest tests/ -v
37-
38-
test-integration:
39-
name: Test integration
40-
runs-on: ubuntu-latest
41-
42-
steps:
43-
- uses: actions/checkout@v4
44-
45-
- name: Set up Python
46-
uses: actions/setup-python@v5
47-
with:
48-
python-version: '3.13'
49-
50-
- name: Install uv
51-
uses: astral-sh/setup-uv@v3
52-
with:
53-
enable-cache: true
54-
55-
- name: Generate API clients
56-
run: |
57-
./scripts/generate-clients.sh
58-
59-
- name: Run integration tests
60-
run: |
61-
cd projects/policyengine-apis-integ
62-
uv sync --extra test
63-
# Run tests that don't require authentication
64-
uv run pytest tests/full/test_ping.py tests/simulation/test_ping.py -v || true
6537
6638
lint:
6739
name: Lint
@@ -92,6 +64,7 @@ jobs:
9264
9365
docker-build:
9466
name: Docker build
67+
needs: [test, lint] # Only run if tests and linting pass
9568
runs-on: ubuntu-latest
9669
strategy:
9770
matrix:
@@ -112,4 +85,58 @@ jobs:
11285
tags: policyengine-${{ matrix.service }}:test
11386
cache-from: type=gha
11487
cache-to: type=gha,mode=max
115-
platforms: linux/amd64
88+
platforms: linux/amd64
89+
90+
test-integration:
91+
name: Test integration
92+
needs: docker-build # Only run if docker builds succeed
93+
runs-on: ubuntu-latest
94+
95+
steps:
96+
- uses: actions/checkout@v4
97+
98+
- name: Set up Python
99+
uses: actions/setup-python@v5
100+
with:
101+
python-version: '3.13'
102+
103+
- name: Install uv
104+
uses: astral-sh/setup-uv@v3
105+
with:
106+
enable-cache: true
107+
108+
- name: Generate API clients
109+
run: |
110+
./scripts/generate-clients.sh
111+
112+
- name: Start services
113+
run: |
114+
docker-compose -f deployment/docker-compose.yml up -d
115+
# Wait for services to be ready
116+
sleep 10
117+
# Check services are responding
118+
for i in {1..30}; do
119+
if curl -f http://localhost:8081/ping/alive && curl -f http://localhost:8082/ping/alive; then
120+
echo "Services are ready!"
121+
break
122+
fi
123+
echo "Waiting for services... (attempt $i/30)"
124+
sleep 2
125+
done
126+
127+
- name: Run integration tests
128+
run: |
129+
cd projects/policyengine-apis-integ
130+
uv sync --extra test
131+
# Run tests that don't require authentication
132+
uv run pytest tests/full/test_ping.py tests/simulation/test_ping.py -v
133+
134+
- name: Show service logs on failure
135+
if: failure()
136+
run: |
137+
docker-compose -f deployment/docker-compose.yml logs
138+
139+
- name: Stop services
140+
if: always()
141+
run: |
142+
docker-compose -f deployment/docker-compose.yml down

0 commit comments

Comments
 (0)