test #3108
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
# This workflow will install Python dependencies, run tests, and report the coverage with a variety of Python versions and OSs. | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: test | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
schedule: | |
# * is a special character in YAML, so you have to quote this string | |
- cron: '0 0 * * *' # every midnight | |
jobs: | |
test: | |
name: Test (${{ matrix.os }}, python version ${{ matrix.python-version }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
python-version: ["3.8", "3.9", "3.10"] # list of Python versions to test | |
exclude: | |
- os: windows-latest | |
python-version: "3.8" | |
- os: windows-latest | |
python-version: "3.9" | |
include: | |
- os: ubuntu-latest | |
path: ~/.cache/pip | |
- os: windows-latest | |
path: ~\AppData\Local\pip\Cache | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python using Miniconda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
python-version: ${{ matrix.python-version }} | |
miniconda-version: latest | |
- name: Cache pip dependencies | |
id: cache_pip | |
uses: actions/cache@v2 | |
with: | |
path: ${{ matrix.path }} | |
key: ${{ runner.os }}-python${{ matrix.python-version }}-pip-20231130-${{ hashFiles('**/setup.py') }} | |
restore-keys: | | |
${{ runner.os }}-python${{ matrix.python-version }}-pip-20231130- | |
# We have used a softer matching strategy for the full hash of setup.py, as recommended by GitHub. | |
# See: https://github.com/davronaliyev/Cache-dependencies-in-GitHub-Actions/blob/main/examples.md#python---pip | |
# This restores the cache first and then downloads any changed packages to avoid updating the cache with | |
# every change to the setup.py file, thus reducing the storage requirements of GitHub Action. | |
# We set a date tag to the cache key to show the updated date of the cache. We can update this date tag to | |
# generate new cache after every major changes in setup.py. | |
- name: Install dependencies | |
run: | | |
pip install rdkit | |
pip install pyparsing==3.0.9 | |
pip install torch==2.0.0+cpu -f https://download.pytorch.org/whl/torch_stable.html | |
pip install torchvision==0.15.0+cpu -f https://download.pytorch.org/whl/torch_stable.html | |
pip install torch_scatter==2.1.1 -f https://data.pyg.org/whl/torch-2.0.0+cpu.html | |
pip install torch_sparse==0.6.17 -f https://data.pyg.org/whl/torch-2.0.0+cpu.html | |
pip install torch_cluster==1.6.1 -f https://data.pyg.org/whl/torch-2.0.0+cpu.html | |
pip install torch_spline_conv==1.2.2 -f https://data.pyg.org/whl/torch-1.13.0+cpu.html | |
pip install torch_geometric==2.3.0 | |
pip install -e .[dev] | |
shell: bash -l {0} | |
- name: Cache downloaded test data | |
id: cache_data | |
uses: actions/cache@v2 | |
with: | |
path: tests/test_data | |
key: ${{ runner.os }}-python${{ matrix.python-version }}-data-${{ hashFiles('tests/download_test_data.py') }} | |
restore-keys: | | |
${{ runner.os }}-python${{ matrix.python-version }}-data-${{ hashFiles('tests/download_test_data.py') }} | |
# Use strict matching for the hash of download_test_data.py, as we want to update the cache whenever the file changes. | |
- name: Download test data | |
if: steps.cache_data.outputs.cache-hit != 'true' | |
run : | | |
python tests/download_test_data.py | |
shell: bash -l {0} | |
- name: Run tests | |
id: run_tests | |
run: | | |
pytest --nbmake --nbmake-timeout=3000 --cov=kale | |
shell: bash -l {0} | |
- name: Determine coverage | |
run: | | |
coverage xml | |
shell: bash -l {0} | |
- name: Report coverage | |
uses: codecov/codecov-action@v1 |