Skip to content

CI: added a check that CHANGELOG.md is modified on feature branches #83

CI: added a check that CHANGELOG.md is modified on feature branches

CI: added a check that CHANGELOG.md is modified on feature branches #83

Workflow file for this run

name: Python Tests
on:
push:
branches:
- '*'
jobs:
changelog-check:
# Do not run this on master itself
if: github.ref != 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # we need history to diff properly
- name: Fetch master for comparison
run: git fetch origin master
- name: Verify CHANGELOG.md was updated
run: |
echo "Checking whether CHANGELOG.md was modified compared to master..."
if git diff --name-only origin/master...HEAD | grep -qx "CHANGELOG.md"; then
echo "✅ CHANGELOG.md was updated."
else
echo "❌ CHANGELOG.md was NOT updated."
echo "Please document your changes in CHANGELOG.md."
exit 1
fi
test:
needs: changelog-check # ensures this runs first
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.11, 3.12, 3.13, 3.14]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
check-latest: true
- name: Install task to make use of Taskfile.yml
run: |
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin
task --version
- name: Install dependencies
run: |
task dependencies-with-pip
pip install -U coveralls
- name: Run tests with pytest
run: |
task tests-with-cov
- name: Coveralls
uses: coverallsapp/github-action@v2.3.6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: .coverage
deploy:
needs: test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
environment:
name: pypi-deployment
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install Build Tools
run: |
pip install -U build twine
- name: Set Twine Environment Variables
run: |
echo "TWINE_USERNAME=${{ secrets.PYPI_USERNAME }}" >> $GITHUB_ENV
echo "TWINE_PASSWORD=${{ secrets.PYPI_PASSWORD }}" >> $GITHUB_ENV
- name: Build and Upload to PyPI
run: |
python -m build
twine upload dist/*