-
Notifications
You must be signed in to change notification settings - Fork 21
219 lines (215 loc) · 7.83 KB
/
ci.yaml
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
name: CI
on:
push:
branches: [master]
pull_request:
schedule:
- cron: '0 4 * * 6' # Run every Sunday
jobs:
#
# Unit tests
#
test:
name: Python ${{ matrix.version }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- {version: '3.11', os: ubuntu-latest, documentation: True}
- {version: '3.9', os: ubuntu-latest, documentation: False}
- {version: '3.11', os: macos-13 , documentation: False}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.version }}
- uses: actions/cache@v4
env:
cache-name: cache-artifacts
with:
path: |
~/.ccache
~/.cache/pip
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- name: Install system dependencies on Linux
run: sudo apt-get install libopenblas-base ccache doxygen lcov
if: contains( matrix.os, 'ubuntu')
- name: Install system dependencies on macOS
run: brew install ccache doxygen lcov
if: contains( matrix.os, 'macos')
#
- name: Dump siteconfig with coverage flags for C++
run: |
mkdir $HOME/.adcc/
echo 'coverage = True' > $HOME/.adcc/siteconfig.py
- name: Hard-code download url for MacOS
run: |
echo "libtensor_url = \"$BASE_URL/$VERSION_URL\"" >> $HOME/.adcc/siteconfig.py
env:
BASE_URL: https://github.com/adc-connect/libtensor/releases/download
VERSION_URL: v3.0.1/libtensorlight-3.0.1-macosx_10_15_x86_64.tar.gz
if: contains( matrix.os, 'macos')
- name: Install python dependencies
run: |
export PATH="/usr/local/opt/ccache/libexec:$PATH"
export PATH="/usr/lib/ccache:$PATH"
python -m pip install --user pyscf cppe wheel
#
- name: Install package
run: |
pip install --user .[tests]
- name: Run python tests with std allocator
run: |
python -m pytest adcc --cov=adcc
- name: Run reduced python tests with libxm
run: |
python -m pytest adcc --allocator=libxm -k "TestFunctionality and h2o_sto3g"
- name: Run C++ tests
run: python setup.py cpptest -v
# Documentation build
- name: Dependencies for documentation
run: python -m pip install --user .[build_docs]
if: matrix.documentation
- name: Build documentation
run: |
cd docs && doxygen && cd ..
sphinx-build -M html docs build/sphinx
if: matrix.documentation
- name: Upload documentation artifact
uses: actions/upload-pages-artifact@v3
with:
path: build/sphinx/html
if: matrix.documentation
#
- name: Upload coverage to codecov
run: |
pip install codecov
codecov -X gcov
lcov --directory . --capture --output-file coverage.info
lcov --remove coverage.info '/opt/*' '/Applications/*' '/Library/*' '/usr/*' "${HOME}"'/.cache/*' "${HOME}"'/.local/*' "${PWD}"'/build/*' "${PWD}"'/libadcc/tests/*' --output-file coverage.info
lcov --list coverage.info
codecov -X gcov -f coverage.info
if: contains(matrix.os, 'ubuntu')
- name: Upload coverage to coveralls
# Note: Needs to be after the above step, because it parses the coverage.info
run: |
pip install coveralls
sudo gem install coveralls-lcov
coveralls-lcov -v -n coverage.info > coverage.json
coveralls --service=github --merge=coverage.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: contains(matrix.os, 'ubuntu')
deploy_documentation:
name: Deploy Documentation to Github Pages
if: github.ref == 'refs/heads/master'
needs: test
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
#
# Test Conda Python
#
test_conda:
name: Conda Python ${{ matrix.version }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- {version: '3.11', os: ubuntu-latest, documentation: False}
- {version: '3.11', os: macos-13 , documentation: False}
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- name: Patch compiler in Conda environment file
if: contains( matrix.os, 'macos')
run: |
sed -E -i.bak "s;gcc_linux-64;clang_osx-64;g" conda/environment.yml
sed -E -i.bak "s;gxx_linux-64;clangxx_osx-64;g" conda/environment.yml
- uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: adcc-dev
environment-file: conda/environment.yml
miniforge-variant: Mambaforge
use-mamba: true
miniforge-version: latest
python-version: ${{ matrix.version }}
auto-activate-base: false
# - name: Dump siteconfig with coverage flags for C++
# run: |
# mkdir $HOME/.adcc/
# echo 'coverage = True' > $HOME/.adcc/siteconfig.py
- name: Install Psi4 from c-f
run: |
mamba install psi4 pyddx -c conda-forge -c conda-forge/label/libint_dev
psi4 --version
python -c "import psi4"
- name: Build and test adcc
run: |
conda info
conda list
CXXFLAGS="$(echo $CXXFLAGS | sed 's/-fvisibility-inlines-hidden //g')"
pip install .[tests] --user
# NOTE: pcmsolver not 'linked' with Psi4 1.8
pytest adcc -k "not pcm"
# python setup.py cpptest -v # TODO: currently doesn't compile...
#
# - name: Upload coverage to codecov
# run: |
# pip install codecov
# codecov -X gcov
# lcov --directory . --capture --output-file coverage.info
# lcov --remove coverage.info '/opt/*' '/Applications/*' '/Library/*' '/usr/*' "${HOME}"'/.cache/*' "${HOME}"'/.local/*' "${PWD}"'/build/*' "${PWD}"'/libadcc/tests/*' --output-file coverage.info
# lcov --list coverage.info
# codecov -X gcov -f coverage.info
#
# - name: Upload coverage to coveralls
# # Note: Needs to be after the above step, because it parses the coverage.info
# run: |
# pip install coveralls
# sudo gem install coveralls-lcov
# coveralls-lcov -v -n coverage.info > coverage.json
# coveralls --service=github --merge=coverage.json
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#
# Test source code formatting
#
formatting:
name: Code style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
pip install flake8
sudo apt-get install clang-format
- run: flake8
- name: Checking C++ files with clang-format
working-directory: libadcc
run: |
clang-format --version
find . -type f \( -name '*.cc' -o -name '*.hh' \) -print0 | xargs -r0 clang-format -i
git diff --exit-code