6
6
branches :
7
7
- develop
8
8
- main
9
+ tags :
10
+ - " *"
9
11
10
12
11
13
jobs :
@@ -42,19 +44,78 @@ jobs:
42
44
run : tox -e docs
43
45
env :
44
46
PYTHON_ISAL_LINK_DYNAMIC : True
45
- test :
46
- runs-on : ubuntu-20.04
47
+ twine_check :
48
+ needs : lint
49
+ runs-on : ${{ matrix.os }}
50
+ strategy :
51
+ matrix :
52
+ python-version :
53
+ - 3.6
54
+ os : ["ubuntu-latest" ]
55
+ steps :
56
+
57
+ with :
58
+ submodules : recursive
59
+ - name : Set up Python ${{ matrix.python-version }}
60
+
61
+ with :
62
+ python-version : ${{ matrix.python-version }}
63
+ - name : Install build dependencies (Linux) # Yasm in pypa/manylinux images.
64
+ run : sudo apt install yasm
65
+ if : runner.os == 'Linux'
66
+ - name : Install build dependencies (Macos)
67
+ run : brew install yasm automake autoconf
68
+ if : runner.os == 'macOS'
69
+ - name : Install twine, cython wheel and upgrade setuptools
70
+ run : pip install --upgrade twine cython wheel setuptools
71
+ - name : create dists
72
+ run : python setup.py sdist bdist_wheel
73
+ - name : check dists
74
+ run : twine check dist/*
75
+
76
+ test-static :
77
+ needs : lint
78
+ runs-on : ${{ matrix.os }}
47
79
strategy :
48
80
matrix :
49
81
python-version :
50
82
- 3.6
51
83
- 3.7
52
84
- 3.8
53
85
- 3.9
54
- linking_method :
55
- - static
56
- - dynamic
86
+ os : ["ubuntu-latest"]
87
+ include :
88
+ - os : " macos-latest"
89
+ python-version : 3.8
90
+ steps :
91
+
92
+ with :
93
+ submodules : recursive
94
+ - name : Set up Python ${{ matrix.python-version }}
95
+
96
+ with :
97
+ python-version : ${{ matrix.python-version }}
98
+ - name : Install tox and upgrade setuptools
99
+ run : pip install --upgrade tox setuptools
100
+ - name : Install build dependencies (Linux) # Yasm in pypa/manylinux images.
101
+ run : sudo apt install yasm
102
+ if : runner.os == 'Linux'
103
+ - name : Install build dependencies (Macos)
104
+ run : brew install yasm automake autoconf
105
+ if : runner.os == 'macOS'
106
+ - name : Run tests
107
+ run : tox -e py3
108
+ - name : Upload coverage report
109
+ uses : codecov/codecov-action@v1
110
+
111
+ test-dynamic :
112
+ runs-on : ${{ matrix.os }}
57
113
needs : lint
114
+ strategy :
115
+ matrix :
116
+ python-version :
117
+ - 3.6
118
+ os : ["ubuntu-20.04"]
58
119
steps :
59
120
60
121
with :
@@ -63,22 +124,56 @@ jobs:
63
124
64
125
with :
65
126
python-version : ${{ matrix.python-version }}
66
- - name : Install tox and upgrade setuptools and pip
67
- run : pip install --upgrade tox setuptools pip
68
127
- name : Install isal
69
- if : ${{ matrix.linking_method == 'dynamic' }}
70
128
run : sudo apt-get install libisal-dev
71
- - name : Install yasm # Yasm in pypa/manylinux images.
72
- run : sudo apt install yasm
73
- if : ${{ matrix.linking_method == 'static' }}
129
+ - name : Install tox and upgrade setuptools and pip
130
+ run : pip install --upgrade tox setuptools pip
74
131
- name : Run tests (dynamic link)
75
132
run : tox -e py3
76
133
env :
77
134
PYTHON_ISAL_LINK_DYNAMIC : True
78
- if : ${{ matrix.linking_method == 'dynamic' }}
79
- - name : Run tests (dynamic link)
80
- run : tox -e py3
81
- if : ${{ matrix.linking_method == 'static' }}
82
- - name : Upload coverage report
83
- if : ${{ matrix.python-version == 3.6 && matrix.linking_method == 'static'}} # Only upload coverage once
84
- uses : codecov/codecov-action@v1
135
+
136
+ deploy :
137
+ if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
138
+ runs-on : ${{ matrix.os }}
139
+ needs : [lint, docs, test-static, test-dynamic, twine_check]
140
+ strategy :
141
+ matrix :
142
+ os : [ "macos-latest", "ubuntu-latest" ]
143
+ steps :
144
+
145
+ with :
146
+ submodules : recursive
147
+ - uses : actions/setup-python@v2
148
+ name : Install Python
149
+ - name : Install cibuildwheel twine
150
+ run : python -m pip install cibuildwheel twine
151
+ - name : Install build dependencies (Macos)
152
+ run : brew install yasm automake autoconf
153
+ if : runner.os == 'macOS'
154
+ - name : Build wheels
155
+ run : cibuildwheel --output-dir dist
156
+ env :
157
+ CIBW_BUILD : " cp3{6,7,8,9}-*"
158
+ CIBW_SKIP : " *-win32 *-manylinux_i686" # Skip 32 bit.
159
+ CIBW_MANYLINUX_X86_64_IMAGE : " manylinux2014"
160
+ # Below command fails when data is not correctly statically linked
161
+ # Full tests not needed: these are done prior to building.
162
+ CIBW_TEST_COMMAND : " python -c 'from isal import isal_zlib, igzip; isal_zlib.adler32(b\" bla\" )'"
163
+ - name : Build sdist
164
+ if : " runner.os == 'Linux'"
165
+ run : python setup.py sdist
166
+ - name : Publish package to TestPyPI
167
+ # pypa/gh-action-pypi-publish@master does not work on OSX
168
+ # Alpha, Beta and dev releases contain a - in the tag.
169
+ if : contains(github.ref, '-') && startsWith(github.ref, 'refs/tags')
170
+ run : twine upload --repository-url https://test.pypi.org/legacy/ dist/*
171
+ env :
172
+ TWINE_USERNAME : __token__
173
+ TWINE_PASSWORD : ${{ secrets.TEST_PYPI_API_TOKEN }}
174
+ - name : Publish package to PyPI
175
+ if : " !contains(github.ref, '-') && startsWith(github.ref, 'refs/tags')"
176
+ run : twine upload dist/*
177
+ env :
178
+ TWINE_USERNAME : __token__
179
+ TWINE_PASSWORD : ${{ secrets.PYPI_API_TOKEN }}
0 commit comments