Skip to content

tests

tests #446

Workflow file for this run

name: tests
on:
# uncoment the two line below to run the workflow for every even day of the month at 24:00h
schedule:
- cron: '0 0 */2 * *'
push:
branches:
- main
# uncomment below if the workflow must run for every push to a PR pointing to the main branch
pull_request:
branches:
- main
jobs:
build:
name: Build for (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'macos-latest'] #, 'windows-latest']
python-version: ['3.11'] #['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
include:
- os: ubuntu-latest
CONDA_OS: linux-64
- os: macos-latest
CONDA_OS: osx-64
steps:
- uses: actions/checkout@v4
- name: Set up conda environment with Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
auto-update-conda: true
python-version: ${{ matrix.python-version }}
activate-environment: test
auto-activate-base: false
- name: Conda info
shell: bash -l {0}
run: |
conda activate test
conda info
conda list
conda config --show-sources
conda config --show
- name: Python info
shell: bash -l {0}
run: |
conda activate test
which python
which pip
python --version
- name: Install qc2
shell: bash -l {0}
run : |
conda activate test
python -m pip install .[dev,publishing,pennylane]
- name: PSI4 install for tests
shell: bash -l {0}
run : |
conda activate test
conda install psi4 -c conda-forge/label/libint_dev -c conda-forge # these conda channels my change in the future
- name: PSI4 info
shell: bash -l {0}
run : |
conda activate test
which psi4
psi4 --version
python -c "import psi4"
#- name: Install Cmake and compilers for ROSE and DIRAC installation
# shell: bash -l {0}
# run: |
# conda activate test
# conda install -c anaconda cmake
# conda install conda-forge::blas
# conda install conda-forge::lapack
# if [[ ${{ matrix.os }} == 'macos-latest' ]]; then
# conda install -c conda-forge gfortran clang clangxx
# else
# conda install -c conda-forge gfortran gcc gxx
# fi
#- name: install HDF5 libraries
# shell: bash -l {0}
# run: |
# conda activate test
# conda install -c anaconda hdf5
#- name: ROSE install for tests
# shell: bash -l {0}
# run: |
# conda activate test
# git clone https://gitlab.com/quantum_rose/rose.git
# cd rose
# if [[ ${{ matrix.os }} == 'macos-latest' ]]; then
# cmake -S . -B build -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DBLAS_LIBRARIES=$CONDA_PREFIX/lib/libblas.dylib -DLAPACK_LIBRARIES=$CONDA_PREFIX/lib/liblapack.dylib
# else
# cmake -S . -B build -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DBLAS_LIBRARIES=$CONDA_PREFIX/lib/libblas.so -DLAPACK_LIBRARIES=$CONDA_PREFIX/lib/liblapack.so
# fi
# cmake --build build
# cmake --install build
# echo `pwd`/bin >> $GITHUB_PATH
# pip install ./ase_rose
# cd ..
#- name: DIRAC install for tests
# shell: bash -l {0}
# run: |
# conda activate test
# git clone --depth 1 --recursive https://gitlab.com/dirac/dirac.git
# cd dirac
# if [[ ${{ matrix.os }} == 'macos-latest' ]]; then
# ./setup --prefix=$CONDA_PREFIX --blas=$CONDA_PREFIX/lib/libblas.dylib --lapack=$CONDA_PREFIX/lib/liblapack.dylib --pcmsolver=OFF --exatensor=OFF
# else
# ./setup --prefix=$CONDA_PREFIX --blas=$CONDA_PREFIX/lib/libblas.so --lapack=$CONDA_PREFIX/lib/liblapack.so --pcmsolver=OFF --exatensor=OFF
# cd build
# make -j
# make install
# echo `pwd`/bin >> $GITHUB_PATH
# cd ..
- name: Run unit tests
shell: bash -l {0}
run : |
python -m pytest --cov --cov-report=xml
- name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Verify that we can build the package
shell: bash -l {0}
run: |
conda activate test
python setup.py sdist bdist_wheel