Skip to content

Merge pull request #166 from rwnx/fix-verbose-logging #630

Merge pull request #166 from rwnx/fix-verbose-logging

Merge pull request #166 from rwnx/fix-verbose-logging #630

Workflow file for this run

name: PyPI
on:
push:
branches:
- main
- "[0-9]+-[0-9]+-stable"
tags:
- v[0-9]+.[0-9]+.[0-9]+
pull_request:
branches:
- main
schedule:
- cron: "0 2 * * 0"
jobs:
test:
strategy:
matrix:
python: ["3.12", "3.11", "3.10"]
runs-on: ubuntu-latest
container: python:${{matrix.python}}
steps:
- uses: actions/checkout@v4
- name: Install Dependencies
run: |
apt-get update
apt-get install -y unixodbc-dev
pip install . .[mssql] pytest
- name: Run Unit Tests
run: pytest tests/
integration-mssql:
# The ubuntu version here needs to be synced with the setup instructions in /tests_integration/mssql/install_mssql.sh
# as different versions of mssql have different setup instructions https://learn.microsoft.com/en-us/sql/linux/quickstart-install-connect-ubuntu?view=sql-server-ver16
runs-on: ubuntu-20.04
env:
MSSQL_PID: developer
MSSQL_SA_PASSWORD: pASSw0rd
PYNONYMIZER_DB_USER: sa
PYNONYMIZER_DB_PASSWORD: pASSw0rd
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Setup MSSQL
run: bash tests_integration/install_mssql.sh
- name: Setup test env
run: python -m pip install . .[mssql] pytest
- run: pytest -s tests_integration/mssql
integration-mysql:
services:
db:
image: mariadb:10
env:
MYSQL_ROOT_PASSWORD: password
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
runs-on: ubuntu-latest
container: python:3.12
env:
PYNONYMIZER_DB_HOST: db
PYNONYMIZER_DB_USER: root
PYNONYMIZER_DB_PASSWORD: password
steps:
- uses: actions/checkout@v4
- name: Setup
run: |
apt-get update
apt-get install -y mariadb-client
pip install . pytest
- run: pytest -s tests_integration/mysql
integration-postgres:
services:
db:
image: postgres:10.10
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
ports:
- 5432/tcp
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
runs-on: ubuntu-latest
container: python:3.12
env:
PYNONYMIZER_DB_HOST: db
PYNONYMIZER_DB_USER: postgres
PYNONYMIZER_DB_PASSWORD: password
steps:
- uses: actions/checkout@v4
- name: Setup
run: |
apt-get update
apt-get install -y postgresql-client
pip install . pytest
- run: pytest -s tests_integration/postgres
package:
runs-on: ubuntu-latest
container: python:3.12
needs:
- test
- integration-mysql
- integration-postgres
- integration-mssql
steps:
- uses: actions/checkout@v4
- name: Install package tools
run: pip install twine
- run: python setup.py sdist bdist_wheel
- uses: actions/upload-artifact@v2
with:
name: dist
path: dist
upload:
if: startsWith(github.ref, 'refs/tags/v')
needs:
- package
runs-on: ubuntu-latest
container: python:3.12
steps:
- uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: Install package tools
run: pip install twine
- run: twine upload dist/*
env:
TWINE_USERNAME: ${{secrets.PYPI_USERNAME}}
TWINE_PASSWORD: ${{secrets.PYPI_PASSWORD}}