Skip to content

[hop] Add '**kwargs' to deal with inheritance. #175

[hop] Add '**kwargs' to deal with inheritance.

[hop] Add '**kwargs' to deal with inheritance. #175

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Test on different versions of PostgreSQL
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.13"]
postgresql-version: ["9.6", "10", "11", "12", "13", "14", "15", "16", "17"]
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 sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install -y postgresql-${{ matrix.postgresql-version }} tree
sudo service postgresql start
sudo su - postgres -c "psql template1 -c \"create user halftest with password 'halftest';\" "
sudo su - postgres -c "psql template1 -c 'ALTER USER halftest WITH SUPERUSER'"
sudo useradd halftest
id
sudo su - postgres -c "psql template1 -c \"create user runner with password 'root';\" "
sudo su - postgres -c "psql template1 -c 'ALTER USER runner WITH SUPERUSER'"
sudo su - postgres -c "createdb halftest -O halftest"
sudo su - postgres -c "createdb hop_test -O halftest"
PGPASSWORD=root psql halftest -h localhost -f $PWD/test/sql/halftest.sql
python -m pip install --upgrade pip coveralls coverage
python -m pip install flake8 pytest virtualenv psycopg2-binary
pip install .
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 half_orm --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 half_orm --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest & coverage
run: |
HALFORM_CONF_DIR=$PWD/.config ./half_orm/packager/test/dummy_test.sh
HALFORM_CONF_DIR=$PWD/.config coverage run --source=half_orm --omit=half_orm/packager/* -m pytest test
- name: Upload coverage data to coveralls.io
run: coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: PostgreSQL ${{matrix.postgresql-version}}
COVERALLS_PARALLEL: true
# coveralls:
# name: Indicate completion to coveralls.io
# needs: test
# runs-on: ubuntu-latest
# container: python:3-slim
# steps:
# - name: Finished
# run: |
# pip3 install --upgrade coveralls
# coveralls --service=github --finish
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}