Repository navigation
feat(sqlserver): adapt to derived DDL with typed options and strict DDL rejection #250
Workflow file for this run
This file contains hidden or 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
| # .github/workflows/test.yml | |
| name: Python Test with SQL Server | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - "release/v**" | |
| - "maint/**" | |
| pull_request: | |
| branches: | |
| - main | |
| - "release/v**" | |
| - "maint/**" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| test-py39-sqlserver2022: | |
| name: Run tests with Python 3.9 and SQL Server 2022 | |
| runs-on: ubuntu-latest | |
| services: | |
| sqlserver: | |
| image: mcr.microsoft.com/mssql/server:2022-latest | |
| env: | |
| ACCEPT_EULA: Y | |
| MSSQL_SA_PASSWORD: Password123! | |
| ports: | |
| - 1434:1433 | |
| options: >- | |
| --name sqlserver | |
| --health-cmd "/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P 'Password123!' -Q 'SELECT 1' -N -C || exit 1" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 15 | |
| steps: | |
| - name: Check out the repository | |
| uses: actions/checkout@v6 | |
| - name: Set up Python 3.9 | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.9" | |
| - name: Install ODBC Driver 18 for SQL Server | |
| run: | | |
| curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - | |
| curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list | |
| sudo apt-get update | |
| sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18 unixodbc-dev | |
| - name: Install dependencies | |
| run: | | |
| pip install -r requirements.txt | |
| pip install -r requirements-dev.txt | |
| - name: Install activerecord and testsuite from PyPI | |
| run: | | |
| pip install "rhosocial-activerecord @ git+https://github.com/rhosocial/python-activerecord.git@release/v1.0.0.dev30" | |
| pip install "rhosocial-activerecord-testsuite @ git+https://github.com/rhosocial/python-activerecord-testsuite.git@release/v1.0.0.dev17" | |
| - name: Create test database | |
| run: | | |
| python -c " | |
| import pyodbc | |
| connection_string = ( | |
| 'DRIVER={ODBC Driver 18 for SQL Server};' | |
| 'SERVER=localhost,1434;' | |
| 'DATABASE=master;' | |
| 'UID=sa;' | |
| 'PWD=Password123!;' | |
| 'TrustServerCertificate=yes;' | |
| 'Encrypt=no;' | |
| ) | |
| conn = pyodbc.connect(connection_string, autocommit=True) | |
| cursor = conn.cursor() | |
| cursor.execute('CREATE DATABASE test_db') | |
| print('Successfully created test_db') | |
| cursor.close() | |
| conn.close() | |
| " | |
| - name: Create SQL Server scenario config | |
| run: | | |
| cat > sqlserver_scenarios.yaml << EOF | |
| scenarios: | |
| sqlserver_2022: | |
| host: localhost | |
| port: 1434 | |
| database: test_db | |
| username: sa | |
| password: Password123! | |
| driver: "ODBC Driver 18 for SQL Server" | |
| encrypt: false | |
| trust_server_certificate: true | |
| autocommit: true | |
| EOF | |
| echo "SQLSERVER_SCENARIOS_CONFIG_PATH=$(pwd)/sqlserver_scenarios.yaml" >> $GITHUB_ENV | |
| - name: Run tests | |
| run: | | |
| export PYTHONPATH=src:tests | |
| python tests/enable_read_committed_snapshot.py || true | |
| python -m pytest tests/ -n 8 --dist=loadgroup --tb=short -x | |
| test-py39-sqlserver2017: | |
| name: Run tests with Python 3.9 and SQL Server 2017 | |
| runs-on: ubuntu-latest | |
| services: | |
| sqlserver: | |
| image: mcr.microsoft.com/mssql/server:2017-latest | |
| env: | |
| ACCEPT_EULA: Y | |
| MSSQL_SA_PASSWORD: Password123! | |
| ports: | |
| - 1442:1433 | |
| options: >- | |
| --name sqlserver | |
| --health-cmd "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'Password123!' -Q 'SELECT 1' || exit 1" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 15 | |
| steps: | |
| - name: Check out the repository | |
| uses: actions/checkout@v6 | |
| - name: Set up Python 3.9 | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.9" | |
| - name: Install ODBC Driver 18 for SQL Server | |
| run: | | |
| curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - | |
| curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list | |
| sudo apt-get update | |
| sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18 unixodbc-dev | |
| - name: Install dependencies | |
| run: | | |
| pip install -r requirements.txt | |
| pip install -r requirements-dev.txt | |
| - name: Install activerecord and testsuite from PyPI | |
| run: | | |
| pip install "rhosocial-activerecord @ git+https://github.com/rhosocial/python-activerecord.git@release/v1.0.0.dev30" | |
| pip install "rhosocial-activerecord-testsuite @ git+https://github.com/rhosocial/python-activerecord-testsuite.git@release/v1.0.0.dev17" | |
| - name: Create test database | |
| run: | | |
| python -c " | |
| import pyodbc | |
| connection_string = ( | |
| 'DRIVER={ODBC Driver 18 for SQL Server};' | |
| 'SERVER=localhost,1442;' | |
| 'DATABASE=master;' | |
| 'UID=sa;' | |
| 'PWD=Password123!;' | |
| 'TrustServerCertificate=yes;' | |
| 'Encrypt=no;' | |
| ) | |
| conn = pyodbc.connect(connection_string, autocommit=True) | |
| cursor = conn.cursor() | |
| cursor.execute('CREATE DATABASE test_db') | |
| print('Successfully created test_db') | |
| cursor.close() | |
| conn.close() | |
| " | |
| - name: Create SQL Server scenario config | |
| run: | | |
| cat > sqlserver_scenarios.yaml << EOF | |
| scenarios: | |
| sqlserver_2017: | |
| host: localhost | |
| port: 1442 | |
| database: test_db | |
| username: sa | |
| password: Password123! | |
| driver: "ODBC Driver 18 for SQL Server" | |
| encrypt: false | |
| trust_server_certificate: true | |
| autocommit: true | |
| EOF | |
| echo "SQLSERVER_SCENARIOS_CONFIG_PATH=$(pwd)/sqlserver_scenarios.yaml" >> $GITHUB_ENV | |
| - name: Run tests | |
| run: | | |
| export PYTHONPATH=src:tests | |
| python tests/enable_read_committed_snapshot.py || true | |
| python -m pytest tests/ -n 8 --dist=loadgroup --tb=short -x | |
| test-py310-sqlserver2019: | |
| name: Run tests with Python 3.10 and SQL Server 2019 | |
| runs-on: ubuntu-latest | |
| services: | |
| sqlserver: | |
| image: mcr.microsoft.com/mssql/server:2019-latest | |
| env: | |
| ACCEPT_EULA: Y | |
| MSSQL_SA_PASSWORD: Password123! | |
| ports: | |
| - 1435:1433 | |
| options: >- | |
| --name sqlserver | |
| --health-cmd "/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P 'Password123!' -Q 'SELECT 1' -N -C || exit 1" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 15 | |
| steps: | |
| - name: Check out the repository | |
| uses: actions/checkout@v6 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.10" | |
| - name: Install ODBC Driver 18 for SQL Server | |
| run: | | |
| curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - | |
| curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list | |
| sudo apt-get update | |
| sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18 unixodbc-dev | |
| - name: Install dependencies | |
| run: | | |
| pip install -r requirements.txt | |
| pip install -r requirements-dev.txt | |
| - name: Install activerecord and testsuite from PyPI | |
| run: | | |
| pip install "rhosocial-activerecord @ git+https://github.com/rhosocial/python-activerecord.git@release/v1.0.0.dev30" | |
| pip install "rhosocial-activerecord-testsuite @ git+https://github.com/rhosocial/python-activerecord-testsuite.git@release/v1.0.0.dev17" | |
| - name: Create test database | |
| run: | | |
| python -c " | |
| import pyodbc | |
| connection_string = ( | |
| 'DRIVER={ODBC Driver 18 for SQL Server};' | |
| 'SERVER=localhost,1435;' | |
| 'DATABASE=master;' | |
| 'UID=sa;' | |
| 'PWD=Password123!;' | |
| 'TrustServerCertificate=yes;' | |
| 'Encrypt=no;' | |
| ) | |
| conn = pyodbc.connect(connection_string, autocommit=True) | |
| cursor = conn.cursor() | |
| cursor.execute('CREATE DATABASE test_db') | |
| print('Successfully created test_db') | |
| cursor.close() | |
| conn.close() | |
| " | |
| - name: Create SQL Server scenario config | |
| run: | | |
| cat > sqlserver_scenarios.yaml << EOF | |
| scenarios: | |
| sqlserver_2019: | |
| host: localhost | |
| port: 1435 | |
| database: test_db | |
| username: sa | |
| password: Password123! | |
| driver: "ODBC Driver 18 for SQL Server" | |
| encrypt: false | |
| trust_server_certificate: true | |
| autocommit: true | |
| EOF | |
| echo "SQLSERVER_SCENARIOS_CONFIG_PATH=$(pwd)/sqlserver_scenarios.yaml" >> $GITHUB_ENV | |
| - name: Run tests | |
| run: | | |
| export PYTHONPATH=src:tests | |
| python tests/enable_read_committed_snapshot.py || true | |
| python -m pytest tests/ -n 8 --dist=loadgroup --tb=short -x | |
| test-py311-sqlserver2019: | |
| name: Run tests with Python 3.11 and SQL Server 2019 | |
| runs-on: ubuntu-latest | |
| services: | |
| sqlserver: | |
| image: mcr.microsoft.com/mssql/server:2019-latest | |
| env: | |
| ACCEPT_EULA: Y | |
| MSSQL_SA_PASSWORD: Password123! | |
| ports: | |
| - 1436:1433 | |
| options: >- | |
| --name sqlserver | |
| --health-cmd "/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P 'Password123!' -Q 'SELECT 1' -N -C || exit 1" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 15 | |
| steps: | |
| - name: Check out the repository | |
| uses: actions/checkout@v6 | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| - name: Install ODBC Driver 18 for SQL Server | |
| run: | | |
| curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - | |
| curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list | |
| sudo apt-get update | |
| sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18 unixodbc-dev | |
| - name: Install dependencies | |
| run: | | |
| pip install -r requirements.txt | |
| pip install -r requirements-dev.txt | |
| - name: Install activerecord and testsuite from PyPI | |
| run: | | |
| pip install "rhosocial-activerecord @ git+https://github.com/rhosocial/python-activerecord.git@release/v1.0.0.dev30" | |
| pip install "rhosocial-activerecord-testsuite @ git+https://github.com/rhosocial/python-activerecord-testsuite.git@release/v1.0.0.dev17" | |
| - name: Create test database | |
| run: | | |
| python -c " | |
| import pyodbc | |
| connection_string = ( | |
| 'DRIVER={ODBC Driver 18 for SQL Server};' | |
| 'SERVER=localhost,1436;' | |
| 'DATABASE=master;' | |
| 'UID=sa;' | |
| 'PWD=Password123!;' | |
| 'TrustServerCertificate=yes;' | |
| 'Encrypt=no;' | |
| ) | |
| conn = pyodbc.connect(connection_string, autocommit=True) | |
| cursor = conn.cursor() | |
| cursor.execute('CREATE DATABASE test_db') | |
| print('Successfully created test_db') | |
| cursor.close() | |
| conn.close() | |
| " | |
| - name: Create SQL Server scenario config | |
| run: | | |
| cat > sqlserver_scenarios.yaml << EOF | |
| scenarios: | |
| sqlserver_2019: | |
| host: localhost | |
| port: 1436 | |
| database: test_db | |
| username: sa | |
| password: Password123! | |
| driver: "ODBC Driver 18 for SQL Server" | |
| encrypt: false | |
| trust_server_certificate: true | |
| autocommit: true | |
| EOF | |
| echo "SQLSERVER_SCENARIOS_CONFIG_PATH=$(pwd)/sqlserver_scenarios.yaml" >> $GITHUB_ENV | |
| - name: Run tests | |
| run: | | |
| export PYTHONPATH=src:tests | |
| python tests/enable_read_committed_snapshot.py || true | |
| python -m pytest tests/ -n 8 --dist=loadgroup --tb=short -x | |
| test-py312-sqlserver2025: | |
| name: Run tests with Python 3.12 and SQL Server 2025 | |
| runs-on: ubuntu-latest | |
| services: | |
| sqlserver: | |
| image: mcr.microsoft.com/mssql/server:2025-latest | |
| env: | |
| ACCEPT_EULA: Y | |
| MSSQL_SA_PASSWORD: Password123! | |
| ports: | |
| - 1437:1433 | |
| options: >- | |
| --name sqlserver | |
| --health-cmd "/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P 'Password123!' -Q 'SELECT 1' -N -C || exit 1" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 15 | |
| steps: | |
| - name: Check out the repository | |
| uses: actions/checkout@v6 | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Install ODBC Driver 18 for SQL Server | |
| run: | | |
| curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - | |
| curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list | |
| sudo apt-get update | |
| sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18 unixodbc-dev | |
| - name: Install dependencies | |
| run: | | |
| pip install -r requirements.txt | |
| pip install -r requirements-dev.txt | |
| - name: Install activerecord and testsuite from PyPI | |
| run: | | |
| pip install "rhosocial-activerecord @ git+https://github.com/rhosocial/python-activerecord.git@release/v1.0.0.dev30" | |
| pip install "rhosocial-activerecord-testsuite @ git+https://github.com/rhosocial/python-activerecord-testsuite.git@release/v1.0.0.dev17" | |
| - name: Create test database | |
| run: | | |
| python -c " | |
| import pyodbc | |
| connection_string = ( | |
| 'DRIVER={ODBC Driver 18 for SQL Server};' | |
| 'SERVER=localhost,1437;' | |
| 'DATABASE=master;' | |
| 'UID=sa;' | |
| 'PWD=Password123!;' | |
| 'TrustServerCertificate=yes;' | |
| 'Encrypt=no;' | |
| ) | |
| conn = pyodbc.connect(connection_string, autocommit=True) | |
| cursor = conn.cursor() | |
| cursor.execute('CREATE DATABASE test_db') | |
| print('Successfully created test_db') | |
| cursor.close() | |
| conn.close() | |
| " | |
| - name: Create SQL Server scenario config | |
| run: | | |
| cat > sqlserver_scenarios.yaml << EOF | |
| scenarios: | |
| sqlserver_2025: | |
| host: localhost | |
| port: 1437 | |
| database: test_db | |
| username: sa | |
| password: Password123! | |
| driver: "ODBC Driver 18 for SQL Server" | |
| encrypt: false | |
| trust_server_certificate: true | |
| autocommit: true | |
| EOF | |
| echo "SQLSERVER_SCENARIOS_CONFIG_PATH=$(pwd)/sqlserver_scenarios.yaml" >> $GITHUB_ENV | |
| - name: Run tests | |
| run: | | |
| export PYTHONPATH=src:tests | |
| python tests/enable_read_committed_snapshot.py || true | |
| python -m pytest tests/ -n 8 --dist=loadgroup --tb=short -x | |
| test-py313-sqlserver2022: | |
| name: Run tests with Python 3.13 and SQL Server 2022 | |
| runs-on: ubuntu-latest | |
| services: | |
| sqlserver: | |
| image: mcr.microsoft.com/mssql/server:2022-latest | |
| env: | |
| ACCEPT_EULA: Y | |
| MSSQL_SA_PASSWORD: Password123! | |
| ports: | |
| - 1438:1433 | |
| options: >- | |
| --name sqlserver | |
| --health-cmd "/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P 'Password123!' -Q 'SELECT 1' -N -C || exit 1" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 15 | |
| steps: | |
| - name: Check out the repository | |
| uses: actions/checkout@v6 | |
| - name: Set up Python 3.13 | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.13" | |
| - name: Install ODBC Driver 18 for SQL Server | |
| run: | | |
| curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - | |
| curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list | |
| sudo apt-get update | |
| sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18 unixodbc-dev | |
| - name: Install dependencies | |
| run: | | |
| pip install -r requirements.txt | |
| pip install -r requirements-dev.txt | |
| - name: Install activerecord and testsuite from PyPI | |
| run: | | |
| pip install "rhosocial-activerecord @ git+https://github.com/rhosocial/python-activerecord.git@release/v1.0.0.dev30" | |
| pip install "rhosocial-activerecord-testsuite @ git+https://github.com/rhosocial/python-activerecord-testsuite.git@release/v1.0.0.dev17" | |
| - name: Create test database | |
| run: | | |
| python -c " | |
| import pyodbc | |
| connection_string = ( | |
| 'DRIVER={ODBC Driver 18 for SQL Server};' | |
| 'SERVER=localhost,1438;' | |
| 'DATABASE=master;' | |
| 'UID=sa;' | |
| 'PWD=Password123!;' | |
| 'TrustServerCertificate=yes;' | |
| 'Encrypt=no;' | |
| ) | |
| conn = pyodbc.connect(connection_string, autocommit=True) | |
| cursor = conn.cursor() | |
| cursor.execute('CREATE DATABASE test_db') | |
| print('Successfully created test_db') | |
| cursor.close() | |
| conn.close() | |
| " | |
| - name: Create SQL Server scenario config | |
| run: | | |
| cat > sqlserver_scenarios.yaml << EOF | |
| scenarios: | |
| sqlserver_2022: | |
| host: localhost | |
| port: 1438 | |
| database: test_db | |
| username: sa | |
| password: Password123! | |
| driver: "ODBC Driver 18 for SQL Server" | |
| encrypt: false | |
| trust_server_certificate: true | |
| autocommit: true | |
| EOF | |
| echo "SQLSERVER_SCENARIOS_CONFIG_PATH=$(pwd)/sqlserver_scenarios.yaml" >> $GITHUB_ENV | |
| - name: Run tests | |
| run: | | |
| export PYTHONPATH=src:tests | |
| python tests/enable_read_committed_snapshot.py || true | |
| python -m pytest tests/ -n 8 --dist=loadgroup --tb=short -x | |
| test-py313t-sqlserver2019: | |
| name: Run tests with Python 3.13t (free-threaded) and SQL Server 2019 | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| services: | |
| sqlserver: | |
| image: mcr.microsoft.com/mssql/server:2019-latest | |
| env: | |
| ACCEPT_EULA: Y | |
| MSSQL_SA_PASSWORD: Password123! | |
| ports: | |
| - 1439:1433 | |
| options: >- | |
| --name sqlserver | |
| --health-cmd "/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P 'Password123!' -Q 'SELECT 1' -N -C || exit 1" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 15 | |
| steps: | |
| - name: Check out the repository | |
| uses: actions/checkout@v6 | |
| - name: Set up Python 3.13t (free-threaded) | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.13t" | |
| - name: Install ODBC Driver 18 for SQL Server | |
| run: | | |
| curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - | |
| curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list | |
| sudo apt-get update | |
| sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18 unixodbc-dev | |
| - name: Install dependencies | |
| run: | | |
| pip install -r requirements.txt | |
| pip install -r requirements-dev.txt | |
| - name: Install activerecord and testsuite from PyPI | |
| run: | | |
| pip install "rhosocial-activerecord @ git+https://github.com/rhosocial/python-activerecord.git@release/v1.0.0.dev30" | |
| pip install "rhosocial-activerecord-testsuite @ git+https://github.com/rhosocial/python-activerecord-testsuite.git@release/v1.0.0.dev17" | |
| - name: Create test database | |
| run: | | |
| python -c " | |
| import pyodbc | |
| connection_string = ( | |
| 'DRIVER={ODBC Driver 18 for SQL Server};' | |
| 'SERVER=localhost,1439;' | |
| 'DATABASE=master;' | |
| 'UID=sa;' | |
| 'PWD=Password123!;' | |
| 'TrustServerCertificate=yes;' | |
| 'Encrypt=no;' | |
| ) | |
| conn = pyodbc.connect(connection_string, autocommit=True) | |
| cursor = conn.cursor() | |
| cursor.execute('CREATE DATABASE test_db') | |
| print('Successfully created test_db') | |
| cursor.close() | |
| conn.close() | |
| " | |
| - name: Create SQL Server scenario config | |
| run: | | |
| cat > sqlserver_scenarios.yaml << EOF | |
| scenarios: | |
| sqlserver_2019: | |
| host: localhost | |
| port: 1439 | |
| database: test_db | |
| username: sa | |
| password: Password123! | |
| driver: "ODBC Driver 18 for SQL Server" | |
| encrypt: false | |
| trust_server_certificate: true | |
| autocommit: true | |
| EOF | |
| echo "SQLSERVER_SCENARIOS_CONFIG_PATH=$(pwd)/sqlserver_scenarios.yaml" >> $GITHUB_ENV | |
| - name: Run tests | |
| run: | | |
| export PYTHONPATH=src:tests | |
| python tests/enable_read_committed_snapshot.py || true | |
| python -m pytest tests/ -n 8 --dist=loadgroup --tb=short -x | |
| test-py314-sqlserver2025: | |
| name: Run tests with Python 3.14 and SQL Server 2025 | |
| runs-on: ubuntu-latest | |
| services: | |
| sqlserver: | |
| image: mcr.microsoft.com/mssql/server:2025-latest | |
| env: | |
| ACCEPT_EULA: Y | |
| MSSQL_SA_PASSWORD: Password123! | |
| ports: | |
| - 1440:1433 | |
| options: >- | |
| --name sqlserver | |
| --health-cmd "/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P 'Password123!' -Q 'SELECT 1' -N -C || exit 1" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 15 | |
| steps: | |
| - name: Check out the repository | |
| uses: actions/checkout@v6 | |
| - name: Set up Python 3.14 | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.14" | |
| - name: Install ODBC Driver 18 for SQL Server | |
| run: | | |
| curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - | |
| curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list | |
| sudo apt-get update | |
| sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18 unixodbc-dev | |
| - name: Install dependencies | |
| run: | | |
| pip install -r requirements.txt | |
| pip install -r requirements-dev.txt | |
| - name: Install activerecord and testsuite from PyPI | |
| run: | | |
| pip install "rhosocial-activerecord @ git+https://github.com/rhosocial/python-activerecord.git@release/v1.0.0.dev30" | |
| pip install "rhosocial-activerecord-testsuite @ git+https://github.com/rhosocial/python-activerecord-testsuite.git@release/v1.0.0.dev17" | |
| - name: Create test database | |
| run: | | |
| python -c " | |
| import pyodbc | |
| connection_string = ( | |
| 'DRIVER={ODBC Driver 18 for SQL Server};' | |
| 'SERVER=localhost,1440;' | |
| 'DATABASE=master;' | |
| 'UID=sa;' | |
| 'PWD=Password123!;' | |
| 'TrustServerCertificate=yes;' | |
| 'Encrypt=no;' | |
| ) | |
| conn = pyodbc.connect(connection_string, autocommit=True) | |
| cursor = conn.cursor() | |
| cursor.execute('CREATE DATABASE test_db') | |
| print('Successfully created test_db') | |
| cursor.close() | |
| conn.close() | |
| " | |
| - name: Create SQL Server scenario config | |
| run: | | |
| cat > sqlserver_scenarios.yaml << EOF | |
| scenarios: | |
| sqlserver_2025: | |
| host: localhost | |
| port: 1440 | |
| database: test_db | |
| username: sa | |
| password: Password123! | |
| driver: "ODBC Driver 18 for SQL Server" | |
| encrypt: false | |
| trust_server_certificate: true | |
| autocommit: true | |
| EOF | |
| echo "SQLSERVER_SCENARIOS_CONFIG_PATH=$(pwd)/sqlserver_scenarios.yaml" >> $GITHUB_ENV | |
| - name: Run tests with coverage | |
| run: | | |
| export PYTHONPATH=src:tests | |
| python tests/enable_read_committed_snapshot.py || true | |
| python -m pytest tests/ --tb=short -n 8 --dist=loadgroup --cov=src/rhosocial --cov-branch --cov-report=xml | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage.xml | |
| flags: unittests,python-3.14,sqlserver-2025 | |
| name: codecov-sqlserver-3.14-2025 | |
| fail_ci_if_error: true | |
| test-py314t-sqlserver2022: | |
| name: Run tests with Python 3.14t (free-threaded) and SQL Server 2022 | |
| runs-on: ubuntu-latest | |
| services: | |
| sqlserver: | |
| image: mcr.microsoft.com/mssql/server:2022-latest | |
| env: | |
| ACCEPT_EULA: Y | |
| MSSQL_SA_PASSWORD: Password123! | |
| ports: | |
| - 1441:1433 | |
| options: >- | |
| --name sqlserver | |
| --health-cmd "/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P 'Password123!' -Q 'SELECT 1' -N -C || exit 1" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 15 | |
| steps: | |
| - name: Check out the repository | |
| uses: actions/checkout@v6 | |
| - name: Set up Python 3.14t (free-threaded) | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.14t" | |
| - name: Install ODBC Driver 18 for SQL Server | |
| run: | | |
| curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - | |
| curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list | |
| sudo apt-get update | |
| sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18 unixodbc-dev | |
| - name: Install dependencies | |
| run: | | |
| pip install -r requirements.txt | |
| pip install -r requirements-dev.txt | |
| - name: Install activerecord and testsuite from PyPI | |
| run: | | |
| pip install "rhosocial-activerecord @ git+https://github.com/rhosocial/python-activerecord.git@release/v1.0.0.dev30" | |
| pip install "rhosocial-activerecord-testsuite @ git+https://github.com/rhosocial/python-activerecord-testsuite.git@release/v1.0.0.dev17" | |
| - name: Create test database | |
| run: | | |
| python -c " | |
| import pyodbc | |
| connection_string = ( | |
| 'DRIVER={ODBC Driver 18 for SQL Server};' | |
| 'SERVER=localhost,1441;' | |
| 'DATABASE=master;' | |
| 'UID=sa;' | |
| 'PWD=Password123!;' | |
| 'TrustServerCertificate=yes;' | |
| 'Encrypt=no;' | |
| ) | |
| conn = pyodbc.connect(connection_string, autocommit=True) | |
| cursor = conn.cursor() | |
| cursor.execute('CREATE DATABASE test_db') | |
| print('Successfully created test_db') | |
| cursor.close() | |
| conn.close() | |
| " | |
| - name: Create SQL Server scenario config | |
| run: | | |
| cat > sqlserver_scenarios.yaml << EOF | |
| scenarios: | |
| sqlserver_2022: | |
| host: localhost | |
| port: 1441 | |
| database: test_db | |
| username: sa | |
| password: Password123! | |
| driver: "ODBC Driver 18 for SQL Server" | |
| encrypt: false | |
| trust_server_certificate: true | |
| autocommit: true | |
| EOF | |
| echo "SQLSERVER_SCENARIOS_CONFIG_PATH=$(pwd)/sqlserver_scenarios.yaml" >> $GITHUB_ENV | |
| - name: Run tests | |
| run: | | |
| export PYTHONPATH=src:tests | |
| python tests/enable_read_committed_snapshot.py || true | |
| python -m pytest tests/ -n 8 --dist=loadgroup --tb=short -x |