From 87f237244595a3f7ad8802c330c45c2fd5bbc410 Mon Sep 17 00:00:00 2001 From: Daniel Hornung <d.hornung@indiscale.com> Date: Mon, 5 Jul 2021 14:25:41 +0200 Subject: [PATCH] ENH: CI for mysql: Makefile has new target `pipeline-test` --- .gitlab-ci.yml | 22 ++++++++++------------ Makefile | 15 +++++++++++++++ include-test.yml | 9 --------- 3 files changed, 25 insertions(+), 21 deletions(-) delete mode 100644 include-test.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 79474fe..f9d499b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -58,21 +58,19 @@ build-testenv: ######## Test ######## -# Run the unit tests -unittests: +# Run the unit tests with MySQL +unittests-mysql: tags: [ docker ] stage: test - # script: - # - cp config.defaults .config - # - echo 'DATABASE_USER_HOST_LIST="%,"' >> .config - # - echo "MYSQL_USER_PASSWORD=$MYSQL_ROOT_PASSWORD" >> .config - # - echo "MYSQL_HOST=mysql" >> .config - # - sleep 10 - # - make install - # - ./utils/make_db restore_db tests/example.dump.sql - # - ./tests/test_utils.sh - include: "/include-test.yml" + script: + - make pipeline-test SQL_HOST=mysql +# Run the unit tests with MariaDB +unittests-mariadb: + tags: [ docker ] + stage: test + script: + - make pipeline-test SQL_HOST=mariadb ######## Deploy ######## diff --git a/Makefile b/Makefile index 00d56e6..b8c168d 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,9 @@ SHELL=/bin/bash INSTALL_SQL_FILE=db_2_0.sql +# The hostname, used by testing in the CI pipeline +SQL_HOST ?= mysql + .PHONY: test-connection test-connection: ./utils/make_db test-connection @@ -74,3 +77,15 @@ test-docker-stop: .PHONY: doc doc: $(MAKE) -C doc html + +# Run tests in a Gitlab pipeline +.PHONY: pipeline-test +pipeline-test: + cp config.defaults .config + echo 'DATABASE_USER_HOST_LIST="%,"' >> .config + echo "MYSQL_USER_PASSWORD=$MYSQL_ROOT_PASSWORD" >> .config + echo "MYSQL_HOST=$(SQL_HOST)" >> .config + sleep 10 + make install + ./utils/make_db restore_db tests/example.dump.sql + ./tests/test_utils.sh diff --git a/include-test.yml b/include-test.yml deleted file mode 100644 index 8939538..0000000 --- a/include-test.yml +++ /dev/null @@ -1,9 +0,0 @@ -script: - - cp config.defaults .config - - echo 'DATABASE_USER_HOST_LIST="%,"' >> .config - - echo "MYSQL_USER_PASSWORD=$MYSQL_ROOT_PASSWORD" >> .config - - echo "MYSQL_HOST=mysql" >> .config - - sleep 10 - - make install - - ./utils/make_db restore_db tests/example.dump.sql - - ./tests/test_utils.sh -- GitLab