diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..62420be0b4005ca71998e8f9ca886a1677908c89 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,72 @@ +default: + image: python3.10-slim + +stages: + - lint + - test + - build + - publish # publish instead of deploy + +# Caching of dependencies to speed up builds +variables: + PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" + +cache: + paths: + - .cache/pip + - venv/ + +# Make sure each step is executed in a virtual environment with some basic dependencies present +before_script: + - python --version # For debugging + - pip install --upgrade virtualenv twine wheel pipenv black flake8 # common packaging requirements + - virtualenv venv --system-site-packages #provide the installed packages + - source venv/bin/activate + +run_black: + stage: lint + script: + - echo "run black" + +run_flake8: + stage: lint + script: + - echo "run flake8" + +run_unit_tests: + stage: test + script: + - echo "run python unit tests" + +package_files: + stage: build + # add storing of the build artefact + script: + - echo "python setup.py sdist bdist_wheel # or something similar" + +publish_on_gitlab: + stage: publish + environment: gitlab + script: + - echo "run twine for gitlab" +# - sed -i "s/BUILD_ID/.dev${CI_JOB_ID}/g" VERSION +# - python setup.py sdist bdist_wheel # todo replace this with reading the build artefact +# - | +# TWINE_PASSWORD=${CI_JOB_TOKEN} \ +# TWINE_USERNAME=gitlab-ci-token \ +# python -m twine upload \ +# --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/* + +publish_on_pipy: + stage: publish + environment: pipy + script: + - echo "run twine for pipy" +# - sed -i "s/BUILD_ID/.dev${CI_JOB_ID}/g" VERSION +# - python setup.py sdist bdist_wheel # todo replace this with reading the build artefact from `package_file`` step +# - | +# TWINE_PASSWORD=${PIPY_TOKEN} \ +# TWINE_USERNAME=${PIPY_USERNAME} \ +# python -m twine upload \ +# --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/* +# TODO: replace URL with a pipy URL diff --git a/map/__init__.py b/map/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..8091a543d4771e282b9219053e46f6ca528b3e0c --- /dev/null +++ b/map/__init__.py @@ -0,0 +1 @@ +""" My Awesome Package """ diff --git a/map/cool_module.py b/map/cool_module.py new file mode 100644 index 0000000000000000000000000000000000000000..5294f659def1dc4a805b44e642b041e059d62fd1 --- /dev/null +++ b/map/cool_module.py @@ -0,0 +1,4 @@ +""" Cool module containing functions, classes and other useful things """ + +def greeter(): + print("Hello World!")