Build #52
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: Build | |
on: | |
push: | |
branches: [ main, dev ] | |
schedule: | |
- cron: '0 0 * * *' # Runs at midnight UTC every day | |
workflow_dispatch: # Allows manual triggering | |
jobs: | |
build: | |
runs-on: ubuntu-latest # You only need one OS matrix for nightly builds | |
env: | |
PYTHON: '3.9' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Test and generate coverage report | |
run: | | |
pip install pytest | |
pip install pytest-cov | |
pytest --cov=./ --cov-report=xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v1 | |
with: | |
file: ./coverage.xml | |
fail_ci_if_error: true | |
- name: Notify Slack on failure | |
if: failure() # This step runs only if previous steps fail | |
uses: Ilshidur/action-slack@v2 | |
with: | |
args: | | |
--channel '#your-channel' | |
--text 'The nightly build failed. Please check the build logs.' | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |