Skip to content

Commit 861539c

Browse files
authored
Modernizing: Restoring CI, Moving to pytest (#136)
closes #120 closes #122 closes #124 closes #129 closes #130 closes #121 closes #118
1 parent b042bd9 commit 861539c

18 files changed

+570
-557
lines changed

.github/release-drafter-config.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
name-template: 'Version $NEXT_PATCH_VERSION'
2-
tag-template: 'v$NEXT_PATCH_VERSION'
1+
name-template: '$NEXT_MINOR_VERSION'
2+
tag-template: 'v$NEXT_MINOR_VERSION'
33
autolabeler:
44
- label: 'maintenance'
55
files:
@@ -15,9 +15,12 @@ autolabeler:
1515
branch:
1616
- '/feature-.+'
1717
categories:
18-
- title: '🔥 Breaking Changes'
18+
- title: 'Breaking Changes'
1919
labels:
2020
- 'breakingchange'
21+
- title: '🧪 Experimental Features'
22+
labels:
23+
- 'experimental'
2124
- title: '🚀 New Features'
2225
labels:
2326
- 'feature'
@@ -27,13 +30,14 @@ categories:
2730
- 'fix'
2831
- 'bugfix'
2932
- 'bug'
33+
- 'BUG'
3034
- title: '🧰 Maintenance'
3135
label: 'maintenance'
3236
change-template: '- $TITLE (#$NUMBER)'
3337
exclude-labels:
3438
- 'skip-changelog'
3539
template: |
36-
## Changes
40+
# Changes
3741
3842
$CHANGES
3943

.github/workflows/installtest.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
SUFFIX=$1
6+
if [ -z ${SUFFIX} ]; then
7+
echo "Supply valid python package extension such as whl or tar.gz. Exiting."
8+
exit 3
9+
fi
10+
11+
script=`pwd`/${BASH_SOURCE[0]}
12+
HERE=`dirname ${script}`
13+
ROOT=`realpath ${HERE}/../..`
14+
15+
cd ${ROOT}
16+
DESTENV=${ROOT}/.venvforinstall
17+
if [ -d ${DESTENV} ]; then
18+
rm -rf ${DESTENV}
19+
fi
20+
python -m venv ${DESTENV}
21+
source ${DESTENV}/bin/activate
22+
pip install --upgrade --quiet pip
23+
pip install --quiet -r dev_requirements.txt
24+
python setup.py sdist bdist_wheel
25+
26+
PKG=`ls ${ROOT}/dist/*.${SUFFIX}`
27+
ls -l ${PKG}
28+
29+
# install, run tests
30+
pip install ${PKG}

.github/workflows/integration.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- 'docs/**'
7+
- '**/*.rst'
8+
- '**/*.md'
9+
branches:
10+
- master
11+
- '[0-9].[0-9]'
12+
pull_request:
13+
branches:
14+
- master
15+
- '[0-9].[0-9]'
16+
17+
permissions:
18+
contents: read # to fetch code (actions/checkout)
19+
20+
jobs:
21+
22+
run-tests:
23+
runs-on: ${{matrix.os}}
24+
timeout-minutes: 30
25+
strategy:
26+
max-parallel: 15
27+
matrix:
28+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', 'pypy-3.7', 'pypy-3.8']
29+
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
30+
fail-fast: false
31+
env:
32+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
33+
name: Python ${{ matrix.python-version }} ${{matrix.os}}
34+
steps:
35+
- uses: actions/checkout@v3
36+
with:
37+
submodules: recursive
38+
- uses: actions/setup-python@v4
39+
with:
40+
python-version: ${{ matrix.python-version }}
41+
cache: 'pip'
42+
cache-dependency-path: dev_requirements.txt
43+
- name: run tests
44+
run: |
45+
pip install -U pip setuptools wheel
46+
pip install -r dev_requirements.txt
47+
python setup.py build_ext --inplace
48+
pytest
49+
- name: build and install the wheel
50+
run: |
51+
python setup.py bdist_wheel

.github/workflows/pypi-publish.yaml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Publish tag to Pypi
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: read # to fetch code (actions/checkout)
9+
10+
jobs:
11+
12+
build_wheels:
13+
name: Build wheels on ${{ matrix.os }}
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
os: [ubuntu-20.04, windows-2019, macos-10.15]
18+
env:
19+
CIBW_ARCHS_MACOS: "x86_64 universal2 arm64"
20+
MACOSX_DEPLOYMENT_TARGET: "10.12"
21+
steps:
22+
- uses: actions/checkout@v3
23+
with:
24+
submodules: recursive
25+
26+
- name: Set up QEMU
27+
if: runner.os == 'Linux'
28+
uses: docker/setup-qemu-action@v2
29+
with:
30+
platforms: all
31+
32+
- name: Build wheels
33+
uses: pypa/[email protected]
34+
env:
35+
# configure cibuildwheel to build native archs ('auto'), and some
36+
# emulated ones
37+
CIBW_ARCHS_LINUX: auto aarch64 ppc64le s390x
38+
39+
- uses: actions/upload-artifact@v3
40+
with:
41+
name: ${{matrix.os}}-wheels
42+
path: ./wheelhouse/*.whl
43+
44+
publish:
45+
name: Pypi publish
46+
needs: ['build_wheels']
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/setup-python@v4
50+
with:
51+
python-version: 3.9
52+
- name: Install tools
53+
run: |
54+
pip install twine wheel
55+
- uses: actions/download-artifact@v3
56+
with:
57+
name: ubuntu-20.04-wheels
58+
path: artifacts/linux
59+
- uses: actions/download-artifact@v3
60+
with:
61+
name: windows-2019-wheels
62+
path: artifacts/windows
63+
- uses: actions/download-artifact@v3
64+
with:
65+
name: macos-10.15-wheels
66+
path: artifacts/macos
67+
- name: unify wheel structure
68+
run: |
69+
mkdir dist
70+
cp -R artifacts/windows/* dist
71+
cp -R artifacts/linux/* dist
72+
cp -R artifacts/macos/* dist
73+
74+
- name: Publish to Pypi
75+
uses: pypa/gh-action-pypi-publish@release/v1
76+
with:
77+
user: __token__
78+
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/release-drafter.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88

99
jobs:
1010
update_release_draft:
11+
permissions:
12+
pull-requests: write # to add label to PR (release-drafter/release-drafter)
13+
contents: write # to create a github release (release-drafter/release-drafter)
14+
1115
runs-on: ubuntu-latest
1216
steps:
1317
# Drafts your next Release notes as Pull Requests are merged into "master"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
/build
33
/dist
44
MANIFEST
5+
.venv
6+
**/*.so

.travis.yml

Lines changed: 0 additions & 102 deletions
This file was deleted.

README.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# hiredis-py
22

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

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

1211
## Install
1312

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

17-
```
15+
```bash
1816
pip install hiredis
1917
```
18+
## Building and Testing
19+
20+
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.
21+
22+
```bash
23+
git clone --recursse-submodules https://github.com/redis/hiredis-py
24+
python setup.py build_ext --inplace
25+
pytest
26+
```
2027

2128
### Requirements
2229

23-
hiredis-py requires **Python 3.6+**.
30+
hiredis-py requires **Python 3.7+**.
2431

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

0 commit comments

Comments
 (0)