Skip to content

Commit

Permalink
Modernizing: Restoring CI, Moving to pytest (#136)
Browse files Browse the repository at this point in the history
closes #120
closes #122
closes #124
closes #129
closes #130
closes #121
closes #118
  • Loading branch information
chayim committed Dec 12, 2022
1 parent b042bd9 commit 861539c
Show file tree
Hide file tree
Showing 18 changed files with 570 additions and 557 deletions.
12 changes: 8 additions & 4 deletions .github/release-drafter-config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name-template: 'Version $NEXT_PATCH_VERSION'
tag-template: 'v$NEXT_PATCH_VERSION'
name-template: '$NEXT_MINOR_VERSION'
tag-template: 'v$NEXT_MINOR_VERSION'
autolabeler:
- label: 'maintenance'
files:
Expand All @@ -15,9 +15,12 @@ autolabeler:
branch:
- '/feature-.+'
categories:
- title: '🔥 Breaking Changes'
- title: 'Breaking Changes'
labels:
- 'breakingchange'
- title: '🧪 Experimental Features'
labels:
- 'experimental'
- title: '🚀 New Features'
labels:
- 'feature'
Expand All @@ -27,13 +30,14 @@ categories:
- 'fix'
- 'bugfix'
- 'bug'
- 'BUG'
- title: '🧰 Maintenance'
label: 'maintenance'
change-template: '- $TITLE (#$NUMBER)'
exclude-labels:
- 'skip-changelog'
template: |
## Changes
# Changes
$CHANGES
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/installtest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

set -e

SUFFIX=$1
if [ -z ${SUFFIX} ]; then
echo "Supply valid python package extension such as whl or tar.gz. Exiting."
exit 3
fi

script=`pwd`/${BASH_SOURCE[0]}
HERE=`dirname ${script}`
ROOT=`realpath ${HERE}/../..`

cd ${ROOT}
DESTENV=${ROOT}/.venvforinstall
if [ -d ${DESTENV} ]; then
rm -rf ${DESTENV}
fi
python -m venv ${DESTENV}
source ${DESTENV}/bin/activate
pip install --upgrade --quiet pip
pip install --quiet -r dev_requirements.txt
python setup.py sdist bdist_wheel

PKG=`ls ${ROOT}/dist/*.${SUFFIX}`
ls -l ${PKG}

# install, run tests
pip install ${PKG}
51 changes: 51 additions & 0 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CI

on:
push:
paths-ignore:
- 'docs/**'
- '**/*.rst'
- '**/*.md'
branches:
- master
- '[0-9].[0-9]'
pull_request:
branches:
- master
- '[0-9].[0-9]'

permissions:
contents: read # to fetch code (actions/checkout)

jobs:

run-tests:
runs-on: ${{matrix.os}}
timeout-minutes: 30
strategy:
max-parallel: 15
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', 'pypy-3.7', 'pypy-3.8']
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
fail-fast: false
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
name: Python ${{ matrix.python-version }} ${{matrix.os}}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: dev_requirements.txt
- name: run tests
run: |
pip install -U pip setuptools wheel
pip install -r dev_requirements.txt
python setup.py build_ext --inplace
pytest
- name: build and install the wheel
run: |
python setup.py bdist_wheel
78 changes: 78 additions & 0 deletions .github/workflows/pypi-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Publish tag to Pypi

on:
release:
types: [published]

permissions:
contents: read # to fetch code (actions/checkout)

jobs:

build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, windows-2019, macos-10.15]
env:
CIBW_ARCHS_MACOS: "x86_64 universal2 arm64"
MACOSX_DEPLOYMENT_TARGET: "10.12"
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v2
with:
platforms: all

- name: Build wheels
uses: pypa/[email protected]
env:
# configure cibuildwheel to build native archs ('auto'), and some
# emulated ones
CIBW_ARCHS_LINUX: auto aarch64 ppc64le s390x

- uses: actions/upload-artifact@v3
with:
name: ${{matrix.os}}-wheels
path: ./wheelhouse/*.whl

publish:
name: Pypi publish
needs: ['build_wheels']
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install tools
run: |
pip install twine wheel
- uses: actions/download-artifact@v3
with:
name: ubuntu-20.04-wheels
path: artifacts/linux
- uses: actions/download-artifact@v3
with:
name: windows-2019-wheels
path: artifacts/windows
- uses: actions/download-artifact@v3
with:
name: macos-10.15-wheels
path: artifacts/macos
- name: unify wheel structure
run: |
mkdir dist
cp -R artifacts/windows/* dist
cp -R artifacts/linux/* dist
cp -R artifacts/macos/* dist
- name: Publish to Pypi
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
4 changes: 4 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:

jobs:
update_release_draft:
permissions:
pull-requests: write # to add label to PR (release-drafter/release-drafter)
contents: write # to create a github release (release-drafter/release-drafter)

runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
/build
/dist
MANIFEST
.venv
**/*.so
102 changes: 0 additions & 102 deletions .travis.yml

This file was deleted.

19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# hiredis-py

[![Build Status](https://travis-ci.org/redis/hiredis-py.svg?branch=master)](https://travis-ci.org/redis/hiredis-py)
[![Windows Build Status](https://ci.appveyor.com/api/projects/status/muso9gbe316tjsac/branch/master?svg=true)](https://ci.appveyor.com/project/duyue/hiredis-py/)
[![Build Status](https://github.com/redis/hiredis-py/actions/workflows/integration.yaml/badge.svg)](https://github.com/redis/hiredis-py/actions/workflows/integration.yaml)
[![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)

Python extension that wraps protocol parsing code in [hiredis][hiredis].
Expand All @@ -11,16 +10,24 @@ It primarily speeds up parsing of multi bulk replies.

## Install

hiredis-py is available on [PyPI](https://pypi.org/project/hiredis/), and can
be installed with:
hiredis-py is available on [PyPI](https://pypi.org/project/hiredis/), and can be installed via:

```
```bash
pip install hiredis
```
## Building and Testing

Building this repository requires a recursive checkout of submodules, and building hiredis. The following example shows how to clone, compile, and run tests. Please note - you will need the gcc installed.

```bash
git clone --recursse-submodules https://github.com/redis/hiredis-py
python setup.py build_ext --inplace
pytest
```

### Requirements

hiredis-py requires **Python 3.6+**.
hiredis-py requires **Python 3.7+**.

Make sure Python development headers are available when installing hiredis-py.
On Ubuntu/Debian systems, install them with `apt-get install python3-dev`.
Expand Down
Loading

0 comments on commit 861539c

Please sign in to comment.