ci: service postgres externe + docker run sans DinD
- Supprime container: (checkout@v4 nécessite node, absent de eclipse-temurin) - PostgreSQL via services: avec port mapping localhost:5432 - Tests dans docker run --network host avec env vars datasource Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+15
-9
@@ -11,8 +11,6 @@ jobs:
|
||||
test:
|
||||
name: Tests
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: eclipse-temurin:25-jdk
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16
|
||||
@@ -20,19 +18,27 @@ jobs:
|
||||
POSTGRES_DB: olhar_test
|
||||
POSTGRES_USER: olhar
|
||||
POSTGRES_PASSWORD: olhar
|
||||
env:
|
||||
SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/olhar_test
|
||||
SPRING_DATASOURCE_USERNAME: olhar
|
||||
SPRING_DATASOURCE_PASSWORD: olhar
|
||||
SPRING_DATASOURCE_DRIVER_CLASS_NAME: org.postgresql.Driver
|
||||
SECURITY_JWT_SECRET: test-secret-key-for-ci-testing-only-must-be-long-enough
|
||||
ports:
|
||||
- 5432:5432
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build image de test
|
||||
run: docker build -f Dockerfile.test -t olhar-api-test:ci .
|
||||
|
||||
- name: Lancer les tests
|
||||
run: ./gradlew test --no-daemon
|
||||
run: |
|
||||
docker run --rm \
|
||||
--network host \
|
||||
-e SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/olhar_test \
|
||||
-e SPRING_DATASOURCE_USERNAME=olhar \
|
||||
-e SPRING_DATASOURCE_PASSWORD=olhar \
|
||||
-e SPRING_DATASOURCE_DRIVER_CLASS_NAME=org.postgresql.Driver \
|
||||
-e SECURITY_JWT_SECRET=test-secret-key-for-ci-testing-only-must-be-long-enough \
|
||||
olhar-api-test:ci \
|
||||
./gradlew test --no-daemon
|
||||
|
||||
build-and-push:
|
||||
name: Build & push image Docker
|
||||
|
||||
Reference in New Issue
Block a user