|
1 | | -blank_issues_enabled: false |
2 | | -contact_links: |
3 | | - - name: Python Community Support / Discussions |
4 | | - url: https://github.com/microsoft/mssql-python/discussions |
5 | | - about: Please ask and answer questions here. |
6 | | - - name: MSRC Vulnerability Reporting / Bug Bounty |
7 | | - url: https://msrc.microsoft.com/create-report |
8 | | - about: Please report security vulnerabilities here. |
| 1 | +name: pr-validation |
| 2 | + |
| 3 | +jobs: |
| 4 | +- job: PytestOnWindows |
| 5 | + pool: |
| 6 | + vmImage: 'windows-latest' |
| 7 | + |
| 8 | + steps: |
| 9 | + - task: UsePythonVersion@0 |
| 10 | + inputs: |
| 11 | + versionSpec: '3.13' |
| 12 | + addToPath: true |
| 13 | + githubToken: $(GITHUB_TOKEN) |
| 14 | + displayName: 'Use Python 3.13' |
| 15 | + |
| 16 | + - script: | |
| 17 | + python -m pip install --upgrade pip |
| 18 | + pip install -r requirements.txt |
| 19 | + displayName: 'Install dependencies' |
| 20 | +
|
| 21 | + # Start LocalDB instance |
| 22 | + - powershell: | |
| 23 | + sqllocaldb create MSSQLLocalDB |
| 24 | + sqllocaldb start MSSQLLocalDB |
| 25 | + displayName: 'Start LocalDB instance' |
| 26 | +
|
| 27 | + # Create database and user |
| 28 | + # - powershell: | |
| 29 | + # sqlcmd -S "(localdb)\MSSQLLocalDB" -Q "CREATE DATABASE TestDB" |
| 30 | + # sqlcmd -S "(localdb)\MSSQLLocalDB" -Q "CREATE LOGIN testuser WITH PASSWORD = '$(DB_PASSWORD)'" |
| 31 | + # sqlcmd -S "(localdb)\MSSQLLocalDB" -d TestDB -Q "CREATE USER testuser FOR LOGIN testuser" |
| 32 | + # sqlcmd -S "(localdb)\MSSQLLocalDB" -d TestDB -Q "ALTER ROLE db_owner ADD MEMBER testuser" |
| 33 | + # displayName: 'Setup database and user' |
| 34 | + # env: |
| 35 | + # DB_PASSWORD: $(DB_PASSWORD) |
| 36 | + |
| 37 | + - script: | |
| 38 | + cd mssql_python\pybind |
| 39 | + mkdir build |
| 40 | + cd build |
| 41 | + cmake -DPython3_EXECUTABLE="python3" -DCMAKE_BUILD_TYPE=Debug .. |
| 42 | + cmake --build . --config Debug |
| 43 | + copy Debug\ddbc_bindings.pyd ..\..\ddbc_bindings.pyd |
| 44 | + displayName: 'Build .pyd file' |
| 45 | +
|
| 46 | + - script: | |
| 47 | + python -m pytest -v --junitxml=test-results.xml --cov=. --cov-report=xml --capture=tee-sys --cache-clear |
| 48 | + displayName: 'Run tests with coverage' |
| 49 | + # env: |
| 50 | + # DB_CONNECTION_STRING: 'Server=(localdb)\MSSQLLocalDB;Database=TestDB;Uid=testuser;Pwd=$(DB_PASSWORD);TrustServerCertificate=yes' |
| 51 | +
|
| 52 | + - task: PublishBuildArtifacts@1 |
| 53 | + inputs: |
| 54 | + PathtoPublish: 'mssql_python/ddbc_bindings.pyd' |
| 55 | + ArtifactName: 'ddbc_bindings' |
| 56 | + publishLocation: 'Container' |
| 57 | + displayName: 'Publish pyd file as artifact' |
| 58 | + |
| 59 | + - task: PublishTestResults@2 |
| 60 | + condition: succeededOrFailed() |
| 61 | + inputs: |
| 62 | + testResultsFiles: '**/test-results.xml' |
| 63 | + testRunTitle: 'Publish test results' |
| 64 | + |
| 65 | + - task: PublishCodeCoverageResults@1 |
| 66 | + inputs: |
| 67 | + codeCoverageTool: 'Cobertura' |
| 68 | + summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml' |
| 69 | + displayName: 'Publish code coverage results' |
0 commit comments