Use pipenv and pyenv for CI/CD pipeline.

This commit is contained in:
Sumner Evans
2019-11-24 01:44:08 +00:00
parent 9da03461b9
commit 0dbdd9ead8
6 changed files with 65 additions and 12 deletions

View File

@@ -8,6 +8,8 @@ stages:
variables: variables:
GIT_SUBMODULE_STRATEGY: recursive GIT_SUBMODULE_STRATEGY: recursive
LC_ALL: "C.UTF-8"
LANG: "C.UTF-8"
image: registry.gitlab.com/sumner/sublime-music/python-build:latest image: registry.gitlab.com/sumner/sublime-music/python-build:latest
@@ -15,20 +17,18 @@ lint:
stage: test stage: test
allow_failure: true allow_failure: true
before_script: before_script:
- pip3 install -r dev-requirements.txt - ./cicd/install-project-deps.sh
- pip3 install -e .
script: script:
- python3 setup.py check -mrs - pipenv run python setup.py check -mrs
- flake8 - pipenv run flake8
- mypy sublime - pipenv run mypy sublime
test: test:
stage: test stage: test
before_script: before_script:
- pip3 install -r dev-requirements.txt - ./cicd/install-project-deps.sh
- pip3 install -e .
script: script:
- ./cicd/pytest.sh - pipenv run ./cicd/pytest.sh
artifacts: artifacts:
paths: paths:
- htmlcov - htmlcov
@@ -36,9 +36,9 @@ test:
build: build:
stage: build stage: build
before_script: before_script:
- pip3 install -r dev-requirements.txt - ./cicd/install-project-deps.sh
script: script:
- python3 setup.py sdist - pipenv run python setup.py sdist
artifacts: artifacts:
paths: paths:
- dist/* - dist/*

View File

@@ -11,6 +11,8 @@ pytest = "*"
pytest-cov = "*" pytest-cov = "*"
docutils = "*" docutils = "*"
lxml = "*" lxml = "*"
jedi = "*"
rope = "*"
[packages] [packages]
sublime-music = {editable = true,path = "."} sublime-music = {editable = true,path = "."}

26
Pipfile.lock generated
View File

@@ -1,7 +1,7 @@
{ {
"_meta": { "_meta": {
"hash": { "hash": {
"sha256": "7f4f4f5e7a33a2def5c2670995d552cf9f0e0e5b969350d286fd082c314ec4cd" "sha256": "da004735aabedf3def0f7102ddce29046ab09e59d96277401d54098069a5c092"
}, },
"pipfile-spec": 6, "pipfile-spec": 6,
"requires": { "requires": {
@@ -276,6 +276,14 @@
"index": "pypi", "index": "pypi",
"version": "==3.7.9" "version": "==3.7.9"
}, },
"jedi": {
"hashes": [
"sha256:786b6c3d80e2f06fd77162a07fed81b8baa22dde5d62896a790a331d6ac21a27",
"sha256:ba859c74fa3c966a22f2aeebe1b74ee27e2a462f56d3f5f7ca4a59af61bfe42e"
],
"index": "pypi",
"version": "==0.15.1"
},
"lxml": { "lxml": {
"hashes": [ "hashes": [
"sha256:02ca7bf899da57084041bb0f6095333e4d239948ad3169443f454add9f4e9cb4", "sha256:02ca7bf899da57084041bb0f6095333e4d239948ad3169443f454add9f4e9cb4",
@@ -356,6 +364,13 @@
], ],
"version": "==19.2" "version": "==19.2"
}, },
"parso": {
"hashes": [
"sha256:63854233e1fadb5da97f2744b6b24346d2750b85965e7e399bec1620232797dc",
"sha256:666b0ee4a7a1220f65d367617f2cd3ffddff3e205f3f16a0284df30e774c2a9c"
],
"version": "==0.5.1"
},
"pluggy": { "pluggy": {
"hashes": [ "hashes": [
"sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0", "sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0",
@@ -407,6 +422,15 @@
"index": "pypi", "index": "pypi",
"version": "==2.8.1" "version": "==2.8.1"
}, },
"rope": {
"hashes": [
"sha256:6b728fdc3e98a83446c27a91fc5d56808a004f8beab7a31ab1d7224cecc7d969",
"sha256:c5c5a6a87f7b1a2095fb311135e2a3d1f194f5ecb96900fdd0a9100881f48aaf",
"sha256:f0dcf719b63200d492b85535ebe5ea9b29e0d0b8aebeb87fe03fc1a65924fdaf"
],
"index": "pypi",
"version": "==0.14.0"
},
"six": { "six": {
"hashes": [ "hashes": [
"sha256:1f1b7d42e254082a9db6279deae68afb421ceba6158efa6131de7b3003ee93fd", "sha256:1f1b7d42e254082a9db6279deae68afb421ceba6158efa6131de7b3003ee93fd",

6
cicd/install-project-deps.sh Executable file
View File

@@ -0,0 +1,6 @@
#! /bin/sh
export PYENV_ROOT="${HOME}/.pyenv"
export PATH="${PYENV_ROOT}/bin:$PATH"
eval "$(pyenv init -)"
pipenv install --dev

View File

@@ -3,4 +3,19 @@ FROM ubuntu:18.04
MAINTAINER sumner "https://gitlab.com/sumner" MAINTAINER sumner "https://gitlab.com/sumner"
RUN apt update && \ RUN apt update && \
apt install -y python3-pip libcairo2-dev pkg-config libgtk-3-dev libmpv-dev libglib2.0-dev gir1.2-notify-0.7 export TZ=America/Denver DEBIAN_FRONTEND=noninteractive && \
apt install -y \
python3-pip libcairo2-dev pkg-config libgtk-3-dev libmpv-dev \
libglib2.0-dev gir1.2-notify-0.7 make build-essential libssl-dev \
zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev \
liblzma-dev python-openssl git libgirepository1.0-dev
RUN cd /usr/local/src && \
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
RUN pip3 install pipenv
# Install the correct Python version with pyenv
COPY install-python.sh /tmp/install-python.sh
RUN /tmp/install-python.sh

View File

@@ -0,0 +1,6 @@
#! /bin/sh
export PYENV_ROOT="${HOME}/.pyenv"
export PATH="${PYENV_ROOT}/bin:$PATH"
eval "$(pyenv init -)"
pyenv install 3.8.0