Move tasks from travis-ci to gitlab CI

We only keep travis-ci for building MacOS/Linux binaries.
This commit is contained in:
Régis Behmo 2019-06-23 17:01:28 +02:00 committed by Régis Behmo
parent 205cd9bf1c
commit dce234bc1e
4 changed files with 89 additions and 47 deletions

70
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,70 @@
stages:
- build
- deploy:docs # TODO move this to the end
- deploy:images
- deploy:pypi
build:images:
script:
- apk add --no-cache docker make
- python setup.py install
- make ci-build-images
tags:
- private
stage: build
build:docs:
script:
- apk add --no-cache make
- pip install -r requirements/docs.txt
- cd docs && make
artifacts:
paths:
- docs/_build/html
stage: build
build:pypi:
script:
- apk add --no-cache make
- pip install -r requirements/base.txt
- pip install -r requirements/plugins.txt
- make package
artifacts:
paths:
- dist/
stage: build
deploy:images:
script:
- apk add --no-cache docker make
- python setup.py install
- make ci-push-images
only:
- tags
tags:
- private
stage: deploy:images
deploy:pypi:
script:
- apk add --no-cache make
- make ci-pypi
dependencies:
- build:pypi
only:
- tags
tags:
- private
stage: deploy:pypi
deploy:docs:
dependencies:
- build:docs
script:
- cp -r docs/_build/html/ /var/www/docs.tutor.overhang.io
only:
- tags
tags:
- private
stage: deploy:docs

View File

@ -8,26 +8,8 @@ matrix:
python: 3.6
services:
- docker
env:
BUILD_BINARY: "true"
- os: linux
dist: xenial
python: 3.6
services:
- docker
env:
BUILD_DOCKER: "true"
- os: linux
dist: xenial
python: 3.6
services:
- docker
env:
BUILD_PYPI: "true"
- os: osx
language: generic
env:
BUILD_BINARY: "true"
script:
- make ci-info
@ -41,21 +23,4 @@ deploy:
script: make ci-github
skip_cleanup: true
on:
tags: true
condition: $BUILD_BINARY = true
# Push docker images to docker hub
- provider: script
script: make ci-images
skip_cleanup: true
on:
tags: true
condition: $BUILD_DOCKER = true && $TRAVIS_TAG != "nightly"
# Push to pypi
- provider: script
script: make ci-pypi
skip_cleanup: true
on:
tags: true
condition: $BUILD_PYPI = true && $TRAVIS_TAG != "nightly"
tags: true

View File

@ -10,7 +10,6 @@ compile-requirements: ## Compile requirements files
pip-compile -o requirements/docs.txt requirements/docs.in
package: ## Build a package ready to upload to pypi
pip install twine
python3 setup.py sdist
test: test-lint test-unit test-format test-package ## Run all tests by decreasing order or priority
@ -52,9 +51,12 @@ tag:
@echo "=== Creating tag $(TAG)"
git tag -d $(TAG) || true
git tag $(TAG)
@echo "=== Pushing tag $(TAG)"
@echo "=== Pushing tag $(TAG) to origin"
git push origin :$(TAG) || true
git push origin $(TAG)
@echo "=== Pushing tag $(TAG) to overhangio"
git push overhangio :$(TAG) || true
git push overhangio $(TAG)
###### Continuous integration tasks
@ -63,7 +65,7 @@ ci-info: ## Print info about environment
pip3 --version
ci-install: ## Install requirements
pip3 install -U setuptools
pip3 install -U setuptools twine
pip3 install -r requirements/dev.txt
pip3 install -r requirements/plugins.txt
@ -97,16 +99,20 @@ ci-github: ./releases/github-release ## Upload assets to github
--tag "v$(shell make version)" \
--name "tutor-$$(uname -s)_$$(uname -m)" \
--file ./dist/tutor \
--replace
--replace
ci-images: ## Build and push docker images to hub.docker.com
python setup.py develop
ci-config-images:
tutor config save --set ACTIVATE_NOTES=true --set ACTIVATE_XQUEUE=true
ci-build-images: ci-config-images ## Build docker images
tutor images build all
tutor local init
docker login -u "$$DOCKER_USERNAME" -p "$$DOCKER_PASSWORD"
tutor images push all
ci-pypi: package ## Push release to pypi
ci-push-images: ci-config-images ## Push docker images to hub.docker.com
docker login -u "$$DOCKER_USERNAME" -p "$$DOCKER_PASSWORD"
tutor images push all
ci-pypi: ## Push release to pypi
pip install twine
twine upload dist/*.tar.gz
###### Additional commands

View File

@ -65,7 +65,8 @@ Releasing a new version
- Bump the ``__version__`` value in ``tutor/__about__.py``.
- Replace "Latest" by the version name in CHANGELOG.md.
- Create a commit with the version changelog.
- ``git push``
- Push changes to github: ``git push origin``
- Push changes to git.overhang.io: ``git push overhangio``
- ``make release``
After a regular push to ``master``, run ``make nightly`` to update the "nightly" tag.