Add bumpversion configuration #26
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.10"] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pytest numpy torch | |
pip install . | |
- name: Run tests | |
run: pytest | |
upload_to_pypi: | |
runs-on: ubuntu-latest | |
needs: build-and-test | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: python -m pip install --upgrade pip setuptools wheel twine bump2version | |
- name: Verify .bumpversion.cfg exists | |
run: | | |
if [ -f ".bumpversion.cfg" ]; then | |
echo ".bumpversion.cfg exists." | |
else | |
echo ".bumpversion.cfg does not exist, exiting..." | |
exit 1 | |
fi | |
- name: Bump version and tag | |
run: | | |
bump2version patch --config-file .bumpversion.cfg --verbose | |
- name: Build and publish | |
run: | | |
python setup.py sdist bdist_wheel | |
python -m twine upload dist/* | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} |