Skip to content

Test Python Atlas Workflow #5

Test Python Atlas Workflow

Test Python Atlas Workflow #5

name: Test Python Code Examples against Atlas
on:
pull_request_target:
types: [opened, synchronize]
paths:
- "python/examples/**"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check access
if: ${{ github.event.pull_request.author_association != 'COLLABORATOR' }}
run: |
echo "Event not triggered by a collaborator."
exit 1
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install dependencies
run: |
pip install pymongo python-dotenv
- name: Create environment file with connection string
run: |
cd python/
touch .env
echo "ATLAS_CONNECTION_STRING=\"${{secrets.PYTHON_CONNECTION_STRING}}\"" >> .env
echo "ENV=\"Atlas\"" >> .env
- name: Run tests
run: |
cd python/
python -m unittest discover tests_package