mirror of
https://github.com/ChristianLight/tutor.git
synced 2024-06-11 18:22:20 +00:00
Simplify CI
This comes after a big refactoring of our CI pipeline.
This commit is contained in:
parent
91c28a5de4
commit
9d0f2d9178
|
@ -7,26 +7,17 @@ stages:
|
||||||
|
|
||||||
test:
|
test:
|
||||||
script:
|
script:
|
||||||
- apk add --no-cache make
|
- make bootstrap-dev
|
||||||
- make ci-install-alpine-requirements
|
|
||||||
- pip install .
|
|
||||||
- make ci-install-python-requirements
|
|
||||||
- make test
|
- make test
|
||||||
|
|
||||||
build:images:
|
build:images:
|
||||||
script:
|
script:
|
||||||
- apk add --no-cache make
|
- make ci-bootstrap-images
|
||||||
- make ci-install-alpine-requirements
|
- tutor images build all
|
||||||
- pip install .
|
|
||||||
- make ci-build-images
|
|
||||||
tags:
|
|
||||||
- private
|
|
||||||
stage: build
|
stage: build
|
||||||
|
|
||||||
build:docs:
|
build:docs:
|
||||||
script:
|
script:
|
||||||
- apk add --no-cache make
|
|
||||||
- make ci-install-alpine-requirements
|
|
||||||
- pip install -r requirements/docs.txt
|
- pip install -r requirements/docs.txt
|
||||||
- make docs
|
- make docs
|
||||||
artifacts:
|
artifacts:
|
||||||
|
@ -36,10 +27,8 @@ build:docs:
|
||||||
|
|
||||||
build:pypi:
|
build:pypi:
|
||||||
script:
|
script:
|
||||||
- apk add --no-cache make
|
- make bootstrap-dev
|
||||||
- make ci-install-alpine-requirements
|
- make build-pythonpackage
|
||||||
- make ci-install-python-requirements
|
|
||||||
- make package
|
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- dist/
|
- dist/
|
||||||
|
@ -47,28 +36,20 @@ build:pypi:
|
||||||
|
|
||||||
deploy:images:
|
deploy:images:
|
||||||
script:
|
script:
|
||||||
- apk add --no-cache make
|
- make ci-bootstrap-images
|
||||||
- make ci-install-alpine-requirements
|
- docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
|
||||||
- pip install .
|
- tutor images push all
|
||||||
- make ci-push-images
|
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
tags:
|
|
||||||
- private
|
|
||||||
stage: deploy:images
|
stage: deploy:images
|
||||||
|
|
||||||
deploy:pypi:
|
deploy:pypi:
|
||||||
script:
|
script:
|
||||||
- apk add --no-cache make
|
- make push-pythonpackage
|
||||||
- make ci-install-alpine-requirements
|
|
||||||
- make ci-install-python-requirements
|
|
||||||
- make ci-pypi
|
|
||||||
dependencies:
|
dependencies:
|
||||||
- build:pypi
|
- build:pypi
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
tags:
|
|
||||||
- private
|
|
||||||
stage: deploy:pypi
|
stage: deploy:pypi
|
||||||
|
|
||||||
deploy:docs:
|
deploy:docs:
|
||||||
|
|
14
.travis.yml
14
.travis.yml
|
@ -9,16 +9,24 @@ matrix:
|
||||||
- os: osx
|
- os: osx
|
||||||
language: generic
|
language: generic
|
||||||
|
|
||||||
|
env:
|
||||||
|
jobs:
|
||||||
|
- PATH=/tmp/bin/:$PATH
|
||||||
|
|
||||||
script:
|
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-info
|
||||||
- make ci-install-plugins
|
- make bootstrap-dev-plugins
|
||||||
- make test
|
- make test
|
||||||
- make ci-bundle
|
- make bundle
|
||||||
|
- make ci-test-bundle
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
# Create github release and push binary to github
|
# Create github release and push binary to github
|
||||||
- provider: script
|
- provider: script
|
||||||
script: make ci-github
|
script: make ci-push-bundle
|
||||||
skip_cleanup: true
|
skip_cleanup: true
|
||||||
on:
|
on:
|
||||||
tags: true
|
tags: true
|
52
Makefile
52
Makefile
|
@ -18,10 +18,13 @@ upgrade-requirements: ## Upgrade requirements files
|
||||||
pip-compile --upgrade requirements/dev.in
|
pip-compile --upgrade requirements/dev.in
|
||||||
pip-compile --upgrade requirements/docs.in
|
pip-compile --upgrade requirements/docs.in
|
||||||
|
|
||||||
package: ## Build a package ready to upload to pypi
|
build-pythonpackage: ## Build a python package ready to upload to pypi
|
||||||
python3 setup.py sdist
|
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
|
test-format: ## Run code formatting tests
|
||||||
black --check --diff $(BLACK_OPTS)
|
black --check --diff $(BLACK_OPTS)
|
||||||
|
@ -30,14 +33,21 @@ test-lint: ## Run code linting tests
|
||||||
pylint --errors-only --ignore=templates ${SRC_DIRS}
|
pylint --errors-only --ignore=templates ${SRC_DIRS}
|
||||||
|
|
||||||
test-unit: ## Run unit tests
|
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
|
twine check dist/tutor-openedx-$(shell make version).tar.gz
|
||||||
|
|
||||||
format: ## Format code automatically
|
format: ## Format code automatically
|
||||||
black $(BLACK_OPTS)
|
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
|
###### Deployment
|
||||||
|
|
||||||
bundle: ## Bundle the tutor package in a single "dist/tutor" executable
|
bundle: ## Bundle the tutor package in a single "dist/tutor" executable
|
||||||
|
@ -69,22 +79,10 @@ release-overhangio:
|
||||||
###### Continuous integration tasks
|
###### Continuous integration tasks
|
||||||
|
|
||||||
ci-info: ## Print info about environment
|
ci-info: ## Print info about environment
|
||||||
python3 --version
|
python --version
|
||||||
pip3 --version
|
pip --version
|
||||||
|
|
||||||
ci-install-alpine-requirements: ## Install requirements for a python:alpine image
|
ci-test-bundle: ## Run basic tests on bundle
|
||||||
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
|
|
||||||
ls -lh ./dist/tutor
|
ls -lh ./dist/tutor
|
||||||
./dist/tutor --version
|
./dist/tutor --version
|
||||||
./dist/tutor config printroot
|
./dist/tutor config printroot
|
||||||
|
@ -103,7 +101,7 @@ ci-bundle: bundle ## Create bundle and run basic tests
|
||||||
&& bzip2 -d -f ./github-release.bz2 \
|
&& bzip2 -d -f ./github-release.bz2 \
|
||||||
&& chmod a+x ./github-release
|
&& 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
|
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
|
git log -1 --pretty=format:%b >> releases/description.md
|
||||||
./releases/github-release release \
|
./releases/github-release release \
|
||||||
|
@ -121,19 +119,9 @@ ci-github: ./releases/github-release ## Upload assets to github
|
||||||
--replace
|
--replace
|
||||||
|
|
||||||
ci-bootstrap-images:
|
ci-bootstrap-images:
|
||||||
pip install -r requirements/plugins.txt
|
pip install .
|
||||||
tutor config save
|
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
|
###### Additional commands
|
||||||
|
|
||||||
version: ## Print the current tutor version
|
version: ## Print the current tutor version
|
||||||
|
|
Loading…
Reference in New Issue
Block a user