Skip to content

Commit 4563f57

Browse files
committed
Update to latest CI.yml
1 parent d1faab7 commit 4563f57

File tree

1 file changed

+99
-8
lines changed

1 file changed

+99
-8
lines changed

.github/workflows/ci.yml

Lines changed: 99 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
branches:
77
- develop
88
- main
9+
tags:
10+
- "*"
911

1012

1113
jobs:
@@ -42,6 +44,54 @@ jobs:
4244
run: tox -e docs
4345
env:
4446
PYTHON_ISAL_LINK_DYNAMIC: True
47+
mypy:
48+
needs: lint
49+
runs-on: ubuntu-20.04
50+
steps:
51+
- uses: actions/[email protected]
52+
with:
53+
submodules: recursive
54+
- name: Set up Python 3.6
55+
uses: actions/[email protected]
56+
with:
57+
python-version: 3.6
58+
- name: Install isal
59+
run: sudo apt-get install libisal-dev
60+
- name: Install tox and upgrade setuptools and pip
61+
run: pip install --upgrade tox setuptools pip
62+
- name: Mypy checks
63+
run: tox -e mypy
64+
env:
65+
PYTHON_ISAL_LINK_DYNAMIC: True
66+
twine_check:
67+
needs: lint
68+
runs-on: ${{ matrix.os }}
69+
strategy:
70+
matrix:
71+
python-version:
72+
- 3.6
73+
os: ["ubuntu-latest" ]
74+
steps:
75+
- uses: actions/[email protected]
76+
with:
77+
submodules: recursive
78+
- name: Set up Python ${{ matrix.python-version }}
79+
uses: actions/[email protected]
80+
with:
81+
python-version: ${{ matrix.python-version }}
82+
- name: Install build dependencies (Linux) # Yasm in pypa/manylinux images.
83+
run: sudo apt install yasm
84+
if: runner.os == 'Linux'
85+
- name: Install build dependencies (Macos)
86+
run: brew install yasm automake autoconf
87+
if: runner.os == 'macOS'
88+
- name: Install twine, cython wheel and upgrade setuptools
89+
run: pip install --upgrade twine cython wheel setuptools
90+
- name: create dists
91+
run: python setup.py sdist bdist_wheel
92+
- name: check dists
93+
run: twine check dist/*
94+
4595
test-static:
4696
needs: lint
4797
runs-on: ${{ matrix.os }}
@@ -52,7 +102,10 @@ jobs:
52102
- 3.7
53103
- 3.8
54104
- 3.9
55-
os: ["macos-latest", "ubuntu-latest", "windows-latest"]
105+
os: ["ubuntu-latest"]
106+
include:
107+
- os: "macos-latest"
108+
python-version: 3.8
56109
steps:
57110
- uses: actions/[email protected]
58111
with:
@@ -69,9 +122,6 @@ jobs:
69122
- name: Install build dependencies (Macos)
70123
run: brew install yasm automake autoconf
71124
if: runner.os == 'macOS'
72-
- name: Install build dependencies (Windows)
73-
run: choco install yasm visualstudio2019-workload-universalbuildtools
74-
if: runner.os == 'Windows'
75125
- name: Run tests
76126
run: tox -e py3
77127
- name: Upload coverage report
@@ -84,9 +134,6 @@ jobs:
84134
matrix:
85135
python-version:
86136
- 3.6
87-
- 3.7
88-
- 3.8
89-
- 3.9
90137
os: ["ubuntu-20.04"]
91138
steps:
92139
- uses: actions/[email protected]
@@ -100,8 +147,52 @@ jobs:
100147
run: sudo apt-get install libisal-dev
101148
- name: Install tox and upgrade setuptools and pip
102149
run: pip install --upgrade tox setuptools pip
103-
104150
- name: Run tests (dynamic link)
105151
run: tox -e py3
106152
env:
107153
PYTHON_ISAL_LINK_DYNAMIC: True
154+
155+
deploy:
156+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
157+
runs-on: ${{ matrix.os }}
158+
needs: [lint, docs, test-static, test-dynamic, twine_check]
159+
strategy:
160+
matrix:
161+
os: [ "macos-latest", "ubuntu-latest" ]
162+
steps:
163+
- uses: actions/[email protected]
164+
with:
165+
submodules: recursive
166+
- uses: actions/setup-python@v2
167+
name: Install Python
168+
- name: Install cibuildwheel twine
169+
run: python -m pip install cibuildwheel twine
170+
- name: Install build dependencies (Macos)
171+
run: brew install yasm automake autoconf
172+
if: runner.os == 'macOS'
173+
- name: Build wheels
174+
run: cibuildwheel --output-dir dist
175+
env:
176+
CIBW_BUILD: "cp3{6,7,8,9}-*"
177+
CIBW_SKIP: "*-win32 *-manylinux_i686" # Skip 32 bit.
178+
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014"
179+
# Below command fails when data is not correctly statically linked
180+
# Full tests not needed: these are done prior to building.
181+
CIBW_TEST_COMMAND: "python -c 'from isal import isal_zlib, igzip; isal_zlib.adler32(b\"bla\")'"
182+
- name: Build sdist
183+
if: "runner.os == 'Linux'"
184+
run: python setup.py sdist
185+
- name: Publish package to TestPyPI
186+
# pypa/gh-action-pypi-publish@master does not work on OSX
187+
# Alpha, Beta and dev releases contain a - in the tag.
188+
if: contains(github.ref, '-') && startsWith(github.ref, 'refs/tags')
189+
run: twine upload --repository-url https://test.pypi.org/legacy/ dist/*
190+
env:
191+
TWINE_USERNAME: __token__
192+
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
193+
- name: Publish package to PyPI
194+
if: "!contains(github.ref, '-') && startsWith(github.ref, 'refs/tags')"
195+
run: twine upload dist/*
196+
env:
197+
TWINE_USERNAME: __token__
198+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)