Skip to content

Commit

Permalink
Test all PyTorch versions >=1.11.0 (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinfriede authored Apr 4, 2024
1 parent df8963c commit 1c83393
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 13 deletions.
61 changes: 50 additions & 11 deletions .github/workflows/python.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# This file is part of tad-dftd3.
# SPDX-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Tests

on:
Expand All @@ -7,41 +21,57 @@ on:
- master
paths-ignore:
- "doc*/**"
- "./*.ya?ml"
- "**/*.md"
- "**/*.rst"

pull_request:
paths-ignore:
- "doc*/**"
- "./*.ya?ml"
- "**/*.md"
- "**/*.rst"

workflow_dispatch:

jobs:
python:
runs-on: ${{ matrix.os }}
main:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
# PyTorch now fully supports Python =<3.11
# see: https://github.com/pytorch/pytorch/issues/86566
#
# PyTorch does not support Python 3.12 (all platforms)
# see: https://github.com/pytorch/pytorch/issues/110436
torch-version: ["1.11.0", "1.12.1", "1.13.1", "2.0.1", "2.1.2", "2.2.2"]
exclude:
# PyTorch now fully supports Python=<3.11
# see: https://github.com/pytorch/pytorch/issues/86566
#
# PyTorch does not support Python 3.12 (all platforms)
# see: https://github.com/pytorch/pytorch/issues/110436
- os: ubuntu-latest
python-version: "3.12"
- os: macos-latest
python-version: "3.12"
- os: windows-latest
python-version: "3.12"
# PyTorch<1.13.0 does only support Python=<3.10
- python-version: "3.11"
torch-version: "1.11.0"
- python-version: "3.11"
torch-version: "1.12.1"
# On macOS and Windows, 1.13.x is also not supported for Python>=3.10
- os: macos-latest
python-version: "3.11"
torch-version: "1.13.1"
- os: windows-latest
python-version: "3.11"
torch-version: "1.13.1"

runs-on: ${{ matrix.os }}

defaults:
run:
shell: ${{ contains(matrix.os, 'windows') && 'powershell' || 'bash {0}' }}
shell: bash {0}

steps:
- name: Checkout code
Expand All @@ -57,11 +87,20 @@ jobs:
python3 -m pip install --upgrade pip
python3 -m pip install tox
- name: Test Python API
run: tox -e py
- name: Determine TOXENV
run: echo "TOXENV=py$(echo ${{ matrix.python-version }} | tr -d '.')-torch$(echo ${{ matrix.torch-version }} | tr -d '.')" >> $GITHUB_ENV

- name: Print TOXENV
run: echo "TOXENV is set to '${{ env.TOXENV }}'."

- name: Unittests with tox
run: tox -e ${{ env.TOXENV }}

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
if: matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest'
if: >
matrix.python-version == '3.11' &&
matrix.torch-version == '2.2.2' &&
matrix.os == 'ubuntu-latest'
with:
files: ./coverage.xml # optional
14 changes: 14 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# This file is part of tad-dftd3.
# SPDX-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Build

on:
Expand Down
25 changes: 23 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# This file is part of tad-dftd3.
#
# SPDX-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -15,10 +16,30 @@
[tox]
min_version = 4.0
isolated_build = True
envlist = py{38,39,310,311}
envlist =
py38-torch{1110,1121,1131,201,212,222},
py39-torch{1110,1121,1131,201,212,222},
py310-torch{1110,1121,1131,201,212,222},
py311-torch{1131,201,212,221}

[testenv]
deps = .[tox]
setenv =
PIP_EXTRA_INDEX_URL = {env:PIP_EXTRA_INDEX_URL:https://download.pytorch.org/whl/cpu}
deps =
torch1110: torch==1.11.0
torch1120: torch==1.12.0
torch1121: torch==1.12.1
torch1130: torch==1.13.0
torch1131: torch==1.13.1
torch200: torch==2.0.0
torch201: torch==2.0.1
torch210: torch==2.1.0
torch211: torch==2.1.1
torch212: torch==2.1.2
torch220: torch==2.2.0
torch221: torch==2.2.1
torch222: torch==2.2.2
.[tox]
commands =
pytest -vv {posargs: \
-n logical \
Expand Down

0 comments on commit 1c83393

Please sign in to comment.