@@ -33,79 +33,59 @@ jobs:
3333 fi
3434
3535 # Add hostnames for container-to-container networking
36+ # The 'delphi' service in 'docker-compose.test.yml' reads these
3637 echo "POSTGRES_HOST=postgres" >> .env
3738 echo "DYNAMODB_ENDPOINT=http://dynamodb:8000" >> .env
3839 echo "AWS_S3_ENDPOINT=http://minio:9000" >> .env
3940
4041 - name : 3. Build Docker images
4142 run : |
42- # Use the test-specific compose file
43+ # Build all services in the test file (including delphi)
4344 docker compose -f docker-compose.test.yml --env-file .env build
4445
4546 - name : 4. Start all services
4647 run : |
4748 # Start all services (including delphi) in detached mode
49+ # The 'delphi' container will start and run 'tail -f /dev/null'
4850 docker compose -f docker-compose.test.yml --env-file .env up -d
4951
5052 echo "Waiting for services to be healthy..."
51- sleep 30 # Initial wait
53+ sleep 20 # Wait for containers to start
5254 docker compose -f docker-compose.test.yml ps
5355
5456 - name : 5. Check service health
5557 run : |
56- # Run health checks from the runner, hitting localhost
57- # This mimics the cypress-run workflow exactly
58-
58+ # Wait for postgres to be ready
5959 echo "Checking postgres..."
60- docker compose -f docker-compose.test.yml exec -T postgres pg_isready -U postgres
61-
62- echo "Checking server API (via nginx-proxy on localhost)..."
63- curl -f --retry 12 --retry-delay 10 --retry-connrefused http://localhost/api/v3/participationInit
64-
65- echo "All services are ready!"
66-
67- - name : 6. Set up Python for Download Script
68- uses : actions/setup-python@v5
69- with :
70- python-version : ' 3.12'
71-
72- - name : 7. Install Download Script Dependencies
73- run : |
74- # Install script dependencies into the *runner's* environment
75- pip install psycopg2-binary requests python-dotenv
60+ docker compose -f docker-compose.test.yml exec -T postgres \
61+ bash -c 'until pg_isready -U $POSTGRES_USER; do sleep 5; done'
62+ echo "Postgres is ready."
7663
77- - name : 8 . Run Data Download Script
64+ - name : 6 . Run Delphi Pytest
7865 run : |
79- # Run the script on the RUNNER, not in a container
80- # It will connect to localhost:80 (nginx) and localhost:5432 (postgres)
81- # This requires .env to have POSTGRES_HOST=localhost
82- echo "POSTGRES_HOST=localhost" >> .env
66+ # Use 'docker compose exec' to run a command inside the
67+ # *already-running* 'delphi' container.
68+ # We must 'docker cp' the test/data files into it first,
69+ # since 'exec' does not support volume mounts.
8370
84- cd delphi/tests
85- python download_real_data.py r4tykwac8thvzv35jrn53 r6vbnhffkxbd7ifmfbdrd --base-url https://pol.is
86- cd ../..
87-
88- echo "Data downloaded. Listing real_data contents:"
89- ls -lR delphi/real_data
71+ echo "Copying test files into container..."
72+ docker compose -f docker-compose.test.yml cp delphi/tests delphi:/app/tests
73+ docker compose -f docker-compose.test.yml cp delphi/real_data delphi:/app/real_data
9074
91- - name : 9. Run Delphi Pytest
92- run : |
93- # Now we EXEC into the running 'delphi' container
94- # We also mount the data we just downloaded
75+ echo "Running tests..."
9576 docker compose \
9677 -f docker-compose.test.yml \
9778 --env-file .env \
9879 exec -T \
99- -v "${{ github.workspace }}/delphi/real_data:/app/delphi/real_data" \
10080 delphi \
10181 bash -c " \
10282 echo '--- Installing Pytest ---'; \
10383 pip install pytest; \
10484 echo '--- Running Pytest ---'; \
105- pytest /app/delphi/ tests \
85+ pytest /app/tests \
10686 "
10787
108- - name : 10 . Show service logs on failure
88+ - name : 7 . Show service logs on failure
10989 if : failure()
11090 run : |
11191 echo "=== Delphi service logs ==="
@@ -114,10 +94,8 @@ jobs:
11494 docker compose -f docker-compose.test.yml logs postgres || true
11595 echo "=== DynamoDB service logs ==="
11696 docker compose -f docker-compose.test.yml logs dynamodb || true
117- echo "=== Nginx service logs ==="
118- docker compose -f docker-compose.test.yml logs nginx-proxy || true
11997
120- - name : 11 . Clean up services
98+ - name : 8 . Clean up services
12199 if : always()
122100 run : |
123101 echo "Cleaning up services..."
0 commit comments