From 5d3e627a5aa7a659fd4592bb0fec6a8c5a0638f0 Mon Sep 17 00:00:00 2001 From: Toby Bellwood Date: Wed, 11 Sep 2024 18:35:12 +1000 Subject: [PATCH] add github action --- .github/workflows/drupal-test.yaml | 42 +++++++++++++++++++++++ docker-compose.images.yml | 55 ++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 .github/workflows/drupal-test.yaml create mode 100644 docker-compose.images.yml diff --git a/.github/workflows/drupal-test.yaml b/.github/workflows/drupal-test.yaml new file mode 100644 index 0000000..904e7e8 --- /dev/null +++ b/.github/workflows/drupal-test.yaml @@ -0,0 +1,42 @@ +name: Drupal test routine + +on: + push: + branches: + - 'main' + - 'dev' + pull_request: + branches: + - 'main' + +jobs: + test-suite: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: "0" + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build and push local + uses: docker/bake-action@v5 + with: + load: true + set: | + *.platform=linux/amd64 + cli.tags=drupal-base-cli:latest + nginx.tags=drupal-base-nginx:latest + php.tags=drupal-base-php:latest + - name: replace docker-compose.yml + run: | + mv docker-compose.images.yml docker-compose.yml + - name: Install test harness + run: | + yarn add leia-parser mocha chai@4 command-line-test + - name: Generate test files + run: | + yarn leia "TESTING*.md" test -r 2 -s 'Start up tests' -t 'Verification commands' -c 'Destroy tests' --split-file + - name: Run docker compose tests + run: | + yarn mocha --timeout 900000 test/*compose*.func.js diff --git a/docker-compose.images.yml b/docker-compose.images.yml new file mode 100644 index 0000000..85c3e66 --- /dev/null +++ b/docker-compose.images.yml @@ -0,0 +1,55 @@ +services: + cli: # cli container, will be used for executing composer and any local commands (drush, drupal, etc.) + hostname: cli + image: drupal-base-cli:latest + labels: + # Lagoon Labels + lagoon.type: cli-persistent + lagoon.persistent.name: nginx # mount the persistent storage of nginx into this container + lagoon.persistent: /app/web/sites/default/files/ # location where the persistent storage should be mounted + lando.type: php-cli-drupal + user: root + + nginx: + hostname: nginx + image: drupal-base-nginx:latest + labels: + lagoon.type: nginx-php-persistent + lagoon.persistent: /app/web/sites/default/files/ # define where the persistent storage should be mounted too + lando.type: nginx-drupal + ports: + - "8080" # exposes the port 8080 with a random local port, find it with `docker-compose port nginx 8080` + user: "1000" + depends_on: + - cli # basically just tells docker-compose to build the cli first + environment: + LAGOON_LOCALDEV_URL: http://${COMPOSE_PROJECT_NAME:-drupal-base}.docker.amazee.io + networks: + - amazeeio-network + - default + + php: + hostname: php + image: drupal-base-php:latest + labels: + lagoon.type: nginx-php-persistent + lagoon.name: nginx # we want this service be part of the nginx pod in Lagoon + lagoon.persistent: /app/web/sites/default/files/ # define where the persistent storage should be mounted too + lando.type: php-fpm + user: "1000" + depends_on: + - cli # basically just tells docker-compose to build the cli first + + mariadb: + image: uselagoon/mariadb-10.11-drupal:latest + labels: + lagoon.type: mariadb + lando.type: mariadb-drupal + ports: + - "3306" # exposes the port 3306 with a random local port, find it with `docker-compose port mariadb 3306` + user: "1000" + +networks: + amazeeio-network: + external: true + default: