Skip to content

Commit 0bd7daa

Browse files
authored
Merge pull request #166 from WojciechMula/release-2.0.0
Prepare release 2.0.0.b1
2 parents 6e19b2d + f563ec8 commit 0bd7daa

File tree

97 files changed

+2036
-1946
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+2036
-1946
lines changed

.github/workflows/extensive-tests.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
2+
name: Run extensive tests Linux and select supported Pythons
3+
4+
on: [workflow_dispatch]
5+
6+
jobs:
7+
extensive_tests:
8+
name: Run test ${{ matrix.test }} on ${{ matrix.os }} and Python ${{ matrix.python }}
9+
runs-on: ${{ matrix.os }}
10+
defaults:
11+
run:
12+
shell: bash
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
python: ["3.8"]
17+
include:
18+
- os: ubuntu-latest
19+
test: make test
20+
21+
- os: ubuntu-latest
22+
test: ./runtest.sh unit
23+
24+
- os: ubuntu-latest
25+
test: ./runtest.sh unpickle
26+
27+
- os: ubuntu-latest
28+
test: ./runtest.sh mallocfaults
29+
30+
- os: ubuntu-latest
31+
test: ./runtest.sh reallocfaults
32+
33+
- os: ubuntu-latest
34+
test: ./runtest.sh pycallfaults
35+
36+
- os: ubuntu-latest
37+
test: ./runtest.sh coverage
38+
39+
- os: ubuntu-latest
40+
test: ./runtest.sh valgrind
41+
42+
steps:
43+
- uses: actions/checkout@v2
44+
45+
- name: Setup
46+
run: sudo apt-get install -y gcovr valgrind
47+
48+
- name: Set up Python
49+
uses: actions/setup-python@v2
50+
with:
51+
python-version: "${{ matrix.python }}"
52+
53+
- name: Run tests
54+
run: ${{ matrix.test }}

.github/workflows/test-and-build.yml

Lines changed: 91 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,85 @@
1-
name: Run tests and build wheel and sdist on all supported OS and Python
21

3-
on: [push, pull_request, workflow_dispatch]
2+
# Derived in part from https://github.com/google/brotli-wheels
3+
#
4+
# Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors.
5+
#
6+
# Permission is hereby granted, free of charge, to any person obtaining a copy
7+
# of this software and associated documentation files (the "Software"), to deal
8+
# in the Software without restriction, including without limitation the rights
9+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
# copies of the Software, and to permit persons to whom the Software is
11+
# furnished to do so, subject to the following conditions:
12+
#
13+
# The above copyright notice and this permission notice shall be included in
14+
# all copies or substantial portions of the Software.
15+
#
16+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
# THE SOFTWARE.
423

5-
jobs:
6-
build_wheels_on_posix:
7-
name: Build wheels on ${{ matrix.os }}
8-
runs-on: ${{ matrix.os }}
9-
strategy:
10-
matrix:
11-
os: [ubuntu-20.04, macos-10.15]
12-
13-
steps:
14-
- uses: actions/checkout@v2
1524

16-
- name: Build wheels and run tests
17-
uses: pypa/[email protected]
18-
env:
19-
# Skip PyPy wheels
20-
CIBW_SKIP: "pp*"
21-
CIBW_TEST_COMMAND: "make -C {project} test3"
22-
23-
- name: Collect built wheels
24-
uses: actions/upload-artifact@v2
25-
with:
26-
path: ./wheelhouse/*.whl
25+
name: Run tests and build wheel and sdist on all supported OS and Python
2726

27+
on: [push, pull_request, workflow_dispatch]
2828

29-
build_wheels_on_windows:
30-
name: Build wheels on ${{ matrix.os }}
29+
jobs:
30+
build_wheels:
31+
name: Build unicode wheels ${{ matrix.type }} ${{ matrix.arch }} on ${{ matrix.os }}
3132
runs-on: ${{ matrix.os }}
33+
defaults:
34+
run:
35+
shell: bash
3236
strategy:
37+
fail-fast: false
3338
matrix:
34-
os: [windows-2019]
39+
os: [macos-10.15, windows-2019]
40+
arch: [auto64]
41+
build: ["cp{36,37,38,39}-*"]
42+
43+
include:
44+
- os: ubuntu-latest
45+
arch: auto64
46+
type: manylinux1
47+
build: "cp{36,37,38,39}-*"
48+
CIBW_MANYLINUX_X86_64_IMAGE: manylinux1
49+
50+
- os: ubuntu-latest
51+
arch: auto64
52+
type: manylinux2010
53+
build: "cp310-*"
54+
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2010
55+
56+
- os: macos-latest
57+
arch: universal2
58+
build: "cp{36,37,38,39,310}-*"
59+
60+
- os: windows-latest
61+
arch: auto64
62+
build: "cp{36,37,38,39,310}-*"
3563

3664
steps:
3765
- uses: actions/checkout@v2
3866

3967
- name: Build wheels and run tests
4068
uses: pypa/[email protected]
4169
env:
70+
CIBW_BUILD: ${{ matrix.build }}
71+
CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.CIBW_MANYLINUX_I686_IMAGE }}
72+
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.CIBW_MANYLINUX_X86_64_IMAGE }}
73+
CIBW_ARCHS: ${{ matrix.arch }}
74+
CIBW_TEST_REQUIRES: pytest
75+
CIBW_TEST_COMMAND: pytest -vvs {project}/tests
4276
# Skip PyPy wheels
4377
CIBW_SKIP: "pp*"
4478

4579
- name: Collect built wheels
4680
uses: actions/upload-artifact@v2
4781
with:
48-
path: ./wheelhouse/*.whl
49-
82+
path: wheelhouse/*.whl
5083

5184
build_sdist:
5285
name: Build source distribution
@@ -68,3 +101,33 @@ jobs:
68101
uses: actions/upload-artifact@v2
69102
with:
70103
path: dist/*.tar.gz
104+
105+
test_on_many_oses:
106+
name: build ${{ matrix.build_type }} - Run tests ${{ matrix.python }} on ${{ matrix.os }}
107+
runs-on: ${{ matrix.os }}
108+
defaults:
109+
run:
110+
shell: bash
111+
112+
strategy:
113+
fail-fast: false
114+
matrix:
115+
os: [ubuntu-18.04, ubuntu-20.04, macos-10.15, macos-11, windows-2019, windows-2022]
116+
python: ["3.6", "3.7", "3.8", "3.9", "3.10"]
117+
build_type: ["AHOCORASICK_UNICODE", "AHOCORASICK_BYTES"]
118+
119+
steps:
120+
- name: Set up Python
121+
uses: actions/setup-python@v2
122+
with:
123+
python-version: "${{ matrix.python }}"
124+
125+
- uses: actions/checkout@v2
126+
127+
- name: Build, install and test
128+
run: >
129+
export ${{ matrix.build_type }}=yes &&
130+
set ${{ matrix.build_type }}=yes &&
131+
pip install .[testing] &&
132+
pytest -vvs
133+

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ dist/
2222
coverage/
2323
/venv/
2424
/.python-version
25+
/automaton-wee.pickle
26+
/.pytest_cache/

.travis.yml

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

CHANGELOG.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
=============
2+
Changelog
3+
=============
4+
5+
6+
2.0.0 (2022-04-xx)
7+
--------------------------------------------------
8+
9+
- Drop support for Python 2
10+
- Drop support for 32 bits OSes
11+
- Re-organize code such that sources are under src/, utilities under etc/
12+
and tests are under tests/
13+
- Use pytest for testing and streamline tests to use a more conventional Python approach
14+
- Build more compatible Linux wheels using "ci-build-wheel"
15+
16+
117
1.4.4 (2022-02-20)
218
--------------------------------------------------
319

LICENSE

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
2-
Copyright (c) 2011-2016 Wojciech Muła
1+
Copyright (c) Wojciech Muła
32
All rights reserved.
43

54
Redistribution and use in source and binary forms, with or

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ graft docs
44
graft msinttypes
55
graft py
66
graft docs
7-
graft regression
7+
graft tests
88
graft src
99
graft stamp
1010
graft unresolved_bugs

Makefile

Lines changed: 29 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,47 @@
11
.SUFFIXES:
2-
.PHONY: test clean valgrind
2+
.PHONY: test test_unicode test_bytes build build_unicode build_bytes clean valgrind benchmark
33

4-
export PYTHONPATH := .:$(PYTHONPATH):$(PATH)
5-
6-
DEPS=*.c \
7-
*.h \
4+
DEPS=src/*.c \
5+
src/*.h \
86
setup.py \
9-
unittests.py
10-
11-
test3: stamp/regression_py3
12-
13-
test: stamp/regression_py2 stamp/regression_py3
14-
15-
stamp/build_py2: $(DEPS)
16-
python2 setup.py build_ext --inplace
17-
touch $@
7+
tests/*.py
188

19-
stamp/unittests_py2: stamp/build_py2
20-
python2 unittests.py
21-
touch $@
9+
build: build_unicode
2210

23-
stamp/regression_py2: stamp/unittests_py2
24-
python2 regression/issue_5.py
25-
python2 regression/issue_8.py
26-
python2 regression/issue_9.py
27-
python2 regression/issue_10.py
28-
python2 regression/issue_26.py
29-
python2 regression/issue_56.py
30-
touch $@
11+
build_unicode: $(DEPS) venv/bin/activate
12+
@rm -rf dist build *.so
13+
AHOCORASICK_UNICODE=yes venv/bin/pip install -e .
3114

15+
build_bytes: $(DEPS) venv/bin/activate
16+
@rm -rf dist build *.so
17+
AHOCORASICK_BYTES=yes venv/bin/pip install -e .
3218

33-
stamp/build_py3: $(DEPS)
34-
python3 setup.py build_ext --inplace
35-
touch $@
19+
test: test_unicode
3620

37-
stamp/unittests_py3: stamp/build_py3
38-
python3 unittests.py
39-
touch $@
21+
test_unicode: $(DEPS) build_unicode
22+
@rm -rf dist build *.so
23+
AHOCORASICK_UNICODE=yes venv/bin/pip install -e .[testing]
24+
venv/bin/pytest -vvs
4025

41-
stamp/regression_py3: stamp/unittests_py3
42-
python3 regression/issue_5.py
43-
python3 regression/issue_8.py
44-
python3 regression/issue_9.py
45-
python3 regression/issue_10.py
46-
python3 regression/issue_26.py
47-
python3 regression/issue_56.py
48-
touch $@
26+
test_bytes: $(DEPS) build_bytes
27+
@rm -rf dist build *.so
28+
AHOCORASICK_BYTES=yes venv/bin/pip install -e .[testing]
29+
venv/bin/pytest -vvs
4930

31+
venv/virtualenv.pyz:
32+
@mkdir -p venv
33+
@curl -o venv/virtualenv.pyz https://bootstrap.pypa.io/virtualenv/virtualenv.pyz
5034

51-
benchmark: benchmarks/benchmark.py stamp/build_py2
52-
python2 $^
35+
venv/bin/activate: venv/virtualenv.pyz
36+
python3 venv/virtualenv.pyz venv
5337

54-
devbuild2:
55-
python2 setup.py build_ext --inplace
56-
57-
devbuild3:
58-
python3 setup.py build_ext --inplace
38+
benchmark: etc/benchmarks/benchmark.py build
39+
python3 $^
5940

6041
valgrind:
6142
python -c "import sys;print(sys.version)"
62-
valgrind --leak-check=full --track-origins=yes --log-file=valgrind.log python unittests.py
63-
64-
pip-release:
65-
python setup.py sdist upload
66-
67-
dist:
68-
python setup.py sdist
43+
valgrind --leak-check=full --track-origins=yes --log-file=valgrind.log venv/bin/pytest -vvs
6944

7045
clean:
7146
rm -f stamp/*
72-
rm -rf dist build
47+
rm -rf dist build venv

0 commit comments

Comments
 (0)