-
Notifications
You must be signed in to change notification settings - Fork 1
236 lines (216 loc) · 8.4 KB
/
actions.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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
---
name: CI
on:
push:
tags: ["release/v*"]
branches: ["master", "pyenv-actions"]
pull_request:
branches: ["master", "pyenv-actions"]
workflow_dispatch:
jobs:
test-with-pyenv-interactive:
name: "Pytest with pyenv virtualenv interactive"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout repo"
uses: actions/checkout@v2
- name: "Disable conda"
# Conda is installed by default on GitHub Actions and interferes with pyenv
# Sadly, pyenv-virtualenv doesn't work with conda anymore
# https://github.com/pyenv/pyenv-virtualenv/issues/270
# We crudely remove it by deleting the binary - this is sufficient to stop
# pyenv-virtualenv from trying to use it
run: |
sudo rm /usr/bin/conda
- name: "Install pyenv"
uses: "gabrielfalcao/pyenv-action@v16"
- name: "Configure pyenv-virtualenv"
run: |
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv
- name: "Install test dependencies"
run: |
python -m pip install --user --upgrade pip
python -m pip install --user .[test]
- name: "Run Pytest"
run: |
export VENV_MANAGEMENT_PREFERRED_DRIVERS=pyenv-virtualenv
export VENV_MANAGEMENT_INTERACTIVE_SHELL=yes
python -m pytest tests
test-with-pyenv-noninteractive:
name: "Pytest with pyenv virtualenv non-interactive"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout repo"
uses: actions/checkout@v2
- name: "Disable conda"
# Conda is installed by default on GitHub Actions and interferes with pyenv
# Sadly, pyenv-virtualenv doesn't work with conda anymore
# https://github.com/pyenv/pyenv-virtualenv/issues/270
# We crudely remove it by deleting the binary - this is sufficient to stop
# pyenv-virtualenv from trying to use it
run: |
sudo rm /usr/bin/conda
- name: "Install pyenv"
uses: "gabrielfalcao/pyenv-action@v16"
- name: "Configure pyenv-virtualenv"
run: |
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.venvwraprc
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.venvwraprc
echo 'eval "$(pyenv init -)"' >> ~/.venvwraprc
git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv
- name: "Install test dependencies"
run: |
python -m pip install --user --upgrade pip
python -m pip install --user .[test]
- name: "Run Pytest"
run: |
export VENV_MANAGEMENT_PREFERRED_DRIVERS=pyenv-virtualenv
export VENV_MANAGEMENT_SETUP_FILEPATH=${HOME}/.venvwraprc
python -m pytest tests
test-with-virtualenv-sh-interactive:
name: "Pytest with virtualenv-sh"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout repo"
uses: actions/checkout@v2
- name: "Set up Python"
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: "Install dependencies"
run: |
python -m pip install --user --upgrade pip
python -m pip install --user virtualenv
python -m pip install --user virtualenv-sh
echo '. ${HOME}/.local/bin/virtualenv-sh.bash' >> ${HOME}/.bashrc
echo 'WORKON_HOME=${HOME}/.virtualenvs' >> ${HOME}/.bashrc
pwd
ls
python -m pip install .[test]
- name: "Run Pytest"
run: |
export VENV_MANAGEMENT_PREFERRED_DRIVERS=virtualenv-sh
export VENV_MANAGEMENT_INTERACTIVE_SHELL=yes
python -m pytest tests
test-with-virtualenvwrapper-interactive:
name: "Pytest with virtualenvwrapper interactive"
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v2
- name: "Set up Python"
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: "Install dependencies"
run: |
python -m pip install --user --upgrade pip
python -m pip install --user virtualenvwrapper
echo '. ${HOME}/.local/bin/virtualenvwrapper.sh' >> ${HOME}/.bashrc
echo 'WORKON_HOME=${HOME}/.virtualenvs' >> ${HOME}/.bashrc
python -m pip install .[test]
- name: "Run Pytest"
run: |
export VENV_MANAGEMENT_PREFERRED_DRIVERS=virtualenvwrapper
export VENV_MANAGEMENT_INTERACTIVE_SHELL=yes
python -m pytest tests
test-with-virtualenvwrapper-and-venvwraprc-noninterative:
name: "Pytest with virtualenvwrapper and .venvwraprc"
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v2
- name: "Set up Python"
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: "Install dependencies"
run: |
python -m pip install --user --upgrade pip
python -m pip install --user virtualenvwrapper
echo "echo 'About to run ~/.local/bin/virtualenvwrapper.sh'" >> ${HOME}/.venvwraprc
echo '. ${HOME}/.local/bin/virtualenvwrapper.sh' >> ${HOME}/.venvwraprc
echo 'WORKON_HOME=${HOME}/.virtualenvs' >> ${HOME}/.venvwraprc
python -m pip install .[test]
- name: "Run Pytest"
run: |
export VENV_MANAGEMENT_PREFERRED_DRIVERS=virtualenvwrapper
export VENV_MANAGEMENT_SETUP_FILEPATH=${HOME}/.venvwraprc
python -m pytest tests
test-with-virtualenvwrapper-and-venvwraprc-interactive:
name: "Pytest with virtualenvwrapper and .venvwraprc interactive"
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v2
- name: "Set up Python"
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: "Install dependencies"
run: |
python -m pip install --user --upgrade pip
python -m pip install --user virtualenvwrapper
echo "echo 'About to run ~/.local/bin/virtualenvwrapper.sh'" >> ${HOME}/.venvwraprc
echo '. ${HOME}/.local/bin/virtualenvwrapper.sh' >> ${HOME}/.venvwraprc
echo 'WORKON_HOME=${HOME}/.virtualenvs' >> ${HOME}/.venvwraprc
python -m pip install .[test]
- name: "Run Pytest"
run: |
export VENV_MANAGEMENT_PREFERRED_DRIVERS=virtualenvwrapper
export VENV_MANAGEMENT_INTERACTIVE_SHELL=yes
export VENV_MANAGEMENT_SETUP_FILEPATH=${HOME}/.venvwraprc
python -m pytest tests
test-with-venv:
name: "Pytest with venv"
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v2
- name: "Set up Python"
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: "Install dependencies"
run: |
python -m pip install --user --upgrade pip
python -m pip install .[test]
- name: "Run Pytest"
run: |
export WORKON_HOME=${HOME}/.virtualenvs
export VENV_MANAGEMENT_PREFERRED_DRIVERS=venv
python -m pytest tests
package:
name: "Build Package Distributions"
needs:
- test-with-pyenv-interactive
- test-with-pyenv-noninteractive
- test-with-virtualenv-sh-interactive
- test-with-virtualenvwrapper-interactive
- test-with-virtualenvwrapper-and-venvwraprc-noninterative
- test-with-virtualenvwrapper-and-venvwraprc-interactive
- test-with-venv
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v2"
with:
python-version: "3.9"
- name: "Build distribution"
run: |
python -m pip install --upgrade pip
python -m pip install build
python -m build
- name: "Check wheel contents"
run: |
python -m pip install check-wheel-contents
check-wheel-contents dist/*.whl
- name: "Check long description is renderable"
run: |
python -m pip install twine
python -m twine check dist/*
- name: Publish package
if: startsWith(github.ref, 'refs/tags/release/v')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}