Run tests and (if on main branch) send email digest #983
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: Run tests and (if on master) send email digest | |
on: | |
push: | |
schedule: | |
- cron: '30 4 * * *' # 04:30 every day | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
HOME_POSTCODE: ${{ secrets.HOME_POSTCODE }} | |
OFFICE_POSTCODE: ${{ secrets.OFFICE_POSTCODE }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.8' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements_dev.txt | |
- name: Test with pytest (unit tests) | |
run: | | |
pytest ebay_multilocation_item_notifier/tests/unit/ | |
env: | |
PYTEST_ADDOPTS: --color=yes # Force colour output | |
- name: Test with pytest (integration tests) | |
run: | | |
pytest ebay_multilocation_item_notifier/tests/integration/ | |
env: | |
EMAIL_RECIPIENT_ADDRESS: ${{ secrets.EMAIL_RECIPIENT_ADDRESS }} | |
EMAIL_RECIPIENT_NAME: ${{ secrets.EMAIL_RECIPIENT_NAME }} | |
EMAIL_SENDER_ADDRESS: ${{ secrets.EMAIL_SENDER_ADDRESS }} | |
EMAIL_SENDER_NAME: ${{ secrets.EMAIL_SENDER_NAME }} | |
EMAIL_SMTP_HOST: ${{ secrets.EMAIL_SMTP_HOST }} | |
EMAIL_SMTP_PASSWORD: ${{ secrets.EMAIL_SMTP_PASSWORD }} | |
EMAIL_SMTP_USERNAME: ${{ secrets.EMAIL_SMTP_USERNAME }} | |
PYTEST_ADDOPTS: --color=yes # Force colour output | |
- name: Send digest email | |
if: github.ref == 'refs/heads/master' | |
run: | | |
python ebay_multilocation_item_notifier/item_notifier.py | |
env: | |
EMAIL_RECIPIENT_ADDRESS: ${{ secrets.EMAIL_RECIPIENT_ADDRESS }} | |
EMAIL_RECIPIENT_NAME: ${{ secrets.EMAIL_RECIPIENT_NAME }} | |
EMAIL_SENDER_ADDRESS: ${{ secrets.EMAIL_SENDER_ADDRESS }} | |
EMAIL_SENDER_NAME: ${{ secrets.EMAIL_SENDER_NAME }} | |
EMAIL_SMTP_HOST: ${{ secrets.EMAIL_SMTP_HOST }} | |
EMAIL_SMTP_PASSWORD: ${{ secrets.EMAIL_SMTP_PASSWORD }} | |
EMAIL_SMTP_USERNAME: ${{ secrets.EMAIL_SMTP_USERNAME }} | |
- uses: gautamkrishnar/keepalive-workflow@master # Push dummy commit after 50 days of inactivity (to keep Github Scheduled Action alive) |