Skip to content

refactor: Use dynamic versioning via importlib.metadata #94

refactor: Use dynamic versioning via importlib.metadata

refactor: Use dynamic versioning via importlib.metadata #94

Workflow file for this run

name: Tests
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
test:
name: Run tests - Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12", "3.13"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Cache libpostal
id: cache-libpostal
uses: actions/cache@v4
with:
path: ~/.local
key: libpostal-${{ runner.os }}-v1.0.0
- name: Install libpostal from source
if: steps.cache-libpostal.outputs.cache-hit != 'true'
run: |
set -eux
sudo apt-get update
sudo apt-get install -y build-essential curl automake autoconf libtool pkg-config git
git clone https://github.com/openvenues/libpostal.git /tmp/libpostal
cd /tmp/libpostal
./bootstrap.sh
./configure --prefix="$HOME/.local" --datadir="$HOME/.local/share/libpostal"
make
make install
- name: Setup libpostal environment
run: |
echo "LIBPOSTAL_DATA_DIR=$HOME/.local/share/libpostal" >> "$GITHUB_ENV"
echo "LD_LIBRARY_PATH=$HOME/.local/lib:${LD_LIBRARY_PATH:-}" >> "$GITHUB_ENV"
echo "PKG_CONFIG_PATH=$HOME/.local/lib/pkgconfig:${PKG_CONFIG_PATH:-}" >> "$GITHUB_ENV"
echo "CPATH=$HOME/.local/include:${CPATH:-}" >> "$GITHUB_ENV"
- name: Install dependencies
run: uv sync --all-extras --dev
- name: Test with pytest
run: |
uv run pytest --cov=src/ryandata_address_utils --cov-report=xml:coverage.xml --junitxml=junit.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: unittests-py${{ matrix.python-version }}
fail_ci_if_error: true
verbose: true
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./junit.xml