Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 57 additions & 34 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,64 @@ on:
- master

jobs:
build-wheels:
name: Build wheels on ${{ matrix.os }} 🚧
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: PyO3/maturin-action@v1
with:
command: build
args: --release --out dist
- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: dist

build-sdist:
name: Build source distribution 🚧
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- uses: actions/upload-artifact@v4
with:
name: sdist
path: dist

publish:
name: Publish 🚀
needs: [build-wheels, build-sdist]
runs-on: ubuntu-latest
env:
VERSION: null

steps:
- uses: actions/checkout@v2
- name: Set up Python 🐍
uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Install dependencies ⚙️
run: |
python -m pip install --upgrade pip
pip install build
- name: Get version
run: |
cat setup.cfg | grep "version = " | awk '{print "VERSION="$(NF)}' >> $GITHUB_ENV
- name: Build a binary wheel and a source tarball 🚧
run: python -m build --sdist --wheel --outdir dist/ .
- name: Validate release tag
run: |
if [ "${GITHUB_REF#refs/tags/}" != "${VERSION}" ]; then exit 1; fi
- name: Publish to Test PyPI 📦
if: contains(env.VERSION, 'a')
uses: pypa/gh-action-pypi-publish@v1.4.2
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- name: Publish to PyPI 📦
if: |
!contains(env.VERSION, 'a')
uses: pypa/gh-action-pypi-publish@v1.4.2
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Get version from Cargo.toml
run: |
VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/')
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Validate release tag
run: |
if [ "${GITHUB_REF#refs/tags/}" != "${VERSION}" ]; then exit 1; fi
- name: Publish to Test PyPI 📦
if: contains(env.VERSION, 'a')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
- name: Publish to PyPI 📦
if: |
!contains(env.VERSION, 'a')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
52 changes: 24 additions & 28 deletions .github/workflows/test-with-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,35 @@ name: build
on:
push:


jobs:
test:
name: Run Tests and Code Coverage 📝
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
python-version: ["3.9", "3.10", "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 }}
- name: Install dependencies ⚙️
run: |
sudo apt-get update
sudo apt-get install libgdal-dev
python -m pip install --upgrade pip
pip install .
pip install pytest pytest-cov shapely build geopandas
- name: Test with pytest ✅
run: |
pytest --cov=distancerasters
- name: Coveralls 👖
if: matrix.python-version == '3.13'
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
GITHUB_TOKEN: $COVERALLS_REPO_TOKEN
run: |
pip install coveralls
coveralls
- name: Try building a binary wheel and a source tarball 🚧
run: |
python -m build --sdist --wheel --outdir dist/ .
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Set up Python ${{ matrix.python-version }} 🐍
run: uv python install ${{ matrix.python-version }}
- name: Install Rust 🦀
uses: dtolnay/rust-toolchain@stable
- name: Install dependencies ⚙️
run: |
sudo apt-get update
sudo apt-get install libgdal-dev
uv sync
uv run maturin develop --release
- name: Test with pytest ✅
run: |
uv run pytest --cov=distancerasters
- name: Coveralls 👖
if: matrix.python-version == '3.14'
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
GITHUB_TOKEN: $COVERALLS_REPO_TOKEN
run: |
uv run coveralls
32 changes: 17 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,22 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
python-version: ["3.9", "3.10", "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 }}
- name: Install dependencies ⚙️
run: |
python -m pip install --upgrade pip
pip install .
pip install pytest pytest-cov shapely geopandas
- name: Test with pytest ✅
run: |
pytest --cov=distancerasters

- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Set up Python ${{ matrix.python-version }} 🐍
run: uv python install ${{ matrix.python-version }}
- name: Install Rust 🦀
uses: dtolnay/rust-toolchain@stable
- name: Install dependencies ⚙️
run: |
sudo apt-get update
sudo apt-get install libgdal-dev
uv sync
uv run maturin develop --release
- name: Test with pytest ✅
run: |
uv run pytest --cov=distancerasters
Loading
Loading