From 61712a4fce86071a1ad1f6be8008d7410f479b1a Mon Sep 17 00:00:00 2001 From: Rasmus Schultz Date: Mon, 27 May 2024 14:02:23 +0200 Subject: [PATCH] Merge branch 'integration-test-with-docker-on-github-actions' --- .github/workflows/ci.yml | 17 +++++++++++++++++ Dockerfile | 3 ++- docker-compose.yml | 2 -- test.sh | 4 ++++ 4 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..fc0e277 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,17 @@ +name: CI + +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Compose + run: sudo apt-get update && sudo apt-get install -y docker-compose + + - name: Run tests + run: ./test.sh diff --git a/Dockerfile b/Dockerfile index 97ba761..396ea1a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,7 @@ FROM php:8.1-cli RUN apt-get update && apt-get install -y \ libpq-dev \ mariadb-client \ + unzip \ && docker-php-ext-install pdo pdo_mysql pdo_pgsql # Install xdebug @@ -23,7 +24,7 @@ COPY . /app WORKDIR /app # Install PHP dependencies -RUN composer update +RUN composer update --no-interaction --prefer-dist # Keep the container running by default CMD ["/bin/sh"] diff --git a/docker-compose.yml b/docker-compose.yml index 20a010a..3da7ec3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,8 +3,6 @@ services: build: context: . dockerfile: Dockerfile - volumes: - - .:/app depends_on: postgres: condition: service_healthy diff --git a/test.sh b/test.sh index 0fe37d5..a4b0f72 100755 --- a/test.sh +++ b/test.sh @@ -3,6 +3,10 @@ # Ensure the script exits on any error set -e +# Uncomment this while changing the Dockerfile +#docker compose down +#docker compose build + # Start the Docker services if not already running docker compose up -d