diff --git a/docker-compose.ci.yml b/docker-compose.ci.yml new file mode 100644 index 00000000..b517559c --- /dev/null +++ b/docker-compose.ci.yml @@ -0,0 +1,46 @@ +version: '3.9' + +services: + test-db: + image: mysql:8 + command: --default-authentication-plugin=mysql_native_password --sql_mode= + environment: + - MYSQL_DATABASE=${DB_NAME} + - MYSQL_ROOT_PASSWORD=${DB_PASS} + restart: always + healthcheck: + test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1"] + interval: 2s + timeout: 2s + retries: 10 + ports: + - ${DB_PORT}:3306 + volumes: + - test-data:/var/lib/mysql + networks: + - test-network + + test-redis: + image: arm64v8/redis:7-alpine + command: redis-server --requirepass ${REDIS_PASSWORD} + ports: + - ${REDIS_PORT}:6379 + depends_on: + test-db: + condition: service_healthy + networks: + - test-network + + stripe-api: + image: stripe/stripe-mock:latest-arm64 + ports: + - 12111:12111 + - 12112:12112 + networks: + - test-network + +volumes: + test-data: + +networks: + test-network: diff --git a/docker-compose.test.yml b/docker-compose.test.yml index 9ac34e99..3905b528 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -33,7 +33,7 @@ services: - test-network stripe-api: - image: stripe/stripe-mock:latest-arm64 + image: stripe/stripe-mock:latest ports: - 12111:12111 - 12112:12112 diff --git a/tests/run-tests.sh b/tests/run-tests.sh index 149a4d0c..2f9eb89b 100755 --- a/tests/run-tests.sh +++ b/tests/run-tests.sh @@ -2,7 +2,11 @@ export $(cat envs/.env.test | xargs) -alias dc="docker-compose -f docker-compose.test.yml" +if [ -z "$CI" ]; then + alias dc="docker-compose -f docker-compose.test.yml" +else + alias dc="docker-compose -f docker-compose.ci.yml" +fi trap "cleanup" EXIT