CI/CD Fixes

This commit is contained in:
Sumner Evans
2019-10-17 15:26:07 +00:00
parent bb20c358d6
commit ff062b79ed
5 changed files with 100 additions and 1 deletions

View File

@@ -1,9 +1,54 @@
stages:
- test
- build
- deploy
- verify
variables:
GIT_SUBMODULE_STRATEGY: recursive
image: ubuntu:18.10
lint:
stage: test
allow_failure: true
before_script:
- apt update
- apt install -y python3-pip libcairo2-dev pkg-config
- pip3 install -r dev-requirements.txt
- pip3 install -e .
script:
- python3 setup.py check -mrs
- pycodestyle
test:
stage: test
before_script:
- apt update
- apt install -y python3-pip libcairo2-dev pkg-config libgtk-3-dev libmpv-dev libglib2.0-dev gir1.2-notify-0.7
- pip3 install -r dev-requirements.txt
- pip3 install -e .
script:
- ./cicd/pytest.sh
artifacts:
paths:
- htmlcov
build:
stage: build
before_script:
- apt update
- apt install -y python3-pip libcairo2-dev pkg-config
- pip3 install -r dev-requirements.txt
script:
- python3 setup.py sdist
artifacts:
paths:
- dist/*
build_flatpak:
image: registry.gitlab.com/robozman/libremsonic/libremsonic/build:latest
stage: build
script:
- cd flatpak
- ./flatpak_build.sh
@@ -11,3 +56,25 @@ build_flatpak:
name: "libremsonic-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA"
paths:
- flatpak/libremsonic.flatpak
deploy_pypi:
image: python:3.6-alpine
stage: deploy
only:
- master
before_script:
- 'pip install twine'
- './create-pypirc.sh'
script:
# Upload to the test PyPi instance, then upload to the real one.
- twine upload -r pypi_test dist/*
- twine upload dist/*
after_script:
- echo "" > ~/.pypirc && rm -f ~/.pypirc
verify_deploy:
stage: verify
only:
- master
script:
- pip3 install libremsonic

12
cicd/pytest.sh Executable file
View File

@@ -0,0 +1,12 @@
#! /bin/sh
pytest
ec=$?
echo "pytest exited with exit code $ec"
case $ec in
0) exit 0 ;;
5) exit 0 ;;
*) exit 1 ;;
esac

14
create-pypirc.sh Normal file
View File

@@ -0,0 +1,14 @@
#! /bin/sh
echo "[distutils]" >> ~/.pypirc
echo "index-servers =" >> ~/.pypirc
echo " pypi" >> ~/.pypirc
echo " pypi_test" >> ~/.pypirc
echo "[pypi]" >> ~/.pypirc
echo "username: ${PYPI_USER}" >> ~/.pypirc
echo "password: ${PYPI_PASSWORD}" >> ~/.pypirc
echo "[pypi_test]" >> ~/.pypirc
echo "repository: https://test.pypi.org/legacy/" >> ~/.pypirc
echo "username: ${PYPI_USER}" >> ~/.pypirc
echo "password: ${PYPI_TEST_PASSWORD}" >> ~/.pypirc

5
dev-requirements.txt Normal file
View File

@@ -0,0 +1,5 @@
pytest
pytest-cov
docutils
pycodestyle
lxml

View File

@@ -2,6 +2,7 @@
addopts =
-vvv
--doctest-modules
--cov=tracktime
--ignore-glob='api_object_generator'
--cov=libremsonic
--cov-report html
--cov-report term