Skip to content

Commit

Permalink
Try out GitHub Actions as Travis alternative (#635)
Browse files Browse the repository at this point in the history
* Try out GitHub Actions as Travis alternative

* Add apt requirements

* Only do 1 python on sanity`

* Use develop version of krb...

* For now go with python 3.7

* Try out all platforms

* Try out separate run for windows

* Check windows functions

* Fix snappy wlh

* Fix cache

* Windows expects windows container, not linux ones. Not sure how to run linux containers on windows-latest runner yet

* Try to add macosx tests

* Return gssapi and ability to run tests without C extensions too

* Use declarative environment and run all tests on MacOS

* Macos runner does not seem to have docker installed at all, a shame.
Running only unit tests for now

* Try out linux full run

* Fix linux tests and provide proper cache dir for PIP

* Try full matrix

* Enlarge timeout for GithubActions

* Make matrix not fail-fast

* Add upload to codecov

* Make sure we generate XML coverage

* For now disable travis.yaml

* Try to cat files to understand why coverage lines don't match

* Try to checkout head for windows build

* Apply HEAD checkout to linux and mac builds to make sure coverage is consistently generated

* Temporary set build trigger to push, not PR to check if builds on direct master branch would work

* Return master PR build instead of push

* Add asyncio debug for windows and mac cases to debug any KQueue or Proreactor issues

* Install package on Publish correctly. Bump version to 0.6.1.dev0 for deploy testing

* Try out multi-linux wheel builds

* Add requirements-cython.txt to git

* Change test command for wheel build

* Add another event to build action for faster debugging

* Add pytest installation to CIWheel build

* Raise verbosity for build

* Add zlib dependancy

* Try to use Windows compliant command

* Debug import error for wheel

* More debug

* Print lib address

* Add pwd to test command

* Try using `pytest` instead of `python -m`

* Try to use `--import-mode=importlib` to avoid import problems

* `importlib` mode not released yet, try prepend

* Try to delete __init__py in tests

* Try to use proper makefile with tests

* Return __init__.py and try another method

* Invalid env variable

* Try without tests, as it causes some problems to properly run them using cibuildwheel

* Try to add unit tests run after wheel build

* Try to fix test errors for wheels

* Try again to fix wheel tests

* Cleanup Publish workflow debug changes

* Try to force color output to github actions
  • Loading branch information
tvoinarovskyi authored Jun 22, 2020
1 parent a54ba3f commit ccbd39e
Show file tree
Hide file tree
Showing 11 changed files with 528 additions and 12 deletions.
199 changes: 199 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Publish

on:
release:
types: [created]

jobs:
package-source:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Prepare C files to include
run: |
python -m pip install --upgrade pip setuptools
python -m pip install -r requirements-cython.txt
# Make sure we install to have all c files to be shiped with bundle
python -m pip install -vv -Ue . # We set -vv to see compiler exceptions/warnings
- name: Build source package
run: python setup.py sdist
- name: Upload source package
uses: actions/upload-artifact@v2
with:
name: dist
path: dist/

package-wheel:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Build wheels
env:
CIBW_BEFORE_BUILD_LINUX: pip install -r requirements-cython.txt && yum install -y zlib-devel
# On windows and mac we should have z library preinstalled
CIBW_BEFORE_BUILD: pip install -r requirements-cython.txt
CIBW_BUILD_VERBOSITY: 2
CIBW_SKIP: cp27-* cp35-* pp27-*
run: |
python -m pip install --upgrade pip setuptools
pip install cibuildwheel
cibuildwheel --output-dir dist
shell: bash
- name: Upload wheels
uses: actions/upload-artifact@v2
with:
name: dist
path: dist/

test-wheels-windows:
needs: [package-source, package-wheel]
runs-on: windows-latest

strategy:
matrix:
python: [3.6, 3.7]
include:
- python: 3.6
snappy_whl: tools/python_snappy-0.5.4-cp36-cp36m-win_amd64.whl
aiokafka_whl: dist/aiokafka-*-cp36-cp36m-win_amd64.whl
- python: 3.7
snappy_whl: tools/python_snappy-0.5.4-cp37-cp37m-win_amd64.whl
aiokafka_whl: dist/aiokafka-*-cp37-cp37m-win_amd64.whl

steps:
- uses: actions/checkout@v2
- name: Download distributions
uses: actions/download-artifact@v2
with:
name: dist
path: dist/
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}

- name: Install python dependencies
run: |
pip install --upgrade pip setuptools wheel
pip install ${{ matrix.snappy_whl }}
pip install -r requirements-win-test.txt
pip install ${{ matrix.aiokafka_whl }}
shell: bash

- name: Run Unit Tests
run: |
# Remove source code to be sure we use wheel code
rm -rf aiokafka
make ci-test-unit
shell: bash

test-wheels-mac:
needs: [package-source, package-wheel]
runs-on: macos-latest

strategy:
matrix:
python: [3.6, 3.7]
include:
- python: 3.6
aiokafka_whl: dist/aiokafka-*-cp36-cp36m-macosx_10_9_x86_64.whl
- python: 3.7
aiokafka_whl: dist/aiokafka-*-cp37-cp37m-macosx_10_9_x86_64.whl

steps:
- uses: actions/checkout@v2
- name: Download distributions
uses: actions/download-artifact@v2
with:
name: dist
path: dist/
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}

- name: Install system dependencies
run: |
brew install snappy
- name: Install python dependencies
run: |
pip install --upgrade pip setuptools wheel
pip install -r requirements-ci.txt
pip install ${{ matrix.aiokafka_whl }}
- name: Run Unit Tests
run: |
# Remove source code to be sure we use wheel code
rm -rf aiokafka
make ci-test-unit
test-wheels-linux:
needs: [package-source, package-wheel]
runs-on: ubuntu-latest

strategy:
matrix:
python: [3.6, 3.7]
include:
- python: 3.6
aiokafka_whl: dist/aiokafka-*-cp36-cp36m-manylinux1_x86_64.whl
- python: 3.7
aiokafka_whl: dist/aiokafka-*-cp37-cp37m-manylinux1_x86_64.whl

steps:
- uses: actions/checkout@v2
- name: Download distributions
uses: actions/download-artifact@v2
with:
name: dist
path: dist/
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}

- name: Install system dependencies
run: |
sudo apt-get install -y libsnappy-dev libkrb5-dev
- name: Install python dependencies
run: |
pip install --upgrade pip setuptools wheel
pip install -r requirements-ci.txt
pip install ${{ matrix.aiokafka_whl }}
- name: Run Unit Tests
run: |
# Remove source code to be sure we use wheel code
rm -rf aiokafka
make ci-test-unit
deploy:

runs-on: ubuntu-latest
needs: [test-wheels-linux, test-wheels-mac, test-wheels-windows]

steps:
- uses: actions/checkout@v2
- name: Download distributions
uses: actions/download-artifact@v2
with:
name: dist
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: ${{ secrets.PYPI_USERNAME }}
password: ${{ secrets.PYPI_PASSWORD }}
Loading

0 comments on commit ccbd39e

Please sign in to comment.