-
Notifications
You must be signed in to change notification settings - Fork 4
93 lines (90 loc) · 3.3 KB
/
pytest-ubuntu.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python application
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
test:
name: Run tests/coverage
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
channels: conda-forge, pytorch
activate-environment: desolver
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: conda install --file requirements.txt -y
- name: Install pyaudi
continue-on-error: ${{ matrix.python-version == 3.8 || matrix.python-version == 3.9 }}
run: conda install "pyaudi>=1.6.5" -y
- name: Install pytorch on Linux and Windows
if: startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'ubuntu')
run: conda install "pytorch>=1.8.0" torchvision torchaudio cpuonly -y
# - name: Install pytorch on Mac
# if: startsWith(matrix.os, 'macos')
# run: conda install pytorch torchvision torchaudio -y
- name: Test Numpy backend
continue-on-error: ${{ matrix.python-version == 3.8 || matrix.python-version == 3.9 }}
env:
DES_BACKEND: 'numpy'
run: pytest --cov-append --cov-report=xml --cov=desolver -n 2 --run_implicit --run_explicit
- name: Test PyTorch backend
if: startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'ubuntu')
continue-on-error: ${{ matrix.python-version == 3.8 || matrix.python-version == 3.9 }}
env:
DES_BACKEND: 'torch'
run: pytest --cov-append --cov-report=xml --cov=desolver --run_implicit --run_explicit --run_torch_gradients
- name: Install codecov
run: pip install codecov
- name: Upload Coverage report
run: codecov
publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
needs: test
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@master
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish distribution 📦 to Test PyPI
if: startsWith(github.ref, 'refs/tags/test_v')
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags/v')
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}