diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 79474fe60521918581444023a28e9692a9541878..f9d499b3b115425df62b67a978d9e58caf91899c 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 00d56e684d0c672a27636f69984ff8125c688854..b8c168dffd65b0a4dc5236026980419539312bae 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 893953888fb7bf23dd3379e78465591bf80a31a5..0000000000000000000000000000000000000000 --- 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