-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (61 loc) · 2.46 KB
/
workflow.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Run tests and (if on main branch) send email digest
on:
push:
schedule:
- cron: '30 4 * * *' # 04:30 every day
jobs:
test-and-send:
name: Run tests and run item finder
runs-on: ubuntu-latest
env:
HOME_POSTCODE: ${{ secrets.HOME_POSTCODE }}
OFFICE_POSTCODE: ${{ secrets.OFFICE_POSTCODE }}
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements_dev.txt
- name: Run unit tests
run: |
pytest ebay_multilocation_item_notifier/tests/unit/
env:
PYTEST_ADDOPTS: --color=yes # Force colour output
- name: Run 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/main'
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 }}
keep-repo-active:
name: Keep repo active to persist schedule trigger
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- uses: actions/checkout@v4
- uses: gautamkrishnar/keepalive-workflow@v2 # Uses GitHub API to keep the repository active (in order to persist the GitHub Actions `schedule` trigger)
with:
time_elapsed: "50" # Default is 45