| 1 |
name: Tests |
| 2 |
|
| 3 |
on: |
| 4 |
workflow_dispatch: |
| 5 |
pull_request: |
| 6 |
branches: |
| 7 |
- 'master' |
| 8 |
push: |
| 9 |
branches: |
| 10 |
- 'master' |
| 11 |
create: |
| 12 |
branches: |
| 13 |
- 'master' |
| 14 |
tags: |
| 15 |
- '**' |
| 16 |
|
| 17 |
jobs: |
| 18 |
|
| 19 |
Lint: |
| 20 |
runs-on: ubuntu-latest |
| 21 |
strategy: |
| 22 |
fail-fast: false |
| 23 |
defaults: |
| 24 |
run: |
| 25 |
shell: bash -l {0} |
| 26 |
steps: |
| 27 |
|
| 28 |
|
| 29 |
- name: Checking Out Repository |
| 30 |
uses: actions/checkout@v2 |
| 31 |
|
| 32 |
- uses: actions/setup-python@v4 |
| 33 |
with: |
| 34 |
python-version: "3.10" |
| 35 |
- run: which python |
| 36 |
- name: Lint with pre-commit |
| 37 |
run: | |
| 38 |
pip install pre-commit |
| 39 |
pre-commit install --install-hooks |
| 40 |
pre-commit run --all-files |
| 41 |
|
| 42 |
linux: |
| 43 |
|
| 44 |
runs-on: ubuntu-latest |
| 45 |
if: "!contains(github.event.head_commit.message, 'no ci')" |
| 46 |
strategy: |
| 47 |
max-parallel: 4 |
| 48 |
matrix: |
| 49 |
python-version: ["3.9", "3.10", "3.11", "3.12"] |
| 50 |
|
| 51 |
steps: |
| 52 |
- uses: actions/checkout@v4 |
| 53 |
- name: Set up Python ${{ matrix.python-version }} |
| 54 |
uses: actions/setup-python@v5 |
| 55 |
with: |
| 56 |
python-version: ${{ matrix.python-version }} |
| 57 |
- name: Install POT |
| 58 |
run: | |
| 59 |
pip install -e . |
| 60 |
- name: Install dependencies |
| 61 |
run: | |
| 62 |
python -m pip install --upgrade pip setuptools |
| 63 |
pip install -r requirements_all.txt |
| 64 |
pip install pytest pytest-cov |
| 65 |
- name: Run tests |
| 66 |
run: | |
| 67 |
python -m pytest --durations=20 -v test/ ot/ --doctest-modules --color=yes --cov=./ --cov-report=xml |
| 68 |
- name: Upload coverage reports to Codecov with GitHub Action |
| 69 |
uses: codecov/codecov-action@v3 |
| 70 |
|
| 71 |
linux-minimal-deps: |
| 72 |
|
| 73 |
runs-on: ubuntu-latest |
| 74 |
if: "!contains(github.event.head_commit.message, 'no ci')" |
| 75 |
steps: |
| 76 |
- uses: actions/checkout@v4 |
| 77 |
- name: Set up Python |
| 78 |
uses: actions/setup-python@v5 |
| 79 |
with: |
| 80 |
python-version: "3.12" |
| 81 |
- name: Install dependencies |
| 82 |
run: | |
| 83 |
python -m pip install --upgrade pip setuptools |
| 84 |
pip install pytest pytest-cov |
| 85 |
- name: Install POT |
| 86 |
run: | |
| 87 |
pip install -e . |
| 88 |
- name: Run tests |
| 89 |
run: | |
| 90 |
python -m pytest --durations=20 -v test/ ot/ --color=yes --cov=./ --cov-report=xml |
| 91 |
- name: Upload coverage reports to Codecov with GitHub Action |
| 92 |
uses: codecov/codecov-action@v3 |
| 93 |
|
| 94 |
macos: |
| 95 |
runs-on: ${{ matrix.os }} |
| 96 |
if: "!contains(github.event.head_commit.message, 'no ci')" |
| 97 |
strategy: |
| 98 |
max-parallel: 4 |
| 99 |
matrix: |
| 100 |
os: [macos-latest, macos-13] |
| 101 |
python-version: ["3.12"] |
| 102 |
|
| 103 |
steps: |
| 104 |
- uses: actions/checkout@v4 |
| 105 |
- name: Set up Python ${{ matrix.python-version }} |
| 106 |
uses: actions/setup-python@v5 |
| 107 |
with: |
| 108 |
python-version: ${{ matrix.python-version }} |
| 109 |
- name: Install POT |
| 110 |
run: | |
| 111 |
pip install -e . |
| 112 |
- name: Install dependencies |
| 113 |
run: | |
| 114 |
python -m pip install --upgrade pip setuptools |
| 115 |
pip install -r requirements_all.txt |
| 116 |
pip install pytest |
| 117 |
- name: Run tests |
| 118 |
run: | |
| 119 |
python -m pytest --durations=20 -v test/ ot/ --color=yes |
| 120 |
|
| 121 |
|
| 122 |
windows: |
| 123 |
runs-on: windows-latest |
| 124 |
if: "!contains(github.event.head_commit.message, 'no ci')" |
| 125 |
strategy: |
| 126 |
max-parallel: 4 |
| 127 |
matrix: |
| 128 |
python-version: ["3.12"] |
| 129 |
|
| 130 |
steps: |
| 131 |
- uses: actions/checkout@v4 |
| 132 |
- name: Set up Python ${{ matrix.python-version }} |
| 133 |
uses: actions/setup-python@v5 |
| 134 |
with: |
| 135 |
python-version: ${{ matrix.python-version }} |
| 136 |
- name: RC.exe |
| 137 |
run: | |
| 138 |
function Invoke-VSDevEnvironment { |
| 139 |
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" |
| 140 |
$installationPath = & $vswhere -prerelease -legacy -latest -property installationPath |
| 141 |
$Command = Join-Path $installationPath "Common7\Tools\vsdevcmd.bat" |
| 142 |
& "${env:COMSPEC}" /s /c "`"$Command`" -no_logo && set" | Foreach-Object { |
| 143 |
if ($_ -match '^([^=]+)=(.*)') { |
| 144 |
[System.Environment]::SetEnvironmentVariable($matches[1], $matches[2]) |
| 145 |
} |
| 146 |
} |
| 147 |
} |
| 148 |
Invoke-VSDevEnvironment |
| 149 |
Get-Command rc.exe | Format-Table -AutoSize |
| 150 |
- name: Update pip |
| 151 |
run : | |
| 152 |
python -m pip install --upgrade pip setuptools |
| 153 |
python -m pip install cython |
| 154 |
- name: Install POT |
| 155 |
run: | |
| 156 |
python -m pip install -e . |
| 157 |
- name: Install dependencies |
| 158 |
run: | |
| 159 |
python -m pip install -r .github/requirements_test_windows.txt |
| 160 |
python -m pip3 install torch torchvision torchaudio |
| 161 |
python -m pip install pytest |
| 162 |
- name: Run tests |
| 163 |
run: | |
| 164 |
python -m pytest --durations=20 -v test/ ot/ --color=yes |