CI #582
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.7', os: ubuntu-latest, documentation: True} | |
- {version: '3.9', os: ubuntu-latest, documentation: False} | |
- {version: '3.7', os: macos-11 , documentation: False} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.version }} | |
- uses: actions/cache@v1 | |
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 | |
python -m pip install --user -r requirements.txt -v | |
# | |
- name: Run python tests with std allocator | |
run: | | |
python setup.py test -a '--cov=adcc' | |
- name: Run reduced python tests with libxm | |
run: | | |
python setup.py test -a '--allocator=libxm -k "TestFunctionality and h2o_sto3g"' | |
- name: Run C++ tests | |
run: python setup.py cpptest -v | |
# | |
- name: Dependencies for documentation | |
run: python -m pip install --user .[build_docs] | |
if: matrix.documentation | |
- name: Build documentation | |
run: python setup.py build_docs | |
if: matrix.documentation | |
- name: Upload documentation artefact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: documentation | |
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 | |
- 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 Conda Python | |
# | |
test_conda: | |
name: Conda Python ${{ matrix.version }} - ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- {version: '3.9', os: ubuntu-latest, documentation: False} | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
activate-environment: adcc-dev | |
environment-file: conda/environment_dev_linux.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 | |
# NOTE: pcmsolver not 'linked' with Psi4 1.8 | |
python setup.py test -a '-k "not pcm"' | |
python setup.py cpptest -v | |
# | |
# - 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@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' | |
- 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 |