-
Notifications
You must be signed in to change notification settings - Fork 58
129 lines (117 loc) · 4.44 KB
/
continous_integration.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Unit Test nmma
on:
push:
paths-ignore:
- 'doc/**'
pull_request:
paths-ignore:
- 'doc/**'
workflow_dispatch:
jobs:
download-files:
runs-on: ubuntu-latest
steps:
- name: Checkout branch being tested
uses: actions/checkout@v3
- name: Cache svdmodels directory
uses: actions/cache@v3
with:
path: svdmodels
key: svdmodels-${{ runner.os }}-${{ hashFiles('**/LICENSE') }}
restore-keys: svdmodels-${{ runner.os }}-
- name: Check if SVD models exist
id: check-artifact-download
run: |
if [ -d "svdmodels" ]; then
echo "Artifacts exist, skipping download."
echo "::set-output name=exists::true"
else
echo "Artifacts do not exist, will download."
echo "::set-output name=exists::false"
fi
- name: Download SVD models
if: steps.check-artifact-download.outputs.exists == 'false'
run: |
wget --show-progress -O svdmodels.tar.gz https://enlil.gw.physik.uni-potsdam.de/~jhawar/svdmodels/svdmodels.tar.gz
mkdir -p svdmodels
tar -xvf svdmodels.tar.gz -C svdmodels/
rm svdmodels.tar.gz
working-directory: ${{ github.workspace }}
build:
runs-on: ubuntu-latest
needs: download-files
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10', '3.11']
services:
postgres:
image: postgres
env:
POSTGRES_USER: nmma
POSTGRES_PASSWORD: anything
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout branch being tested
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Restore SVD models from cache
uses: actions/cache@v3
with:
path: svdmodels
key: svdmodels-${{ runner.os }}-${{ hashFiles('**/LICENSE') }}
restore-keys: svdmodels-${{ runner.os }}-
- name: Get pip cache dir
id: pip-cache
run: |
python -m pip install --upgrade pip setuptools wheel
echo "::set-output name=dir::$(pip cache dir)"
- name: pip cache
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-2-${{ hashFiles('**/pyproject.toml', '**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-2-
- name: Install dependencies
run: |
sudo apt-get update
# sudo apt-get install gfortran swig libhdf5-serial-dev libmpich-dev
sudo apt-get update
sudo apt install -y openmpi-bin libopenmpi-dev gfortran build-essential libblas3 libblas-dev liblapack3 liblapack-dev libatlas-base-dev texlive texlive-latex-extra texlive-fonts-recommended dvipng cm-super
python -m pip install --upgrade git+https://github.com/bitranox/wrapt_timeout_decorator.git
python -m pip install pytest pytest-cov flake8 pytest-aiohttp sqlparse freezegun PyJWT joblib tensorflow afterglowpy coveralls
python -m pip install .
git clone https://github.com/JohannesBuchner/MultiNest && cd MultiNest/build && cmake .. && make && cd ../..
pwd
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude docs
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude docs,versioneer.py,nmma/_version.py,nmma/tests,nmma/*/__init__.py
- name: Initialize database
run: |
echo "localhost:5432:*:nmma:anything" > ~/.pgpass
chmod 600 ~/.pgpass
psql -U nmma -h localhost -c "GRANT ALL PRIVILEGES ON DATABASE nmma TO nmma;" nmma
- name: Test with pytest
run: |
python -m coverage run --source nmma -m pytest nmma/tests/*.py
env:
LD_LIBRARY_PATH: .:/home/runner/work/nmma/nmma/MultiNest/lib # for Linux
- name: Run Coveralls
if: ${{ success() }}
run: |
coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}