MLopsLocal / .github /workflows /test-workflow.yml
Sanjeeth
Create test-workflow.yml
ccd977d unverified
Raw History Blame Contribute Delete
1.07 kB
name: Run Tests on Push
on:
push:
branches:
- main # Change this to the branch you want to trigger testing
jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
# Step 2: Set up Python
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11.4'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run unittest
run: |
python -m unittest discover -s . -p 'test_app.py'
- name: Send Discord Notification
if: failure()
run: |
curl -H "Content-Type: application/json" \
-d "{\"username\": \"GitHub Bot\", \"content\": \"❌ **Test failure in repository: ${{ github.repository }}** on branch **${{ github.ref_name }}**. [Check logs](${{
github.event.compare }})\"}" \
${{ secrets.DISCORD_WEBHOOK_URL }}