-
-
Notifications
You must be signed in to change notification settings - Fork 35
162 lines (147 loc) · 10.3 KB
/
deploy.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
################################################
### ###
### THIS FILE IS AUTOGENERATED. DO NOT EDIT. ###
### ###
################################################
# Deploys and tests an accepted pull request
name: Deploy and test
# Arguments:
# event_name: pull_request
# event_cond: github.event.pull_request.merged
# trigger: deploy
on:
repository_dispatch:
pull_request:
branches:
- master
types: [closed]
jobs:
# we need to do this first as all the linux versions install the same thing from PyPI
deploy_sdist:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04]
python-version: [3.9.12]
pytorch-version: [1.10.0, 1.10.1, 1.11.0]
steps:
- name: Checkout code
if: ((github.event_name == 'pull_request' && (github.event.pull_request.merged)) || (github.event_name == 'repository_dispatch' && contains(github.event.action, '-trigger deploy ') && ((contains(github.event.action, '-os windows-2016') && matrix.os == 'windows-2016') || (contains(github.event.action, '-os ubuntu-18.04') && matrix.os == 'ubuntu-18.04') || contains(github.event.action, '-os *')) && ((contains(github.event.action, '-pv 3.7.0') && matrix.python-version == '3.7.0') || (contains(github.event.action, '-pv 3.8.2') && matrix.python-version == '3.8.2') || (contains(github.event.action, '-pv 3.9.12') && matrix.python-version == '3.9.12') || contains(github.event.action, '-pv *'))))
uses: actions/checkout@v1
with:
ref: master
- name: Install Python
if: ((github.event_name == 'pull_request' && (github.event.pull_request.merged)) || (github.event_name == 'repository_dispatch' && contains(github.event.action, '-trigger deploy ') && ((contains(github.event.action, '-os windows-2016') && matrix.os == 'windows-2016') || (contains(github.event.action, '-os ubuntu-18.04') && matrix.os == 'ubuntu-18.04') || contains(github.event.action, '-os *')) && ((contains(github.event.action, '-pv 3.7.0') && matrix.python-version == '3.7.0') || (contains(github.event.action, '-pv 3.8.2') && matrix.python-version == '3.8.2') || (contains(github.event.action, '-pv 3.9.12') && matrix.python-version == '3.9.12') || contains(github.event.action, '-pv *'))))
uses: actions/setup-python@v1
with:
python-version: '3.7'
- name: Linux
if: ((github.event_name == 'pull_request' && (github.event.pull_request.merged)) || (github.event_name == 'repository_dispatch' && contains(github.event.action, '-trigger deploy ') && ((contains(github.event.action, '-os windows-2016') && matrix.os == 'windows-2016') || (contains(github.event.action, '-os ubuntu-18.04') && matrix.os == 'ubuntu-18.04') || contains(github.event.action, '-os *')) && ((contains(github.event.action, '-pv 3.7.0') && matrix.python-version == '3.7.0') || (contains(github.event.action, '-pv 3.8.2') && matrix.python-version == '3.8.2') || (contains(github.event.action, '-pv 3.9.12') && matrix.python-version == '3.9.12') || contains(github.event.action, '-pv *')))) && (matrix.os == 'ubuntu-18.04')
env:
PYTHON_VERSION: ${{ matrix.python-version }}
# Deliberately only creating an sdist; see FAQ
run: |
set -x
. $CONDA/etc/profile.d/conda.sh
conda create -n myenv python=$PYTHON_VERSION -y
conda activate myenv
python -m pip install --upgrade pip
conda install pytorch==${{ matrix.pytorch-version }} -c pytorch -y
python command.py should_not_import
python setup.py egg_info --tag-build=".${{ matrix.pytorch-version }}" sdist
python command.py should_not_import
pip install twine
twine upload -u patrick-kidger -p ${{ secrets.pypi_password }} dist/*
deploy:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2016, ubuntu-18.04]
python-version: [3.7.0, 3.8.2, 3.9.12]
pytorch-version: [1.10.0, 1.10.1, 1.11.0]
fail-fast: false
needs: [deploy_sdist]
steps:
- name: Checkout code
if: ((github.event_name == 'pull_request' && (github.event.pull_request.merged)) || (github.event_name == 'repository_dispatch' && contains(github.event.action, '-trigger deploy ') && ((contains(github.event.action, '-os windows-2016') && matrix.os == 'windows-2016') || (contains(github.event.action, '-os ubuntu-18.04') && matrix.os == 'ubuntu-18.04') || contains(github.event.action, '-os *')) && ((contains(github.event.action, '-pv 3.7.0') && matrix.python-version == '3.7.0') || (contains(github.event.action, '-pv 3.8.2') && matrix.python-version == '3.8.2') || (contains(github.event.action, '-pv 3.9.12') && matrix.python-version == '3.9.12') || contains(github.event.action, '-pv *'))))
uses: actions/checkout@v1
with:
ref: master
- name: Install Python
if: ((github.event_name == 'pull_request' && (github.event.pull_request.merged)) || (github.event_name == 'repository_dispatch' && contains(github.event.action, '-trigger deploy ') && ((contains(github.event.action, '-os windows-2016') && matrix.os == 'windows-2016') || (contains(github.event.action, '-os ubuntu-18.04') && matrix.os == 'ubuntu-18.04') || contains(github.event.action, '-os *')) && ((contains(github.event.action, '-pv 3.7.0') && matrix.python-version == '3.7.0') || (contains(github.event.action, '-pv 3.8.2') && matrix.python-version == '3.8.2') || (contains(github.event.action, '-pv 3.9.12') && matrix.python-version == '3.9.12') || contains(github.event.action, '-pv *'))))
uses: actions/setup-python@v1
with:
python-version: '3.7'
- name: Windows
if: ((github.event_name == 'pull_request' && (github.event.pull_request.merged)) || (github.event_name == 'repository_dispatch' && contains(github.event.action, '-trigger deploy ') && ((contains(github.event.action, '-os windows-2016') && matrix.os == 'windows-2016') || (contains(github.event.action, '-os ubuntu-18.04') && matrix.os == 'ubuntu-18.04') || contains(github.event.action, '-os *')) && ((contains(github.event.action, '-pv 3.7.0') && matrix.python-version == '3.7.0') || (contains(github.event.action, '-pv 3.8.2') && matrix.python-version == '3.8.2') || (contains(github.event.action, '-pv 3.9.12') && matrix.python-version == '3.9.12') || contains(github.event.action, '-pv *')))) && (matrix.os == 'windows-2016')
env:
PYTHON_VERSION: ${{ matrix.python-version }}
shell: cmd
# && chaining seems to be the best (only?) way to run multiple commands in a cmd shell
# It also means that if any command fails then the step as a whole should correctly
# have a nonzero (fail) return code
run: >
"C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Auxiliary/Build/vcvars64.bat" &&
SET DISTUTILS_USE_SDK=1 &&
%CONDA%/Scripts/conda create -n myenv python=%PYTHON_VERSION% -y &&
%CONDA%/Scripts/activate myenv &&
python -m pip install --upgrade pip &&
conda install pytorch==${{ matrix.pytorch-version }} cpuonly -c pytorch -y &&
python command.py should_not_import &&
python setup.py egg_info --tag-build=".${{ matrix.pytorch-version }}" bdist_wheel &&
python command.py should_not_import &&
pip install twine &&
twine upload -u patrick-kidger -p ${{ secrets.pypi_password }} dist/* &&
python -c "import subprocess;
import sys;
import time;
import metadata;
sleep = lambda t: time.sleep(t) or True;
retry = lambda fn: fn() or (sleep(20) and fn()) or (sleep(40) and fn()) or (sleep(120) and fn()) or (sleep(240) and fn());
ret = retry(lambda: not subprocess.run('python -m pip install signatory==' + metadata.version + '.${{ matrix.pytorch-version }} --only-binary signatory').returncode);
sys.exit(not ret)
" &&
python -m pip install numpy &&
python -m pip install iisignature pytest &&
python -c "import os;
import subprocess;
import sys;
print(sys.version);
returncode_test = subprocess.Popen('python command.py test', shell=True).wait();
returncode_version = sys.version[:5] != os.environ['PYTHON_VERSION'][:5];
sys.exit(max(returncode_test, returncode_version))
" &&
echo done
- name: Linux
if: ((github.event_name == 'pull_request' && (github.event.pull_request.merged)) || (github.event_name == 'repository_dispatch' && contains(github.event.action, '-trigger deploy ') && ((contains(github.event.action, '-os windows-2016') && matrix.os == 'windows-2016') || (contains(github.event.action, '-os ubuntu-18.04') && matrix.os == 'ubuntu-18.04') || contains(github.event.action, '-os *')) && ((contains(github.event.action, '-pv 3.7.0') && matrix.python-version == '3.7.0') || (contains(github.event.action, '-pv 3.8.2') && matrix.python-version == '3.8.2') || (contains(github.event.action, '-pv 3.9.12') && matrix.python-version == '3.9.12') || contains(github.event.action, '-pv *')))) && (matrix.os == 'ubuntu-18.04')
env:
PYTHON_VERSION: ${{ matrix.python-version }}
# Deliberately only creating an sdist; see FAQ
run: |
set -x
. $CONDA/etc/profile.d/conda.sh
conda create -n myenv python=$PYTHON_VERSION -y
conda activate myenv
python -m pip install --upgrade pip
conda install pytorch==${{ matrix.pytorch-version }} -c pytorch -y
python command.py should_not_import
retry () { $* || (sleep 20 && $*) || (sleep 40 && $*) || (sleep 120 && $*) || (sleep 240 && $*); }
SIGNATORY_VERSION=$(python -c "import metadata; print(metadata.version)")
retry python -m pip install signatory==$SIGNATORY_VERSION.${{ matrix.pytorch-version }} --no-binary signatory
python -m pip install numpy
python -m pip install iisignature pytest
python -c "import os
import subprocess
import sys
print(sys.version)
returncode_test = subprocess.Popen('python command.py test', shell=True).wait()
returncode_version = sys.version[:5] != os.environ['PYTHON_VERSION'][:5]
sys.exit(max(returncode_test, returncode_version))
"
# TODO: re-enable mac support
# - <#<setup_mac>>
# <#<build_mac>>
# <#<upload_mac>>
# <#<install_remote_mac>>
# <#<test_mac>>
# <#<terminate_mac>>