-
Notifications
You must be signed in to change notification settings - Fork 58
154 lines (136 loc) · 5.75 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: Unit Test nmma
on:
push:
branches: [main]
paths-ignore:
- "doc/**"
pull_request:
branches: [main]
paths-ignore:
- "doc/**"
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -el {0}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout branch being tested
uses: actions/checkout@v4
- name: Set up Python with Conda ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.os == 'macos-latest' && 'arm64' || 'x86_64' }}
miniforge-version: latest
use-mamba: true
mamba-version: "*"
activate-environment: nmma_env
- name: Restore SVD models from cache
uses: actions/cache@v4
with:
path: svdmodels
key: svdmodels-${{ hashFiles('**/LICENSE') }}
restore-keys: svdmodels-
save-always: true
- 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@v4
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-2-${{ hashFiles('**/pyproject.toml', '**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-2-
save-always: true
- name: Update Homebrew
if: matrix.os == 'macos-latest'
run: |
brew update --preinstall
- name: Configure Homebrew cache
if: matrix.os == 'macos-latest'
uses: actions/cache@v4
with:
path: |
~/Library/Caches/Homebrew/openmpi--*
~/Library/Caches/Homebrew/downloads/*--openmpi-*
~/Library/Caches/Homebrew/hdf5--*
~/Library/Caches/Homebrew/downloads/*--hdf5-*
~/Library/Caches/Homebrew/gcc--*
~/Library/Caches/Homebrew/downloads/*--gcc-*
~/Library/Caches/Homebrew/openblas--*
~/Library/Caches/Homebrew/downloads/*--openblas-*
~/Library/Caches/Homebrew/lapack--*
~/Library/Caches/Homebrew/downloads/*--lapack-*
~/Library/Caches/Homebrew/basictex--*
~/Library/Caches/Homebrew/downloads/*--basictex-*
~/Library/Caches/Homebrew/cmake--*
~/Library/Caches/Homebrew/downloads/*--cmake-*
key: brew-${{ hashFiles('**/pyproject.toml') }}
restore-keys: brew-
save-always: true
- name: Install Homebrew dependencies
if: matrix.os == 'macos-latest'
run: |
env HOMEBREW_NO_AUTO_UPDATE=1 brew install openmpi hdf5 gcc openblas lapack basictex cmake
eval "$(/usr/libexec/path_helper)"
sudo tlmgr update --self
sudo tlmgr install collection-latex
sudo tlmgr install collection-fontsrecommended
sudo tlmgr install dvipng
sudo tlmgr install cm-super
sudo tlmgr install type1cm
- name: Install Linux Dependencies
if: matrix.os == 'ubuntu-latest'
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: 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
execute_install_scripts: true
- name: Install dependencies (macOS)
if: matrix.os == 'macos-latest'
run: |
conda install -c conda-forge pyfftw c-compiler ligo-segments python-ligo-lw
echo "FC=$(which gfortran-14)" >> $GITHUB_ENV
echo "CC=$(which gcc)" >> $GITHUB_ENV
echo "CXX=$(which g++)" >> $GITHUB_ENV
- name: Install dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y texlive texlive-latex-extra texlive-fonts-recommended dvipng cm-super python3-mpi4py
- name: Install Python dependencies
run: |
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 coveralls
python -m pip install -r ml_requirements.txt -r grb_requirements.txt -r tf_requirements.txt -r sklearn_requirements.txt
python -m pip install .
git clone https://github.com/JohannesBuchner/MultiNest && cd MultiNest/build && rm -rf * && cmake .. && make && cd ../..
pwd
- name: Export Libraries
run: |
echo "LD_LIBRARY_PATH=$HOME/work/nmma/nmma/MultiNest/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
echo "DYLD_LIBRARY_PATH=$HOME/work/nmma/nmma/MultiNest/lib:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV
- 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: Test with pytest
run: |
python -m coverage run --source nmma -m pytest nmma/tests/*.py
- name: Run Coveralls
if: ${{ success() }}
run: |
coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}