Skip to content

Commit

Permalink
Add makefile target to run GitLab CI jobs locally
Browse files Browse the repository at this point in the history
Requires installing the OS gitlab-runner package, and Docker.

Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
  • Loading branch information
Roberto Rosario committed Jan 18, 2020
1 parent aa6e66f commit ac6dc08
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ node_modules/
docs/build/
docs/_templates/layout.html
docs/_templates/footer.html
gitlab-ci-volume/
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Cleanup repository top level. Moved helper scripts to contrib/scripts.
- Add makefile target to make it easier to create the code coverage report.
- Remove unused Magnum and Travis CI files.
- Add makefile target to run GitLab CI jobs locally.

3.3.8 (2020-01-17)
==================
Expand Down
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ test-with-mysql: test-launch-mysql
@docker rm -f test-mysql || true
@docker volume rm test-mysql || true


test-with-mysql-all: ## Run all tests against a MySQL database container.
test-with-mysql-all: test-launch-mysql
./manage.py test --mayan-apps --settings=mayan.settings.testing.docker.db_mysql --nomigrations
Expand Down Expand Up @@ -106,6 +105,16 @@ test-with-oracle-all: test-launch-oracle
@docker rm -f test-oracle || true
@docker volume rm test-oracle || true

gitlab-ci-run: ## Execute a GitLab CI job locally
gitlab-ci-run:
@if [ -z "$$(docker images gitlab-runner-helper:11.2.0)" ]; then \
echo "1) Make sure to download the corresponding helper image from https://hub.docker.com/r/gitlab/gitlab-runner-helper/tags"; \
echo "2) Tag the download image as gitlab-runner-helper:11.2.0"; \
exit 1; \
fi; \
if [ -z $(GITLAB_CI_JOB) ]; then echo "Specify the job to execute using GITLAB_CI_JOB."; exit 1; fi; \
gitlab-runner exec docker --docker-volumes $$PWD/gitlab-ci-volume:/builds $(GITLAB_CI_JOB)

# Coverage

coverage-run: ## Run all tests and measure code execution.
Expand Down

0 comments on commit ac6dc08

Please sign in to comment.