-
Notifications
You must be signed in to change notification settings - Fork 30
217 lines (183 loc) Β· 5.88 KB
/
publish-to-pypi.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
name: PyPI
on:
push:
pull_request:
workflow_dispatch:
jobs:
Source:
runs-on: ubuntu-20.04
name: Source
steps:
- name: π§° Checkout
uses: actions/checkout@v2
with:
# Always clone the full depth so git-describe works.
fetch-depth: 0
submodules: true
- name: Install dependencies (Ubuntu)
run: |
sudo apt-get update
sudo apt-get install -y cmake default-jre-headless uuid-dev libantlr4-runtime-dev
- name: π Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Install build dependencies
run: |
python -m pip install -U pip
python -m pip install -r requirements.txt
python update_version.py
- name: Install package dependencies
run: |
python setup.py install
- name: π§ Build distribution π¦
run: |
python setup.py sdist
- name: Check distribution π¦
run: |
twine check dist/*
- name: π€ Publish source to Test PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TEST_PASSWORD }}
if: env.TWINE_PASSWORD != null
run: |
twine upload --skip-existing --verbose --repository testpypi dist/*.tar.gz
- name: π€ Publish source to PyPI
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && github.repository == 'chipsalliance/fasm'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload dist/*
Linux:
strategy:
matrix:
include:
- { name: '3.6', python-version: 'cp36-cp36m' }
- { name: '3.7', python-version: 'cp37-cp37m' }
- { name: '3.8', python-version: 'cp38-cp38' }
- { name: '3.9', python-version: 'cp39-cp39' }
fail-fast: false
name: '${{ matrix.name }} β’ manylinux'
runs-on: ubuntu-latest
steps:
- name: π§° Checkout
uses: actions/checkout@v2
with:
# Always clone the full depth so git-describe works.
fetch-depth: 0
submodules: true
- name: π Set up Python
uses: actions/setup-python@v2
- name: Install build dependencies
run: |
python -m pip install -U pip
python -m pip install twine auditwheel
python update_version.py
- name: π§ Build distribution π¦
uses: RalfG/[email protected]_x86_64
with:
build-requirements: 'cython'
pre-build-command: 'bash .github/workflows/manylinux-install-cmake.sh'
python-versions: ${{ matrix.python-version }}
#pip-wheel-args: '-w ./dist --no-deps --verbose'
- name: List distribution π¦
run: |
# Fix permissions
echo "::group::Fixing permission"
ls -l dist/*
echo $USER
whoami
sudo chown -R $USER dist
ls -l dist/*
echo "::endgroup::"
# Remove the non-manylinux versions
rm -v dist/*linux_x86_64*.whl
ls -l dist/*
- name: Check distribution π¦
run: |
for WHEEL in dist/*.whl; do
echo
echo "::group::Checking $WHEEL"
echo
python -m zipfile --list $WHEEL
echo
auditwheel show $WHEEL
echo
twine check $WHEEL
echo
echo "::endgroup::"
done
- name: π€ Publish wheels to Test PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TEST_PASSWORD }}
if: env.TWINE_PASSWORD != null
run: |
twine upload --skip-existing --verbose --repository testpypi dist/*.whl
- name: π€ Publish wheels to PyPI
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && github.repository == 'chipsalliance/fasm'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload dist/*.whl
MacAndWindows:
strategy:
matrix:
os: [windows-latest, macos-latest]
python-version: [ '3.6', '3.7', '3.8', '3.9', 'pypy-3.6', 'pypy-3.7' ]
fail-fast: false
name: ${{ matrix.python-version }} β’ ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- name: π§° Checkout
uses: actions/checkout@v2
with:
# Always clone the full depth so git-describe works.
fetch-depth: 0
submodules: true
- name: Install dependencies (Mac OS X)
if: startsWith(matrix.os, 'macos')
run: |
true
- name: Install dependencies (Windows)
if: startsWith(matrix.os, 'windows')
run: |
true
- name: π Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install build dependencies
run: |
python -m pip install -U pip
python -m pip install -r requirements.txt
python update_version.py
- name: Install package dependencies
run: |
python setup.py install
- name: π§ Build distribution π¦
run: |
python setup.py bdist_wheel
- name: Check distribution π¦
shell: bash
run: |
python -m zipfile -l dist/*
echo
twine check dist/*
- name: π€ Publish wheels to Test PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TEST_PASSWORD }}
if: env.TWINE_PASSWORD != null
run: |
twine upload --skip-existing --verbose --repository testpypi dist/*.whl
- name: π€ Publish wheels to PyPI
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && github.repository == 'chipsalliance/fasm'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload dist/*.whl