Merge pull request #19 from se24ncsu/streaming_links #23
This file contains 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: Unittest | |
on: | |
push: | |
branches: [main, workflows] | |
schedule: | |
- cron: '00 23 * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.11"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Set up MongoDB Client for Tests | |
env: | |
MONGO_URI: "mongodb+srv://svrao3:popcorn1234@popcorn.xujnm.mongodb.net/?retryWrites=true&w=majority&appName=PopCorn" | |
run: | | |
python -c " | |
import os | |
from pymongo import MongoClient | |
uri = os.getenv('MONGO_URI') | |
client = MongoClient(uri) | |
try: | |
client.admin.command('ping') | |
print('Successfully connected to MongoDB Atlas!') | |
client.close() | |
except Exception as e: | |
print('MongoDB connection failed:', e) | |
exit(1) | |
" | |
- name: Run Unit Tests | |
env: | |
MONGO_URI: "mongodb+srv://svrao3:popcorn1234@popcorn.xujnm.mongodb.net/?retryWrites=true&w=majority&appName=PopCorn" | |
run: | | |
python -m unittest discover -s test -p "*.py" |