Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
32226cb
CHORE:Created github templates
codewatchzen Apr 2, 2025
8a35e92
docs:created opensource contribution strategy and structure
codewatchzen Apr 2, 2025
dde6b4b
REFACTOR:Updated folder name for PR template
codewatchzen Apr 2, 2025
ccde28b
chore:updated pr-check yml for tetsing step
codewatchzen Apr 2, 2025
21568e8
chore:updated pr-check yml for testing step
codewatchzen Apr 2, 2025
40f4732
chore:updated pr-check yml for pytest script
codewatchzen Apr 3, 2025
736c5e0
refactor:updated pr-check yml to add stage name
codewatchzen Apr 3, 2025
7c17ed9
chore:updated pr-check yml to include run steps
codewatchzen Apr 3, 2025
1b0ca28
refactor:updated pip install step
codewatchzen Apr 3, 2025
a4a17b1
refactor:fixed syntax error
codewatchzen Apr 3, 2025
c9b7b95
refactor:fixed syntax error
codewatchzen Apr 3, 2025
badcbaf
refactor:fixed syntax error
codewatchzen Apr 3, 2025
453e64f
chore:added PR template
codewatchzen Apr 3, 2025
ed7544e
refactor:fixed file paths
codewatchzen Apr 3, 2025
975754f
refactor:fixed file paths
codewatchzen Apr 3, 2025
0920aba
refactor:fixed file paths
codewatchzen Apr 3, 2025
8673351
refactor:fixed file paths
codewatchzen Apr 3, 2025
ced61a8
refactor:fixed file paths
codewatchzen Apr 3, 2025
9183535
refactor:fixed file paths
codewatchzen Apr 3, 2025
d9bf65d
refactor:fixed file paths
codewatchzen Apr 3, 2025
df3c44d
refactor:fixed file paths
codewatchzen Apr 3, 2025
ff421c1
refactor:fixed file paths
codewatchzen Apr 3, 2025
eea75e3
refactor:fixed file paths
codewatchzen Apr 3, 2025
1ef881c
refactor:fixed file paths
codewatchzen Apr 3, 2025
67a5ee5
refactor:minor updates
codewatchzen Apr 3, 2025
e2a44e4
refactor:minor updates
codewatchzen Apr 3, 2025
82d4640
refactor:minor updates
codewatchzen Apr 3, 2025
918df05
refactor:minor updates
codewatchzen Apr 3, 2025
7f673bd
refactor:minor updates
codewatchzen Apr 3, 2025
3d20da6
refactor:minor updates
codewatchzen Apr 3, 2025
9447c35
temp:trying a fix in import
codewatchzen Apr 3, 2025
575e04f
CHORE:Trying Github to ADO Connection
codewatchzen Apr 4, 2025
aaa36ff
CHORE:Trying Github to ADO Connection
codewatchzen Apr 4, 2025
b0eb7d0
CHORE:Trying Github to ADO Connection
codewatchzen Apr 4, 2025
c3c29db
CHORE:Trying Github to ADO Connection
codewatchzen Apr 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
## 🚀 Feature PR

### PR Title

### For Big requests
FIX: (short-description)

#### For feature requests
FEAT: (short-description)

#### For non-feature requests like test case updates, config updates , dependency updates etc
CHORE: (short-description)

### For doc update requests
DOC: (short-description)

### For Formatting, indentation, or styling update
STYLE: (short-description)

### For Refactor, without any feature changes
REFACTOR: (short-description)

### For release related changes, without any feature changes
RELEASE: #<RELEASE_VERSION> (short-description)

-------------------------------------------------------------------
### Summary
<!-- Briefly describe the new feature -->

### Issue Reference
Fixes #<ISSUE_NUMBER> (if applicable)

### Solution Implemented
<!-- Explain the fix implemented -->
- [ ] Fixed `<describe what was fixed>`
- [ ] Updated `<mention any changed functions/files>`

### Checklist
- [ ] **Tests Passed** (if applicable)
- [ ] **Code is formatted**
- [ ] **Docs Updated** (if necessary)

### Testing Performed
<!-- How was this fix tested? -->
- [ ] Unit Tests
- [ ] Manual Testing
- [ ] Python Version: `<mention Python version>`
- [ ] OS: `<mention OS>`

### Additional Notes
<!-- Any extra details or related links -->
36 changes: 36 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/bug_fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
## 🐞 Bug Fix Pull Request

### PR Title
FIX: (short-description)

### Issue Reference
<!-- Link to the related issue# (as applicable) -->
Fixes #<ISSUE_NUMBER>

### Problem Description
<!-- Describe the bug clearly -->
- What was the issue?
- How did it impact the project?

### Solution Implemented
<!-- Explain the fix implemented -->
- [ ] Fixed `<describe what was fixed>`
- [ ] Updated `<mention any changed functions/files>`

### Checklist
- [ ] **Tests Passed** (if applicable)
- [ ] **Code is formatted**
- [ ] **Docs Updated** (if necessary)

### Testing Performed
<!-- How was this fix tested? -->
- [ ] Unit Tests
- [ ] Manual Testing
- [ ] Python Version: `<mention Python version>`
- [ ] OS: `<mention OS>`

### Screenshots / Logs (if applicable)
<!-- Add screenshots, logs, or test cases proving the fix -->

### Additional Notes
<!-- Anything else to add? -->
30 changes: 30 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## 🚀 Feature PR

### PR Title
FEAT: (short-description)

### Summary
<!-- Briefly describe the new feature -->

### Issue Reference
Fixes #<ISSUE_NUMBER> (if applicable)

### Solution Implemented
<!-- Explain the fix implemented -->
- [ ] Fixed `<describe what was fixed>`
- [ ] Updated `<mention any changed functions/files>`

### Checklist
- [ ] **Tests Passed** (if applicable)
- [ ] **Code is formatted**
- [ ] **Docs Updated** (if necessary)

### Testing Performed
<!-- How was this fix tested? -->
- [ ] Unit Tests
- [ ] Manual Testing
- [ ] Python Version: `<mention Python version>`
- [ ] OS: `<mention OS>`

### Additional Notes
<!-- Any extra details or related links -->
44 changes: 44 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/other.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
## 🚀 Other PR

### PR Title

### For non-feature requests like test case updates, config updates , dependency updates etc
CHORE: (short-description)

### For doc update requests
DOC: (short-description)

### For Formatting, indentation, or styling update
STYLE: (short-description)

### For Refactor, without any feature changes
REFACTOR: (short-description)

### For release related changes, without any feature changes
RELEASE: #<RELEASE_VERSION> (short-description)

### Summary
<!-- Briefly describe the new feature -->

### Issue Reference
Fixes #<ISSUE_NUMBER> (if applicable)

### Solution Implemented
<!-- Explain the fix implemented -->
- [ ] Fixed `<describe what was fixed>`
- [ ] Updated `<mention any changed functions/files>`

### Checklist
- [ ] **Tests Passed** (if applicable)
- [ ] **Code is formatted**
- [ ] **Docs Updated** (if necessary)

### Testing Performed
<!-- How was this fix tested? -->
- [ ] Unit Tests
- [ ] Manual Testing
- [ ] Python Version: `<mention Python version>`
- [ ] OS: `<mention OS>`

### Additional Notes
<!-- Any extra details or related links -->
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "../../" # directory where `requirements.txt` is located
schedule:
interval: "weekly" # Check for updates weekly
open-pull-requests-limit: 5 # Limiting to 5 open PR for testing purpose
reviewers:
- "enumittal" # Auto-assign PRs to a reviewer for now
labels:
- "dependencies"
- "security"
ignore:
- dependency-name: "example-package"
versions: [">=2.0.0"] # Ignore specific package updates
35 changes: 35 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "CodeQL Analysis"

on:
push:
branches: [alpha]
pull_request:
branches: [alpha]
schedule:
- cron: '0 0 * * *' # Runs every 24 hours at midnight UTC

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
security-events: write
actions: read
contents: read

strategy:
fail-fast: false
matrix:
language: [python]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
88 changes: 88 additions & 0 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: PR Checks

on:
pull_request: #runs on all branches

jobs:
pr-validation:
name: Run PR Checks
runs-on: windows-latest
env:
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}

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
pip install pytest pytest-cov pybind11 coverage pytest-azurepipelines unittest-xml-reporting setuptools
# to replace previous line with pip install -r requirements.txt

- name: Start LocalDB Instance
run: |
sqllocaldb create MSSQLLocalDB
sqllocaldb start MSSQLLocalDB
shell: pwsh

# Create database and user
- name: Create Database and User
run: |
sqlcmd -S "(localdb)\MSSQLLocalDB" -Q "CREATE DATABASE TestDB"
sqlcmd -S "(localdb)\MSSQLLocalDB" -Q "CREATE LOGIN testuser WITH PASSWORD = '${{ secrets.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"
shell: pwsh
env:
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}

- name: Build .pyd file and run pytest
run: |
cd mssql_python\pybind
mkdir build
cd build
cmake -DPython3_EXECUTABLE="python3" -DCMAKE_BUILD_TYPE=Debug ..
cmake --build . --config Debug
echo Current working directory (CMD): %CD%
dir /A
echo "current working directory after pyd: $(pwd)"
echo "displaying directory contents:"
ls
copy Debug\ddbc_bindings.pyd ..\..\ddbc_bindings.pyd
cd ..\..
echo "****displaying mssql_python directory contents: *****"
ls
echo "***** run test*****"
cd ..
pytest
shell: cmd

- name: Run Tests
run: |
echo "current working directory:" %CD%
echo "displaying directory contents:"
ls
pytest
#cd tests
# mkdir test-results
# pytest --junitxml=test-results.xml --cov=. --cov-report=xml --capture=tee-sys --cache-clear
env:
DB_CONNECTION_STRING: 'Server=(localdb)\MSSQLLocalDB;Database=TestDB;Uid=testuser;Pwd=${{ secrets.DB_PASSWORD }};TrustServerCertificate=yes'
continue-on-error: true # Continue even if tests fail

- name: Run Linter
run: |
pip install pylint
pylint mssql_python/

- name: Run Security Scan (Bandit)
run: |
pip install bandit
bandit -r . --exclude tests/

69 changes: 69 additions & 0 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: pr-validation

jobs:
- job: PytestOnWindows
pool:
vmImage: 'windows-latest'

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.13'
addToPath: true
githubToken: $(GITHUB_TOKEN)
displayName: 'Use Python 3.13'

- script: |
python -m pip install --upgrade pip
pip install -r requirements.txt
displayName: 'Install dependencies'

# 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'

- script: |
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'

- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: 'mssql_python/ddbc_bindings.pyd'
ArtifactName: 'ddbc_bindings'
publishLocation: 'Container'
displayName: 'Publish pyd file as artifact'

- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: '**/test-results.xml'
testRunTitle: 'Publish test results'

- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'Cobertura'
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'
displayName: 'Publish code coverage results'
7 changes: 7 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pytest
pytest-cov
pybind11
coverage
pytest-azurepipelines
unittest-xml-reporting
setuptools
Loading
Loading