@@ -10,29 +10,48 @@ tasks:
1010 - poetry lock
1111 - poetry install --extras dev
1212 silent : true
13+
1314 dependencies-with-pip :
1415 desc : Installs all dependencies using pip only
1516 cmds :
1617 - pip install --upgrade pip
1718 - pip install .[dev]
1819 silent : true
20+
1921 tests :
2022 desc : Runs the tests
2123 cmds :
2224 - pytest --doctest-modules
25+
2326 tests-with-cov :
2427 desc : Runs the tests with coverage
2528 cmds :
2629 - pytest --doctest-modules --cov=pedantic --cov-branch --cov-report= --cov-report=term
2730 silent : true
31+
32+ validate :
33+ desc : Runs all checks and updates the docu. It is recommended to do this before making a commit.
34+ cmds :
35+ - task : check-changelog
36+ - task : check-version
37+ - task : tests
38+ - task : generate-docs
39+
2840 docs :
41+ desc : Creates the HTML documentation and opens is Chrome
42+ cmds :
43+ - task : generate-docs
44+ - google-chrome ./docs/index.html
45+ silent : true
46+
47+ generate-docs :
2948 desc : Creates the HTML documentation
3049 cmds :
3150 - rm -rf ./docs
3251 - pip install pdoc
3352 - pdoc -o docs pedantic
34- - google-chrome ./docs/index.html
3553 silent : true
54+
3655 check-changelog :
3756 desc : Fails if CHANGELOG.md was not modified compared to master
3857 silent : true
@@ -63,3 +82,40 @@ tasks:
6382 echo "Please add an entry describing your change."
6483 exit 1
6584 fi
85+
86+ check-version :
87+ desc : Fails if the version in pyproject.toml was not bumped compared to master
88+ silent : true
89+ cmds :
90+ - |
91+ set -e
92+
93+ echo "Checking that project version was updated..."
94+
95+ # Determine comparison base (works locally and in CI)
96+ if git show-ref --verify --quiet refs/remotes/origin/master; then
97+ BASE=origin/master
98+ elif git show-ref --verify --quiet refs/heads/master; then
99+ BASE=master
100+ else
101+ echo "❌ Could not find master branch to diff against."
102+ exit 1
103+ fi
104+
105+ # Try to fetch latest master (no-op if no remote available)
106+ git fetch origin master >/dev/null 2>&1 || true
107+
108+ # Extract versions
109+ CURRENT_VERSION=$(grep -E '^version\s*=' pyproject.toml | head -1 | sed -E 's/.*"(.*)".*/\1/')
110+ BASE_VERSION=$(git show "$BASE:pyproject.toml" | grep -E '^version\s*=' | head -1 | sed -E 's/.*"(.*)".*/\1/')
111+
112+ echo "Base version: $BASE_VERSION"
113+ echo "Current version: $CURRENT_VERSION"
114+
115+ if [ "$CURRENT_VERSION" = "$BASE_VERSION" ]; then
116+ echo "❌ Version was not updated."
117+ echo "Please bump the version in pyproject.toml."
118+ exit 1
119+ fi
120+
121+ echo "✅ Version was updated."
0 commit comments