-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9042f92
commit d02e193
Showing
2 changed files
with
127 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
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: Pull all images | ||
run: | | ||
docker compose pull --ignore-pull-failures | ||
- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
Docker Compose Drupal base - php8, nginx, mariadb | ||
================================================= | ||
|
||
This is a docker compose version of the Lando example tests: | ||
|
||
Start up tests | ||
-------------- | ||
|
||
Run the following commands to get up and running with this example. | ||
|
||
```bash | ||
# Should remove any previous runs and poweroff | ||
sed -i -e "/###/d" docker-compose.yml | ||
docker network inspect amazeeio-network >/dev/null || docker network create amazeeio-network | ||
docker compose down | ||
|
||
# Should start up our Lagoon Drupal site successfully | ||
docker compose build && docker compose up -d | ||
|
||
# Ensure mariadb pod is ready to connect | ||
docker compose exec cli bash -c 'wait-for mariadb:3306' | ||
``` | ||
|
||
Verification commands | ||
--------------------- | ||
|
||
Run the following commands to validate things are rolling as they should. | ||
|
||
```bash | ||
# Should be able to site install via Drush | ||
docker compose exec -T cli bash -c "drush si -y" | ||
docker compose exec -T cli bash -c "drush cr -y" | ||
docker compose exec -T cli bash -c "drush status" | grep "Drupal bootstrap" | grep "Successful" | ||
|
||
# Should have all the services we expect | ||
docker ps --filter label=com.docker.compose.project=drupal-cms-example | grep Up | grep drupal-cms-example-nginx-1 | ||
docker ps --filter label=com.docker.compose.project=drupal-cms-example | grep Up | grep drupal-cms-example-mariadb-1 | ||
docker ps --filter label=com.docker.compose.project=drupal-cms-example | grep Up | grep drupal-cms-example-php-1 | ||
docker ps --filter label=com.docker.compose.project=drupal-cms-example | grep Up | grep drupal-cms-example-cli-1 | ||
|
||
# Should ssh against the cli container by default | ||
docker compose exec -T cli bash -c "env | grep LAGOON=" | grep cli-drupal | ||
|
||
# Should have the correct environment set | ||
docker compose exec -T cli bash -c "env" | grep LAGOON_ROUTE | grep drupal-cms-example.localhost | ||
docker compose exec -T cli bash -c "env" | grep LAGOON_ENVIRONMENT_TYPE | grep development | ||
|
||
# Should be running PHP 8 | ||
docker compose exec -T cli bash -c "php -v" | grep "PHP 8" | ||
|
||
# Should have composer | ||
docker compose exec -T cli bash -c "composer --version" | ||
|
||
# Should have php cli | ||
docker compose exec -T cli bash -c "php --version" | ||
|
||
# Should have drush | ||
docker compose exec -T cli bash -c "drush --version" | ||
|
||
# Should have npm | ||
docker compose exec -T cli bash -c "npm --version" | ||
|
||
# Should have node | ||
docker compose exec -T cli bash -c "node --version" | ||
|
||
# Should have yarn | ||
docker compose exec -T cli bash -c "yarn --version" | ||
|
||
# Should have a running Drupal site served by nginx on port 8080 | ||
docker compose exec -T cli bash -c "curl -kL http://nginx:8080" | grep "Drush Site-Install" | ||
|
||
# Should be able to db-export and db-import the database | ||
docker compose exec -T cli bash -c "drush sql-dump --result-file /app/test.sql" | ||
docker compose exec -T cli bash -c "drush sql-drop -y" | ||
docker compose exec -T cli bash -c "drush sql-cli < /app/test.sql" | ||
docker compose exec -T cli bash -c "rm test.sql*" | ||
|
||
# Should be able to show the drupal tables | ||
docker compose exec -T cli bash -c "echo U0hPVyBUQUJMRVM7 | base64 -d > /app/showtables.sql" | ||
docker compose exec -T cli bash -c "drush sqlq --file /app/showtables.sql" | grep users | ||
|
||
# Should be able to rebuild and persist the database | ||
docker compose build && docker compose up -d | ||
docker compose exec -T cli bash -c "echo U0hPVyBUQUJMRVM7 | base64 -d > /app/showtables.sql" | ||
docker compose exec -T cli bash -c "drush sqlq --file /app/showtables.sql" | grep users | ||
``` | ||
|
||
Destroy tests | ||
------------- | ||
|
||
Run the following commands to trash this app like nothing ever happened. | ||
|
||
```bash | ||
# Should be able to destroy our Drupal site with success | ||
docker compose down --volumes --remove-orphans | ||
``` |