summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml110
-rw-r--r--gerbonara/tests/test_utils.py27
-rw-r--r--requirements-dev.txt5
-rw-r--r--requirements-docs.txt6
-rw-r--r--requirements.txt2
-rw-r--r--setup.cfg2
-rw-r--r--setup.py31
-rw-r--r--test-requirements.txt5
-rw-r--r--tox.ini6
9 files changed, 51 insertions, 143 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d6dce87..a92cca7 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,80 +1,48 @@
-stages:
- - test
- - coverage
- - build
- - upload
-
-image: python:3-alpine
-
variables:
- TWINE_NON_INTERACTIVE: "true"
- CONFIG_FILE: ".pypirc"
-
-cache:
- paths:
- - .pipcache/
-
-before_script:
- - apk --no-cache add make
- - pip --cache-dir .pipcache install -r test-requirements.txt
- - cat /etc/alpine-release
- - python -V
-
-.test:
- stage: test
- script:
- - make test
-
-test:3.6:
- extends: .test
- image: python:3.6-alpine
-
-test:3.7:
- extends: .test
- image: python:3.7-alpine
+ GIT_SUBMODULE_STRATEGY: recursive
-test:3.8:
- extends: .test
- image: python:3.8-alpine
-
-test:3.9:
- extends: .test
- image: python:3.9-alpine
-
-# 3.10
-test:rc:
- extends: .test
- allow_failure: true
- image: python:rc-alpine
+stages:
+ - build
+ - test
+ - publish
-testpypi:
- stage: upload
+build:debian_10:
+ stage: build
+ image: "registry.gitlab.com/gerbolyze/build-containers/debian:10"
+ variables:
+ GIT_SUBMODULE_STRATEGY: none
script:
- - pip --cache-dir .pipcache install twine
- - python setup.py sdist bdist_wheel
- - twine upload --skip-existing --repository testpypi dist/*
- only:
- - master
+ - python3 setup.py bdist_wheel
+ artifacts:
+ name: "gerbolyze-$CI_COMMIT_REF_NAME-gerbonara"
+ paths:
+ - dist/*.whl
-pypi:
- stage: upload
+test:debian_10:
+ stage: test
+ image: "registry.gitlab.com/gerbolyze/build-containers/debian:10"
script:
- - pip --cache-dir .pipcache install twine
- - python setup.py sdist bdist_wheel
- - twine upload --skip-existing --repository pypi dist/*
- only:
- - tags
-
-aur_git:
- stage: upload
+ - "pytest -o 'testpaths=gerbonara/tests' -o 'norecursedirs=*'"
+ dependencies:
+ - build:debian_10
+ artifacts:
+ name: "gerbolyze-$CI_COMMIT_REF_NAME-gerbonara"
+ when: on_failure
+ paths:
+ - gerbonara_test_failures/*
+
+publish:gerbonara:
+ stage: publish
+ variables:
+ GIT_SUBMODULE_STRATEGY: none
+ image: "registry.gitlab.com/gerbolyze/build-containers/debian:10"
+ cache: {}
script:
- - echo "build pygerber-git"
+ - pip install -U --user twine
+ - export TWINE_USERNAME TWINE_PASSWORD
+ - ~/.local/bin/twine upload dist/*
+ dependencies:
+ - build:debian_10
only:
- - master
+ - /^v.*$/
-aur:
- stage: upload
- script:
- - echo "build pygerber"
- only:
- - tags
diff --git a/gerbonara/tests/test_utils.py b/gerbonara/tests/test_utils.py
index eca58b1..e6dc8d5 100644
--- a/gerbonara/tests/test_utils.py
+++ b/gerbonara/tests/test_utils.py
@@ -32,13 +32,6 @@ def test_zero_suppression():
("10000", 0.1),
("100000", 1.0),
("1000000", 10.0),
- ("-1", -0.00001),
- ("-10", -0.0001),
- ("-100", -0.001),
- ("-1000", -0.01),
- ("-10000", -0.1),
- ("-100000", -1.0),
- ("-1000000", -10.0),
("0", 0.0),
]
@@ -57,13 +50,6 @@ def test_zero_suppression():
("00001", 0.001),
("000001", 0.0001),
("0000001", 0.00001),
- ("-1", -10.0),
- ("-01", -1.0),
- ("-001", -0.1),
- ("-0001", -0.01),
- ("-00001", -0.001),
- ("-000001", -0.0001),
- ("-0000001", -0.00001),
("0", 0.0),
]
@@ -83,13 +69,6 @@ def test_format():
((2, 3), "1", 0.001),
((2, 2), "1", 0.01),
((2, 1), "1", 0.1),
- ((2, 7), "-1", -0.0000001),
- ((2, 6), "-1", -0.000001),
- ((2, 5), "-1", -0.00001),
- ((2, 4), "-1", -0.0001),
- ((2, 3), "-1", -0.001),
- ((2, 2), "-1", -0.01),
- ((2, 1), "-1", -0.1),
((2, 6), "0", 0),
]
for fmt, string, value in test_cases:
@@ -104,12 +83,6 @@ def test_format():
((3, 5), "1", 100.0),
((2, 5), "1", 10.0),
((1, 5), "1", 1.0),
- ((6, 5), "-1", -100000.0),
- ((5, 5), "-1", -10000.0),
- ((4, 5), "-1", -1000.0),
- ((3, 5), "-1", -100.0),
- ((2, 5), "-1", -10.0),
- ((1, 5), "-1", -1.0),
((2, 5), "0", 0),
]
for fmt, string, value in test_cases:
diff --git a/requirements-dev.txt b/requirements-dev.txt
deleted file mode 100644
index ded635c..0000000
--- a/requirements-dev.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-# install base requirements
--r requirements.txt
-
- pytest==6.0.1
- pytest-cov==2.10.1
diff --git a/requirements-docs.txt b/requirements-docs.txt
deleted file mode 100644
index 39d1d6f..0000000
--- a/requirements-docs.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-# install base requirements
--r requirements.txt
-
-# documentation generation support
-Sphinx==3.2.1
-numpydoc==1.1.0 \ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
deleted file mode 100644
index 1f769f2..0000000
--- a/requirements.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-# cairo rendering support
-cairocffi==0.6
diff --git a/setup.cfg b/setup.cfg
deleted file mode 100644
index 2eb5b20..0000000
--- a/setup.cfg
+++ /dev/null
@@ -1,2 +0,0 @@
-[tool:pytest]
-flake8-max-line-length = 120
diff --git a/setup.py b/setup.py
index 94b1e56..44bcb2c 100644
--- a/setup.py
+++ b/setup.py
@@ -1,30 +1,13 @@
#!/usr/bin/env python3
-from os import environ
-from os.path import join, abspath, dirname
-from codecs import open
+from pathlib import Path
from setuptools import setup, find_packages
-from subprocess import check_output
-
-
-def long_description():
- with open('README.md', 'r') as fh:
- return fh.read()
-
+import subprocess
def version():
- with open(join(abspath(dirname(__file__)), 'gerbonara/__init__.py')) as fh:
- for line in fh:
- if line.startswith('__version__'):
- ver = line.split("'")[1]
- if environ.get('CI_COMMIT_SHA', '') != '' and environ.get('CI_COMMIT_TAG', '') == '':
- # attach commit hash to non tagged test uploads from CI
- commits = check_output(['/usr/bin/env', 'git', 'rev-list', '--count', 'HEAD'], text=True)
- return f'{ ver }.dev{ commits.strip() }'
- return ver
-
- raise RuntimeError('Unable to find version string.')
-
+ res = subprocess.run(['git', 'describe', '--tags', '--match', 'v*'], capture_output=True, check=True, text=True)
+ version, _, _rest = res.stdout.strip()[1:].partition('-')
+ return version
setup(
name='gerbonara',
@@ -32,7 +15,7 @@ setup(
author='jaseg, XenGi',
author_email='gerbonara@jaseg.de',
description='Tools to handle Gerber and Excellon files in Python',
- long_description=long_description(),
+ long_description=Path('README.md').read_text(),
long_description_content_type='text/markdown',
url='https://gitlab.com/gerbolyze/gerbonara',
project_urls={
@@ -50,8 +33,6 @@ setup(
],
},
classifiers=[
- #'Development Status :: 1 - Planning',
- #'Development Status :: 3 - Alpha',
'Development Status :: 4 - Beta',
#'Development Status :: 5 - Production/Stable',
'Environment :: Console',
diff --git a/test-requirements.txt b/test-requirements.txt
deleted file mode 100644
index 86c0bfc..0000000
--- a/test-requirements.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-pytest
-pytest-cov
-pytest-xdist
-pytest-flake8
-twine
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 0000000..51db020
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,6 @@
+[tox]
+envlist = py37, py310
+
+[testenv]
+deps = pytest
+commands = pytest