Skip to content

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

[pre-commit.ci] pre-commit autoupdate

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

Workflow file for this run

name: Python package
on: [push]
jobs:
pytest:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
python-version: [3.8, 3.9, 3.10]
torch-version: [1.9.0, 1.10.0]
include:
- torch-version: 1.9.0
torchvision-version: 0.10.0
- torch-version: 1.10.0
torchvision-version: 0.11.1
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}}+cpu torchvision==${{ matrix.torchvision-version}}+cpu -f https://download.pytorch.org/whl/torch_stable.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==6.2 # https://github.com/nedbat/coveragepy/issues/1312
pip install pytest-cov
#
# make PYTESTCOV
export PYTESTCOV="--cov=graph_weather--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