-
Notifications
You must be signed in to change notification settings - Fork 2
92 lines (91 loc) · 3.18 KB
/
build.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# -----------------------------------------------------------------------------
# - invoked on push, pull_request, manual trigger, or schedule
# - test under at least 3 versions of python
# -----------------------------------------------------------------------------
name: build
on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: "0 8 * * *"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: get upstream branch name
run: |
if "${{ github.event_name == 'pull_request' }}" ; then
echo "branch_name=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
else
echo "branch_name=${GITHUB_REF_NAME}" >> $GITHUB_ENV
fi
- name: Update pip
run: |
python -m pip install --upgrade pip
- name: Install dependencies
run: |
pip install .[dev]
- name: check for dependency branches and install if needed
run: |
cd ..
git clone https://github.com/ihmeuw/vivarium_build_utils.git
cd pseudopeople
echo "Contents of install_dependency_branch.sh"
echo "----------------------------------------"
cat ../vivarium_build_utils/install_dependency_branch.sh
echo ""
echo "----------------------------------------"
sh ../vivarium_build_utils/install_dependency_branch.sh layered_config_tree ${branch_name} github
- name: print environment values
run: |
cat $GITHUB_ENV
- name: Install dependencies
run: |
pip install .[dev]
- name: Lint
run: |
pip install black==22.3.0 isort mypy
isort . --check --verbose --only-modified --diff
black . --check --diff
mypy .
- name: Test
run: |
if "${{ github.event_name == 'schedule' }}"; then
pytest --runslow ./tests
else
pytest --limit=1 ./tests
fi
- name: Doc build
run: |
make html -C docs/ SPHINXOPTS="-W --keep-going -n"
- name: Doctest
run: |
make doctest -C docs/
- name: Send mail
# Notify when cron job fails
if: (github.event_name == 'schedule' && failure())
uses: dawidd6/action-send-mail@v2
with:
# mail server settings
server_address: smtp.gmail.com
server_port: 465
# user credentials
username: ${{ secrets.NOTIFY_EMAIL }}
password: ${{ secrets.NOTIFY_PASSWORD }}
# email subject
subject: ${{ github.job }} job of ${{ github.repository }} has ${{ job.status }}
# email body as text
body: ${{ github.job }} job in worflow ${{ github.workflow }} of ${{ github.repository }} has ${{ job.status }}
# comma-separated string, send email to
# from email name
from: Pseudopeople Notifications