From de9fa18ff06bcc2191f404d3f2aa1e56ba09a0cd Mon Sep 17 00:00:00 2001 From: Raul Benencia Date: Sun, 4 Apr 2021 12:16:06 -0700 Subject: [PATCH] Add CI Some small changes to make the test suite behave with SalsaCI were required: contrib/docker/Makefile: - The "run" target now runs docker-compose detached. - The "tests" target does not need to run interactively. contrib/docker/scripts/run-tests: - We need to run only the CI tests here, otherwise producesReferenceDb times out. .gitmodules: - Switch from SSH to HTTPS for submodule cloning. SSH connections were not working on my tests. --- .gitlab-ci.yml | 16 ++++++++++++++++ .gitmodules | 2 +- contrib/docker/Makefile | 4 ++-- contrib/docker/scripts/run-tests | 4 +++- 4 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..195d963a --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,16 @@ +variables: + GIT_SUBMODULE_STRATEGY: recursive + +build: + image: docker:latest + stage: build + services: + - docker:dind + before_script: + - apk add docker-compose make + script: + - cd contrib/docker + - make build + - make update-db + - make run + - make tests diff --git a/.gitmodules b/.gitmodules index 6a3b94c4..2017d4bf 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "testdata"] path = testdata - url = git@salsa.debian.org:qa/debsources-testdata.git + url = https://salsa.debian.org/qa/debsources-testdata.git [submodule "archvsync"] path = archvsync url = https://ftp-master.debian.org/git/archvsync.git diff --git a/contrib/docker/Makefile b/contrib/docker/Makefile index c4879d3e..5aebf3a7 100644 --- a/contrib/docker/Makefile +++ b/contrib/docker/Makefile @@ -7,7 +7,7 @@ update-db: docker-compose run debsources /opt/db-update run: - docker-compose up + docker-compose up -d start-apache: docker exec -it docker_debsources_1 apache2ctl start @@ -16,4 +16,4 @@ attach: docker exec -it docker_debsources_1 /bin/bash tests: - docker exec -it docker_debsources_1 /opt/run-tests + docker exec docker_debsources_1 /opt/run-tests diff --git a/contrib/docker/scripts/run-tests b/contrib/docker/scripts/run-tests index 2da9ea65..35bc8404 100755 --- a/contrib/docker/scripts/run-tests +++ b/contrib/docker/scripts/run-tests @@ -1,3 +1,5 @@ #!/bin/bash /opt/db-init -nosetests3 -v /opt/debsources/lib/debsources/tests/ + +cd /opt/debsources +make test-travis