6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-12-04 19:03:39 +00:00

Simplify CI

This comes after a big refactoring of our CI pipeline.
This commit is contained in:
Régis Behmo 2020-10-02 13:34:54 +02:00
parent 91c28a5de4
commit 9d0f2d9178
3 changed files with 40 additions and 63 deletions

View File

@ -7,26 +7,17 @@ stages:
test:
script:
- apk add --no-cache make
- make ci-install-alpine-requirements
- pip install .
- make ci-install-python-requirements
- make bootstrap-dev
- make test
build:images:
script:
- apk add --no-cache make
- make ci-install-alpine-requirements
- pip install .
- make ci-build-images
tags:
- private
- make ci-bootstrap-images
- tutor images build all
stage: build
build:docs:
script:
- apk add --no-cache make
- make ci-install-alpine-requirements
- pip install -r requirements/docs.txt
- make docs
artifacts:
@ -36,10 +27,8 @@ build:docs:
build:pypi:
script:
- apk add --no-cache make
- make ci-install-alpine-requirements
- make ci-install-python-requirements
- make package
- make bootstrap-dev
- make build-pythonpackage
artifacts:
paths:
- dist/
@ -47,28 +36,20 @@ build:pypi:
deploy:images:
script:
- apk add --no-cache make
- make ci-install-alpine-requirements
- pip install .
- make ci-push-images
- make ci-bootstrap-images
- docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
- tutor images push all
only:
- tags
tags:
- private
stage: deploy:images
deploy:pypi:
script:
- apk add --no-cache make
- make ci-install-alpine-requirements
- make ci-install-python-requirements
- make ci-pypi
- make push-pythonpackage
dependencies:
- build:pypi
only:
- tags
tags:
- private
stage: deploy:pypi
deploy:docs:

View File

@ -9,16 +9,24 @@ matrix:
- os: osx
language: generic
env:
jobs:
- PATH=/tmp/bin/:$PATH
script:
# In Mac OS python and pip binaries are v2, so we create symlinks
- mkdir /tmp/bin && ln -s $(which python3) /tmp/bin/python && ln -s $(which pip3) /tmp/bin/pip
- pip install --upgrade pip setuptools==44.0.0
- make ci-info
- make ci-install-plugins
- make bootstrap-dev-plugins
- make test
- make ci-bundle
- make bundle
- make ci-test-bundle
deploy:
# Create github release and push binary to github
- provider: script
script: make ci-github
script: make ci-push-bundle
skip_cleanup: true
on:
tags: true

View File

@ -18,10 +18,13 @@ upgrade-requirements: ## Upgrade requirements files
pip-compile --upgrade requirements/dev.in
pip-compile --upgrade requirements/docs.in
package: ## Build a package ready to upload to pypi
python3 setup.py sdist
build-pythonpackage: ## Build a python package ready to upload to pypi
python setup.py sdist
test: test-lint test-unit test-format test-package ## Run all tests by decreasing order or priority
push-pythonpackage: ## Push python packages to pypi
twine upload --skip-existing dist/tutor-*.tar.gz
test: test-lint test-unit test-format test-pythonpackage ## Run all tests by decreasing order or priority
test-format: ## Run code formatting tests
black --check --diff $(BLACK_OPTS)
@ -30,14 +33,21 @@ test-lint: ## Run code linting tests
pylint --errors-only --ignore=templates ${SRC_DIRS}
test-unit: ## Run unit tests
python3 -m unittest discover tests
python -m unittest discover tests
test-package: package ## Test that package can be uploaded to pypi
test-pythonpackage: build-pythonpackage ## Test that package can be uploaded to pypi
twine check dist/tutor-openedx-$(shell make version).tar.gz
format: ## Format code automatically
black $(BLACK_OPTS)
bootstrap-dev: ## Install dev requirements
pip install .
pip install -r requirements/dev.txt
bootstrap-dev-plugins: bootstrap-dev ## Install dev requirement and all supported plugins
pip install -r requirements/plugins.txt
###### Deployment
bundle: ## Bundle the tutor package in a single "dist/tutor" executable
@ -69,22 +79,10 @@ release-overhangio:
###### Continuous integration tasks
ci-info: ## Print info about environment
python3 --version
pip3 --version
python --version
pip --version
ci-install-alpine-requirements: ## Install requirements for a python:alpine image
apk add --no-cache docker gcc libffi-dev libressl-dev musl-dev yaml-dev
ci-install-python-requirements: ## Install requirements
pip3 install --upgrade pip
pip3 install setuptools==44.0.0
pip install .
pip3 install -r requirements/dev.txt
ci-install-plugins: ci-install-python-requirements ## Install all supported plugins
pip3 install -r requirements/plugins.txt
ci-bundle: bundle ## Create bundle and run basic tests
ci-test-bundle: ## Run basic tests on bundle
ls -lh ./dist/tutor
./dist/tutor --version
./dist/tutor config printroot
@ -103,7 +101,7 @@ ci-bundle: bundle ## Create bundle and run basic tests
&& bzip2 -d -f ./github-release.bz2 \
&& chmod a+x ./github-release
ci-github: ./releases/github-release ## Upload assets to github
ci-push-bundle: ./releases/github-release ## Upload assets to github
sed "s/TUTOR_VERSION/v$(shell make version)/g" docs/_release_description.md > releases/description.md
git log -1 --pretty=format:%b >> releases/description.md
./releases/github-release release \
@ -121,19 +119,9 @@ ci-github: ./releases/github-release ## Upload assets to github
--replace
ci-bootstrap-images:
pip install -r requirements/plugins.txt
pip install .
tutor config save
ci-build-images: ci-bootstrap-images ## Build docker images
tutor images build all
ci-push-images: ci-bootstrap-images ## Push docker images to hub.docker.com
docker login -u "$$DOCKER_USERNAME" -p "$$DOCKER_PASSWORD"
tutor images push all
ci-pypi: ## Push packages to pypi
twine upload --skip-existing dist/tutor-*.tar.gz
###### Additional commands
version: ## Print the current tutor version