Skip to content

[pre-commit.ci] pre-commit autoupdate #395

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #395

Workflow file for this run

name: Python package
on:
push:
pull_request:
types: [opened, reopened]
jobs:
pytest:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
python-version: ["3.10", "3.11", "3.12"]
torch-version: [2.0.0, 2.1.0, 2.2.0]
include:
- torch-version: 2.1.0
torchvision-version: 0.16.0
- torch-version: 2.0.0
torchvision-version: 0.15.1
- torch-version: 2.2.0
torchvision-version: 0.17.0
exclude:
- python-version: "3.12"
torch-version: 2.0.0
- python-version: "3.12"
torch-version: 2.1.0
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 PyTorch ${{ matrix.torch-version }}+cpu
run: |
pip install torch==${{ matrix.torch-version}} torchvision==${{ matrix.torchvision-version}} --index-url https://download.pytorch.org/whl/cpu
- name: Install internal dependencies
run: |
pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-${{ matrix.torch-version}}+cpu.html
- name: Install main package
run: |
pip install -e .
pip install pytest-xdist
- name: Setup with pytest-xdist
run: |
# lets get the string for how many cpus to use with pytest
echo "Will be using ${{ inputs.pytest_numcpus }} cpus for pytest testing"
#
# make PYTESTXDIST
export PYTESTXDIST="-n 2"
if [ 2 -gt 0 ]; then export PYTESTXDIST="$PYTESTXDIST --dist=loadfile"; fi
#
# echo results and save env var for other jobs
echo "pytest-xdist options that will be used are: $PYTESTXDIST"
echo "PYTESTXDIST=$PYTESTXDIST" >> $GITHUB_ENV
- name: Setup with pytest-cov
run: |
# let make pytest run with coverage
echo "Will be looking at coverage of dir graph_weather"
#
# install pytest-cov
pip install coverage==7.4.3
pip install pytest-cov
#
# make PYTESTCOV
export PYTESTCOV="--cov=graph_weather tests/ --cov-report=xml"
# echo results and save env var for other jobs
echo "pytest-cov options that will be used are: $PYTESTCOV"
echo "PYTESTCOV=$PYTESTCOV" >> $GITHUB_ENV
- name: Run pytest
run: |
export PYTEST_COMMAND="pytest $PYTESTCOV $PYTESTXDIST -s"
echo "Will be running this command: $PYTEST_COMMAND"
eval $PYTEST_COMMAND
- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: false