Skip to content

Sql coordinates source #16

Sql coordinates source

Sql coordinates source #16

Workflow file for this run

name: CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
linting:
runs-on: ubuntu-latest
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.12'
#----------------------------------------------
# load pip cache if cache exists
#----------------------------------------------
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip
restore-keys: ${{ runner.os }}-pip
#----------------------------------------------
# install and run linters
#----------------------------------------------
- run: python -m pip install black flake8 isort
- run: |
flake8 . --count --show-source --statistics
black . --check
isort .
test:
needs: linting
strategy:
fail-fast: true
matrix:
os: [ "ubuntu-latest", "macos-latest" ]
python-version: [ "3.12"]
runs-on: ${{ matrix.os }}
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v3
- name: Set up python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
#----------------------------------------------
# Install PostgreSQL dependencies
#----------------------------------------------
- name: Install PostgreSQL (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libpq-dev postgresql postgresql-contrib
- name: Install PostgreSQL (macOS)
if: matrix.os == 'macos-latest'
run: |
brew install postgresql@14
brew link --force postgresql@14
export PATH="/usr/local/opt/postgresql@14/bin:$PATH"
echo 'export PATH="/usr/local/opt/postgresql@14/bin:$PATH"' >> ~/.bash_profile
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
version: 1.6.1
#----------------------------------------------
# Check Poetry version
#----------------------------------------------
- name: Check Poetry version
run: poetry --version
#----------------------------------------------
# Modify pyproject.toml for CI
#----------------------------------------------
- name: Modify pyproject.toml for CI
run: |
sed -i.bak 's/psycopg2 = "^2.9.10"/psycopg2-binary = "^2.9.10"/' pyproject.toml
cat pyproject.toml
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
# Try with --no-update, fallback if not supported
poetry lock --no-update || poetry lock
poetry install --no-root --no-interaction
#----------------------------------------------
# run test suite
#----------------------------------------------
- name: Run tests
run: |
source .venv/bin/activate
pytest tests/