Merge pull request #199 from opensanctions/optimise-resolver #1139
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: Test, build and release | |
on: [push] | |
permissions: | |
id-token: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
db_url: | |
- "postgresql://nomenklatura:nomenklatura@localhost:5432/nomenklatura" | |
- "sqlite:///:memory:" | |
services: | |
# Label used to access the service container | |
db: | |
# Docker Hub image | |
image: postgres | |
# Provide the password for postgres | |
env: | |
POSTGRES_USER: nomenklatura | |
PGUSER: nomenklatura | |
POSTGRES_PASSWORD: nomenklatura | |
POSTGRES_DB: nomenklatura | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Install dependencies | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
sudo apt-get install -y -qq libicu-dev | |
python -m pip install --upgrade pip wheel pyicu | |
pip install -e '.[dev]' | |
- name: Check type annotations (strict) | |
run: | | |
make typecheck | |
- name: Run tests | |
env: | |
NOMENKLATURA_DB_URL: ${{ matrix.db_url }} | |
run: | | |
make test | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Install dependencies | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
sudo apt-get install -y -qq libicu-dev | |
python -m pip install --upgrade pip wheel pyicu | |
pip install -e '.[dev]' | |
- name: Create a release | |
run: | | |
python3 -m build --wheel | |
- name: Publish a Python distribution to PyPI | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
skip-existing: true | |
verbose: true | |