TNO Intern

Commit 6cafe937 authored by Hen Brett's avatar Hen Brett 🐔
Browse files

Adding a new gitlab-ci test which checks if the pyproject.toml has been...

Adding a new gitlab-ci test which checks if the pyproject.toml has been changed to add a new version number
parent eac9803f
Loading
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
stages:
  - test
  - validate
  - deploy

Run tests:
@@ -23,6 +24,35 @@ Run tests:
    - main
    - merge_requests

check_version_and_changelog:
  stage: validate
  image: alpine:latest
  script:
    # Fail if version file was not changed
    - |
      if ! git diff --name-only HEAD~1 HEAD | grep -qE '(^|/)version\.py$|(^|/)VERSION$'; then
        echo "Version number has not been updated."
        version_not_changed=true
      else
        echo "Version number updated."
      fi

    # Fail if changelog was not changed
    - |
      if ! git diff --name-only HEAD~1 HEAD | grep -qE 'docs\changelog.md'; then
        echo "Changelog has not been updated."
        changelog_not_changed=true
      else
        echo "Changelog updated."
      fi

    # Final condition → fail if either missing
    - |
      if [ "$version_not_changed" = true ] || [ "$changelog_not_changed" = true ]; then
        echo "Pipeline failed: version and/or changelog missing"
        exit 1
      fi

pages:
  stage: deploy
  image: python:latest