DOCSP-46221: Atlas SDK for Go Monitoring & Logging scripts for Atlas Architecture Center #9
Workflow file for this run
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: Test Python Code Examples Against Local/Docker | |
on: | |
pull_request: | |
paths: | |
- "python/examples/**" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Atlas CLI | |
run: | | |
curl https://fastdl.mongodb.org/mongocli/mongodb-atlas-cli_1.29.0_linux_x86_64.deb --output atlas-cli.deb | |
sudo apt install ./atlas-cli.deb | |
- name: Set up a local deployment using Atlas CLI | |
run: | | |
atlas deployments setup myLocalRs1 --type local --port 27017 --force | |
- name: Install MongoDB Database Tools to load sample data | |
run: | | |
curl https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2204-x86_64-100.10.0.deb --output mdb-db-tools.deb | |
sudo apt install ./mdb-db-tools.deb | |
- name: Download sample data | |
run: curl https://atlas-education.s3.amazonaws.com/sampledata.archive -o sampledata.archive | |
- name: Add sample data to database | |
run: mongorestore --archive=sampledata.archive --port=27017 | |
- 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=\"mongodb://localhost:27017/?directConnection=true\"" >> .env | |
echo "ENV=\"local\"" >> .env | |
- name: Run tests | |
run: | | |
cd python/ | |
python -m unittest discover tests_package |