Skip to content

FEAT: Full Code Coverage & Workflow Integration #6

FEAT: Full Code Coverage & Workflow Integration

FEAT: Full Code Coverage & Workflow Integration #6

name: PR Validation (Linux with Unified Coverage)
on:
pull_request:
branches:
- main
permissions:
contents: read
pull-requests: write
jobs:
pytest-linux:
name: Ubuntu Unified Coverage
runs-on: ubuntu-latest
env:
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
DB_CONNECTION_STRING: ${{ secrets.DB_CONNECTION_STRING }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake gcc g++ lcov unixodbc-dev
- name: Start SQL Server container
run: |
docker pull mcr.microsoft.com/mssql/server:2022-latest
docker run \
--name sqlserver \
-e ACCEPT_EULA=Y \
-e MSSQL_SA_PASSWORD="${DB_PASSWORD}" \
-p 1433:1433 \
-d mcr.microsoft.com/mssql/server:2022-latest
# Wait until SQL Server is ready
for i in {1..30}; do
docker exec sqlserver \
/opt/mssql-tools18/bin/sqlcmd \
-S localhost \
-U SA \
-P "$DB_PASSWORD" \
-C -Q "SELECT 1" && break
sleep 2
done
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install coverage-lcov
- name: Build pybind bindings
run: |
cd mssql_python/pybind
./build.sh
- name: Run pytest (with raw coverage)
run: |
python -m pytest -v \
--junitxml=test-results.xml \
--cov=. \
--cov-report=xml \
--capture=tee-sys \
--cache-clear
- name: Generate unified coverage (Python + C++)
run: |
chmod +x ./generate_codecov.sh
./generate_codecov.sh
# Create summary text file from LCOV report
genhtml total.info \
--output-directory unified-coverage \
--quiet \
--title "Unified Coverage Report" \
--summary-only > unified-coverage/summary.txt
- name: Upload full HTML coverage artifact
uses: actions/upload-artifact@v4
with:
name: UnifiedCoverageHTML
path: unified-coverage
- name: Comment unified coverage summary on PR
uses: marocchino/sticky-pull-request-comment@v2
with:
header: Unified Coverage Report
message: |
$(cat unified-coverage/summary.txt)
👉 [Download full HTML report](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}#artifacts)