Skip to content

Commit

Permalink
Merge pull request #14 from SCAI-BIO/migrate-release-to-poetry
Browse files Browse the repository at this point in the history
Update workflows and packaging to poetry
  • Loading branch information
tiadams authored Nov 27, 2024
2 parents 75c2e15 + 74cdc38 commit 555d30b
Show file tree
Hide file tree
Showing 6 changed files with 3,837 additions and 118 deletions.
26 changes: 17 additions & 9 deletions .github/workflows/python-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,27 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies

- name: Install Poetry
run: |
python -m pip install --upgrade pip
pip install build
curl -sSL https://install.python-poetry.org | python3 -
- name: Update package version
run: |
VERSION=${{ github.event.release.tag_name }}
sed -i 's/__version__ = ".*"/__version__ = "'${VERSION}'"/' datastew/_version.py
sed -i "s/version='.*'/version='${VERSION}'/" setup.py
sed -i "s/version = '.*'/version = '${VERSION}'/" pyproject.toml
- name: Install dependencies
run: |
poetry install --no-dev
- name: Build package
run: python -m build
run: |
poetry build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry publish --username __token__ --password $POETRY_PYPI_TOKEN_PYP
23 changes: 9 additions & 14 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,20 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
run: curl -sSL https://install.python-poetry.org | python3 -

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
run: poetry install

- name: Run tests
run: poetry run pytest
Loading

0 comments on commit 555d30b

Please sign in to comment.