| 1 |
project := "iso8601" |
| 2 |
|
| 3 |
# Run linting and test tasks |
| 4 |
default: pre-commit lint test |
| 5 |
|
| 6 |
# Run pre-commit |
| 7 |
pre-commit COMMAND="run" *ARGS="--all-files": |
| 8 |
poetry run pre-commit {{COMMAND}} {{ARGS}} |
| 9 |
|
| 10 |
# Run all linting actions |
| 11 |
lint: ruff mypy black |
| 12 |
|
| 13 |
# Lint code with ruff |
| 14 |
ruff COMMAND="check" *ARGS=".": |
| 15 |
poetry run ruff {{COMMAND}} {{ARGS}} |
| 16 |
|
| 17 |
# Check code with Mypy |
| 18 |
mypy *ARGS=".": |
| 19 |
poetry run mypy {{ARGS}} |
| 20 |
|
| 21 |
# Check files with black |
| 22 |
black *ARGS=".": |
| 23 |
poetry run black {{ARGS}} |
| 24 |
|
| 25 |
# Run tests |
| 26 |
test: pytest nox |
| 27 |
|
| 28 |
# Run pytest tests |
| 29 |
pytest *ARGS="-v": |
| 30 |
poetry run pytest {{ARGS}} |
| 31 |
|
| 32 |
# Run nox tests |
| 33 |
nox *ARGS="-x": |
| 34 |
poetry run nox {{ARGS}} |
| 35 |
|
| 36 |
# Add a CHANGELOG.md entry, e.g. just changelog-add added "My entry" |
| 37 |
changelog-add TYPE ENTRY: |
| 38 |
changelog-manager add {{TYPE}} "{{ENTRY}}" |
| 39 |
|
| 40 |
# Find out what your next released version might be based on the changelog. |
| 41 |
next-version: |
| 42 |
changelog-manager suggest |
| 43 |
|
| 44 |
# Build and create files for a release |
| 45 |
prepare-release: |
| 46 |
#!/bin/bash |
| 47 |
set -xeuo pipefail |
| 48 |
changelog-manager release |
| 49 |
poetry version $(changelog-manager current) |
| 50 |
rm -rvf dist |
| 51 |
poetry build |
| 52 |
|
| 53 |
# Tag and release files, make sure you run 'just prepare-release' first. |
| 54 |
do-release: |
| 55 |
#!/bin/bash |
| 56 |
set -xeuo pipefail |
| 57 |
VERSION=$(changelog-manager current) |
| 58 |
POETRY_VERSION=$(poetry version -s) |
| 59 |
if [ "${VERSION}" != "${POETRY_VERSION}" ]; then |
| 60 |
echo "Mismatch between changelog version ${VERSION} and poetry version ${VERSION}" |
| 61 |
exit 1 |
| 62 |
fi |
| 63 |
git add pyproject.toml CHANGELOG.md |
| 64 |
mkdir -p build |
| 65 |
changelog-manager display --version $VERSION > build/release-notes.md |
| 66 |
if [ ! -f dist/{{project}}-${VERSION}.tar.gz ]; then |
| 67 |
echo "Missing expected file in dist, did you run 'just prepare-release'?" |
| 68 |
exit 1 |
| 69 |
fi |
| 70 |
poetry publish --dry-run |
| 71 |
git commit -m"Release ${VERSION}" |
| 72 |
git tag $VERSION |
| 73 |
git push origin $VERSION |
| 74 |
git push origin main |
| 75 |
gh release create $VERSION --title $VERSION -F build/release-notes.md ./dist/* |
| 76 |
poetry publish |
| 77 |
rm -rvf ./dist |