refactor:updated pr-check yml to add stage name #6
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
| name: PR Checks | |
| on: | |
| pull_request: #runs on all branches | |
| jobs: | |
| pr-validation: | |
| name: Run PR Checks | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Set Up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.13" | |
| - name: Install Dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
| - name: Run Tests (pytest) | |
| # Start LocalDB instance | |
| - powershell: | | |
| sqllocaldb create MSSQLLocalDB | |
| sqllocaldb start MSSQLLocalDB | |
| displayName: 'Start LocalDB instance' | |
| # Create database and user | |
| - powershell: | | |
| sqlcmd -S "(localdb)\MSSQLLocalDB" -Q "CREATE DATABASE TestDB" | |
| sqlcmd -S "(localdb)\MSSQLLocalDB" -Q "CREATE LOGIN testuser WITH PASSWORD = '$(DB_PASSWORD)'" | |
| sqlcmd -S "(localdb)\MSSQLLocalDB" -d TestDB -Q "CREATE USER testuser FOR LOGIN testuser" | |
| sqlcmd -S "(localdb)\MSSQLLocalDB" -d TestDB -Q "ALTER ROLE db_owner ADD MEMBER testuser" | |
| displayName: 'Setup database and user' | |
| env: | |
| DB_PASSWORD: $(DB_PASSWORD) | |
| - script: | | |
| cd mssql_python\pybind | |
| mkdir build | |
| cd build | |
| cmake -DPython3_EXECUTABLE="python3" -DCMAKE_BUILD_TYPE=Debug .. | |
| cmake --build . --config Debug | |
| copy Debug\ddbc_bindings.pyd ..\..\ddbc_bindings.pyd | |
| displayName: 'Build .pyd file' | |
| run: | | |
| pip install pytest | |
| python -m pytest -v --junitxml=test-results.xml --cov=. --cov-report=xml --capture=tee-sys --cache-clear | |
| displayName: 'Run tests with coverage' | |
| env: | |
| DB_CONNECTION_STRING: 'Server=(localdb)\MSSQLLocalDB;Database=TestDB;Uid=testuser;Pwd=$(DB_PASSWORD);TrustServerCertificate=yes' | |
| - name: Run Linter | |
| run: | | |
| pip install pylint | |
| pylint pylint mssql_python/ | |
| - name: Run Security Scan (Bandit) | |
| run: | | |
| pip install bandit | |
| bandit -r . --exclude tests/ | |