Merge pull request #442 from mir-group/develop #75
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: Run Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.9] | |
torch-version: [1.13.1, "2.*"] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
env: | |
TORCH: "${{ matrix.torch-version }}" | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools wheel | |
if [ ${TORCH} = "1.13.1" ]; then pip install numpy==1.*; fi # older torch versions fail with numpy 2 | |
pip install torch==${TORCH} -f https://download.pytorch.org/whl/cpu/torch_stable.html | |
pip install h5py scikit-learn # install packages that aren't required dependencies but that the tests do need | |
pip install --upgrade-strategy only-if-needed . | |
- name: Install pytest | |
run: | | |
pip install pytest | |
pip install pytest-xdist[psutil] | |
- name: Download test data | |
run: | | |
mkdir benchmark_data | |
cd benchmark_data; wget "http://quantum-machine.org/gdml/data/npz/aspirin_ccsd.zip"; cd .. | |
- name: Test with pytest | |
run: | | |
# See https://github.com/pytest-dev/pytest/issues/1075 | |
PYTHONHASHSEED=0 pytest -n auto tests/ |