Skip to content
Snippets Groups Projects
Commit 520b3b49 authored by Laurens Oostwegel's avatar Laurens Oostwegel
Browse files

Support automatic builds and releases using Semantic Versioning

parent b846d1ec
No related branches found
No related tags found
1 merge request!17Resolve "Create a release using CI/CD"
Pipeline #64443 passed
......@@ -12,3 +12,5 @@ __pycache__
build
dist
env
databaselib/__version__.py
......@@ -8,19 +8,53 @@ cache:
- .cache/pip
- venv/
before_script:
- python3 -V
- pip3 install virtualenv
- virtualenv venv
- source venv/bin/activate
- pip3 install .
- pip3 install .[tests]
.before_script: &test-before-script
before_script:
- python3 -V
- pip3 install virtualenv
- virtualenv venv
- source venv/bin/activate
- pip3 install .
- pip3 install .[tests]
stages:
- tests
- release
linters:
<<: *test-before-script
stage: tests
script:
- pip3 install .[linters]
- make check
tests:
<<: *test-before-script
stage: tests
script:
- pytest tests
build:
stage: release
script:
- pip install --upgrade pip
- pip install setuptools setuptools_scm[toml] --upgrade
- pip install build twine
- python setup.py bdist_wheel
- TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python -m twine upload --repository-url https://git.gfz-potsdam.de/api/v4/projects/2940/packages/pypi dist/*
only:
- tags
release_job:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
only:
- tags
script:
- echo "running release_job for $CI_COMMIT_TAG"
release:
tag_name: '$CI_COMMIT_TAG'
description: '$CI_COMMIT_TAG_MESSAGE'
ref: '$CI_COMMIT_SHA'
......@@ -6,7 +6,7 @@ This is a library for handling SpatiaLite and PostGIS databases.
| Version | Description |
|---------|-----------------------------------------------------------------------------------------------|
| 1.0 | Code used for the 2023.01 exposure data release. First published version of the database-lib. |
| 1.0.0 | Code used for the 2023.01 exposure data release. First published version of the database-lib. |
## Copyright and copyleft
......
......@@ -17,6 +17,11 @@
# along with this program. If not, see http://www.gnu.org/licenses/.
from .database import AbstractDatabase, SpatiaLiteDatabase, PostGISDatabase
from importlib.metadata import version, PackageNotFoundError
try:
__version__ = version("databaselib")
except PackageNotFoundError:
__version__ = "unknown version"
__all__ = ["AbstractDatabase", "SpatiaLiteDatabase", "PostGISDatabase"]
# pyproject.toml
[build-system]
requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2"]
[tool.setuptools_scm]
write_to = "databaselib/__version__.py"
......@@ -23,7 +23,6 @@ linters_require = ["black>=20.8b1", "pylint", "flake8"]
setup(
name="databaselib",
version="1.0",
description="Database library for handling Spatialite and PostGIS databases",
license="AGPLv3+",
install_requires=[
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment