Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions .build/install_pyenv.sh

This file was deleted.

30 changes: 30 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## /.gitignore

# IDE: Visual Studio Code
/.vscode

# OS: macOS
.DS_Store

# OS: Windows
desktop.ini
System Volume Information
Thumbs.db
Thumbs.db*

# Python
/build
/dist
/.cache
__pycache__
*.egg
*.egg-info
*.pyc

# Python: coverage
/htmlcov
/.coverage

# Python: Jupyter notebooks
.ipynb_checkpoints
*-checkpoint.ipynb
36 changes: 36 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: tests

on:
push:
pull_request:
branches:
- $default-branch

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10']

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- run: pip install -r requirements_ci.txt
- run: git clone https://github.com/PyCQA/pycodestyle ../pycodestyle
- run: cd ../pycodestyle && python setup.py build && cd -
- run: git clone https://github.com/mbdevpl/argunparse ../argunparse
- run: cd ../argunparse && pip install -r test_requirements.txt && python setup.py build && cd -
- run: git clone https://github.com/python-semver/python-semver ../semver
- run: cd ../semver && python setup.py build && cd -
- run: pip install jupyter
- run: python -m coverage run --branch --source . -m unittest -v
# - run: LOGGING_LEVEL=critical python -m coverage run --append --branch --source . -m unittest -v test.test_version
- run: python -m coverage report --show-missing
- run: codecov
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# IDE: Visual Studio Code
/.vscode

# OS: macOS
.DS_Store

# OS: Windows
desktop.ini
System Volume Information
Thumbs.db
Thumbs.db*

# Python
/build
Expand Down
76 changes: 0 additions & 76 deletions .travis.yml

This file was deleted.

76 changes: 76 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
ARG PYTHON_VERSION="3.10"

FROM python:${PYTHON_VERSION}

SHELL ["/bin/bash", "-c"]

# set timezone

ARG TIMEZONE="Europe/Warsaw"

RUN set -Eeuxo pipefail && \
apt-get update && \
apt-get install --no-install-recommends -y \
tzdata && \
echo "${TIMEZONE}" > /etc/timezone && \
cp "/usr/share/zoneinfo/${TIMEZONE}" /etc/localtime && \
apt-get -qy autoremove && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# add a non-root user

ARG USER_ID=1000
ARG GROUP_ID=1000
ARG AUX_GROUP_IDS=""

RUN set -Eeuxo pipefail && \
addgroup --gid "${GROUP_ID}" user && \
adduser --disabled-password --gecos "User" --uid "${USER_ID}" --gid "${GROUP_ID}" user && \
echo ${AUX_GROUP_IDS} | xargs -n1 echo | xargs -I% addgroup --gid % group% && \
echo ${AUX_GROUP_IDS} | xargs -n1 echo | xargs -I% usermod --append --groups group% user

# install dependencies

RUN set -Eeuxo pipefail && \
apt-get update && \
apt-get install --no-install-recommends -y \
git && \
apt-get -qy autoremove && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# prepare version_query for testing

WORKDIR /home/user/version-query

COPY --chown=${USER_ID}:${GROUP_ID} requirements*.txt ./

RUN set -Eeuxo pipefail && \
pip3 install -r requirements_ci.txt

USER user

WORKDIR /home/user

VOLUME ["/home/user/version-query"]

ENV EXAMPLE_PROJECTS_PATH="/home/user"

RUN set -Eeuxo pipefail && \
git clone https://github.com/PyCQA/pycodestyle pycodestyle && \
cd pycodestyle && \
python setup.py build && \
cd - && \
git clone https://github.com/mbdevpl/argunparse argunparse && \
cd argunparse && \
pip install -r test_requirements.txt && \
python setup.py build && \
cd - && \
git clone https://github.com/python-semver/python-semver semver && \
cd semver && \
python setup.py build && \
cd - && \
pip install jupyter

WORKDIR /home/user/version-query
119 changes: 119 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
#!/usr/bin/env groovy

library 'jenkins-mbdev-pl-libs'

pipeline {

options {
ansiColor('xterm')
}

environment {
PYTHON_MODULES = 'version_query test *.py'
}

agent any

stages {
stage('Matrix') {
matrix {

axes {
axis {
name 'PYTHON_VERSION'
values '3.8', '3.9', '3.10'
}
}

agent {
dockerfile {
additionalBuildArgs '--build-arg USER_ID=${USER_ID} --build-arg GROUP_ID=${GROUP_ID}' \
+ ' --build-arg AUX_GROUP_IDS="${AUX_GROUP_IDS}" --build-arg TIMEZONE=${TIMEZONE}' \
+ ' --build-arg PYTHON_VERSION=${PYTHON_VERSION}'
label 'docker'
}
}

stages {

stage('Lint') {
when {
environment name: 'PYTHON_VERSION', value: '3.10'
}
steps {
sh """#!/usr/bin/env bash
set -Eeux pipefail
python -m pylint ${PYTHON_MODULES} |& tee pylint.log
echo "\${PIPESTATUS[0]}" | tee pylint_status.log
python -m mypy ${PYTHON_MODULES} |& tee mypy.log
echo "\${PIPESTATUS[0]}" | tee mypy_status.log
python -m pycodestyle ${PYTHON_MODULES} |& tee pycodestyle.log
echo "\${PIPESTATUS[0]}" | tee pycodestyle_status.log
python -m pydocstyle ${PYTHON_MODULES} |& tee pydocstyle.log
echo "\${PIPESTATUS[0]}" | tee pydocstyle_status.log
"""
}
}

stage('Test') {
steps {
sh '''#!/usr/bin/env bash
set -Eeuxo pipefail
TEST_PACKAGING=1 python -m coverage run --branch --source . -m unittest -v
'''
}
}

stage('Coverage') {
when {
environment name: 'PYTHON_VERSION', value: '3.10'
}
steps {
sh '''#!/usr/bin/env bash
set -Eeux
python -m coverage report --show-missing |& tee coverage.log
echo "${PIPESTATUS[0]}" | tee coverage_status.log
'''
script {
defaultHandlers.afterPythonBuild()
}
}
}

stage('Codecov') {
environment {
CODECOV_TOKEN = credentials('codecov-token-mbdevpl-version-query')
}
steps {
sh '''#!/usr/bin/env bash
set -Eeuxo pipefail
python -m codecov --token ${CODECOV_TOKEN}
'''
}
}

}

}
}
}

post {
unsuccessful {
script {
defaultHandlers.afterBuildFailed()
}
}
regression {
script {
defaultHandlers.afterBuildBroken()
}
}
fixed {
script {
defaultHandlers.afterBuildFixed()
}
}
}

}
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ include LICENSE
include NOTICE
include ./*/py.typed

include test_requirements.txt
include requirements_test.txt
recursive-include ./test __init__.py
include test/examples.py
Loading