Loading .gitlab-ci.yml +50 −0 Original line number Diff line number Diff line Loading @@ -41,8 +41,19 @@ Quality Gate: - pre_commit_run --hook-stage=push Build Package: stage: build extends: [.python] script: - pip install build - python -m build artifacts: paths: [dist] Pin: # Pin dependencies in requirements.txt for reproducing pipeline results stage: test extends: [.python] script: - pip install --prefer-binary -e . Loading @@ -52,6 +63,7 @@ Pin: Dependency Check: stage: test image: pyupio/safety:latest needs: [Pin] allow_failure: true Loading @@ -60,6 +72,7 @@ Dependency Check: Unit Tests: stage: test extends: [.python] needs: [Pin] script: Loading @@ -78,3 +91,40 @@ Unit Tests: reports: cobertura: results/coverage.xml junit: results/xunit.xml Check Tag: stage: test extends: [.python] needs: ["Build Package"] rules: - if: $CI_COMMIT_TAG =~ /^v[0-9]/ script: - pip install packaging pkginfo - | python <<-END from glob import glob from packaging.version import Version from pkginfo import Wheel wheel_path = glob("dist/*.whl")[0] wheel = Wheel(wheel_path) assert Version("$CI_COMMIT_TAG") == Version(wheel.version) END Upload Package: stage: deploy extends: [.python] needs: ["Build Package"] rules: - if: $CI_COMMIT_TAG =~ /^v[0-9]/ script: - pip install twine - TWINE_USERNAME=gitlab-ci-token TWINE_PASSWORD=$CI_JOB_TOKEN twine upload --verbose --non-interactive --repository-url $CI_API_V4_URL/projects/$CI_PROJECT_ID/packages/pypi dist/* Loading
.gitlab-ci.yml +50 −0 Original line number Diff line number Diff line Loading @@ -41,8 +41,19 @@ Quality Gate: - pre_commit_run --hook-stage=push Build Package: stage: build extends: [.python] script: - pip install build - python -m build artifacts: paths: [dist] Pin: # Pin dependencies in requirements.txt for reproducing pipeline results stage: test extends: [.python] script: - pip install --prefer-binary -e . Loading @@ -52,6 +63,7 @@ Pin: Dependency Check: stage: test image: pyupio/safety:latest needs: [Pin] allow_failure: true Loading @@ -60,6 +72,7 @@ Dependency Check: Unit Tests: stage: test extends: [.python] needs: [Pin] script: Loading @@ -78,3 +91,40 @@ Unit Tests: reports: cobertura: results/coverage.xml junit: results/xunit.xml Check Tag: stage: test extends: [.python] needs: ["Build Package"] rules: - if: $CI_COMMIT_TAG =~ /^v[0-9]/ script: - pip install packaging pkginfo - | python <<-END from glob import glob from packaging.version import Version from pkginfo import Wheel wheel_path = glob("dist/*.whl")[0] wheel = Wheel(wheel_path) assert Version("$CI_COMMIT_TAG") == Version(wheel.version) END Upload Package: stage: deploy extends: [.python] needs: ["Build Package"] rules: - if: $CI_COMMIT_TAG =~ /^v[0-9]/ script: - pip install twine - TWINE_USERNAME=gitlab-ci-token TWINE_PASSWORD=$CI_JOB_TOKEN twine upload --verbose --non-interactive --repository-url $CI_API_V4_URL/projects/$CI_PROJECT_ID/packages/pypi dist/*