-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d6883a1
Showing
36 changed files
with
2,739 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
use flake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM quay.io/pypa/manylinux2014_x86_64:latest | ||
|
||
RUN echo -e '#!/usr/bin/env bash\nsource scl_source enable llvm-toolset-7\nexec "$@"' > /entrypoint.sh && chmod +x /entrypoint.sh | ||
RUN yum install -y llvm-toolset-7 ragel && yum clean all | ||
RUN curl -L https://boostorg.jfrog.io/artifactory/main/release/1.80.0/source/boost_1_80_0.tar.gz -o boost.tar.gz \ | ||
&& test 4b2136f98bdd1f5857f1c3dea9ac2018effe65286cf251534b6ae20cc45e1847 == $(sha256sum -b boost.tar.gz | cut -c1-64) \ | ||
|| { echo "Checksum mismatch"; exit 11; } \ | ||
&& tar --strip-components 1 -xf boost.tar.gz -C /usr/include \ | ||
&& rm boost.tar.gz | ||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,247 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- v*.*.* | ||
pull_request: | ||
|
||
jobs: | ||
checks: | ||
name: Checks | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
~/.cache/pre-commit | ||
target/ | ||
key: checks-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: checks-cargo- | ||
- name: Python code format | ||
uses: psf/black@stable | ||
- name: Installing nightly Rust toolchain | ||
uses: dtolnay/rust-toolchain@nightly | ||
with: | ||
components: clippy, rustfmt | ||
- name: Installing dependencies | ||
run: | | ||
sudo apt install -y libhyperscan-dev libhyperscan5 | ||
pip install '.[test]' | ||
- uses: pre-commit-ci/[email protected] | ||
- uses: pre-commit/[email protected] | ||
- name: Rust code checks | ||
run: | | ||
rm -f rust-toolchain.toml | ||
cargo fmt --all -- --check | ||
cargo clippy -- -D warnings | ||
- name: Python type check | ||
run: mypy . --exclude hyperscan-sys | ||
- name: Python tests | ||
uses: dariocurr/pytest-summary@main | ||
|
||
build-nix: | ||
needs: | ||
- checks | ||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-latest | ||
arch: x86_64-linux | ||
drv: "shared" | ||
- os: ubuntu-latest | ||
arch: x86_64-linux | ||
drv: "hyperscan" | ||
- os: ubuntu-latest | ||
arch: x86_64-linux | ||
drv: "vectorscan" | ||
- os: macos-latest | ||
arch: x86_64-darwin | ||
drv: vectorscan | ||
name: Nix - ${{ matrix.arch }}.${{ matrix.drv }} | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
- uses: cachix/install-nix-action@v18 | ||
- uses: cachix/cachix-action@v12 | ||
with: | ||
name: vlaci | ||
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" | ||
- name: Build nix shell | ||
run: | | ||
nix build -L .#devShell.${{ matrix.arch }} | ||
- name: Build nix package | ||
run: nix build -L .?submodules=1#defaultPackage.${{ matrix.arch }}.${{ matrix.drv }} | ||
|
||
prepare-build-env: | ||
needs: | ||
- checks | ||
strategy: | ||
matrix: | ||
include: | ||
- target: x86_64-unknown-linux-gnu | ||
name: Build Docker env - ${{ matrix.target }} | ||
runs-on: ubuntu-latest | ||
outputs: | ||
image: ${{ steps.build.outputs.image }} | ||
tag: ${{ steps.build.outputs.tag }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Prepare build | ||
id: build | ||
if: ${{ runner.os == 'Linux' }} | ||
run: | | ||
IMAGE=ghcr.io/vlaci/pyperscan-builder | ||
TAG=${{ hashFiles(format('.github/Dockerfile.{0}', matrix.target)) }} | ||
REF=$IMAGE-${{ matrix.target }}:$TAG | ||
echo ref=$REF > $GITHUB_ENV | ||
echo image=$IMAGE > $GITHUB_OUTPUT | ||
echo tag=$TAG >> $GITHUB_OUTPUT | ||
if ! docker manifest inspect $REF; then | ||
echo build=true >> $GITHUB_ENV | ||
fi | ||
- name: Login to GitHub Container Registry | ||
if: ${{ env.build }} | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and push | ||
if: ${{ env.build }} | ||
uses: docker/build-push-action@v3 | ||
with: | ||
file: ./.github/Dockerfile.${{ matrix.target }} | ||
push: true | ||
tags: ${{ env.ref }} | ||
|
||
sdist: | ||
name: Build - sdist | ||
runs-on: ubuntu-latest | ||
needs: | ||
- checks | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up cargo cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: sdist-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: sdist-cargo- | ||
- uses: PyO3/maturin-action@v1 | ||
with: | ||
container: off | ||
command: sdist | ||
args: -o dist | ||
- name: Upload sdist | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: sdist | ||
path: dist | ||
|
||
build-wheels: | ||
needs: | ||
- prepare-build-env | ||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-latest | ||
maturin: "-F hyperscan" | ||
target: x86_64-unknown-linux-gnu | ||
kind: static-hyperscan | ||
- os: ubuntu-latest | ||
maturin: "-F vectorscan" | ||
target: x86_64-unknown-linux-gnu | ||
kind: static-vectorscan | ||
- os: macos-latest | ||
target: universal2-apple-darwin | ||
maturin: "-F vectorscan --universal2" | ||
kind: static-vectorscan | ||
name: Build - ${{ matrix.target }} ${{ matrix.kind }} | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
- name: Set up cargo cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ matrix.target }}-${{ matrix.kind }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: ${{ matrix.target }}-${{ matrix.kind }}-cargo- | ||
- name: Install dependencies | ||
if: ${{ runner.os == 'macOS' }} | ||
run: | | ||
brew install boost ragel | ||
echo container= > $GITHUB_ENV | ||
- name: Building builder container | ||
if: ${{ runner.os == 'Linux' }} | ||
run: | | ||
CONTAINER=${{ needs.prepare-build-env.outputs.image }}-${{ matrix.target }}:${{ needs.prepare-build-env.outputs.tag }} | ||
echo container=$CONTAINER > $GITHUB_ENV | ||
- name: Disable tools | ||
run: | | ||
rm hyperscan-sys/*/tools/CMakeLists.txt | ||
- uses: PyO3/maturin-action@v1 | ||
with: | ||
container: ${{ env.container }} | ||
command: build | ||
args: --release --strip -o dist -vv ${{ matrix.maturin }} | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.8" | ||
- name: Installing built wheel | ||
run: | | ||
whl=(dist/pyperscan-*.whl) | ||
pip install "$whl[test]" | ||
- uses: dariocurr/pytest-summary@main | ||
- name: Upload wheels | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: wheels-${{ matrix.target }}.${{ matrix.kind }} | ||
path: dist | ||
|
||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
if: "startsWith(github.ref, 'refs/tags/')" | ||
needs: | ||
- sdist | ||
- build-wheels | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: sdist | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: wheels-x86_64-unknown-linux-gnu.static-vectorscan | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: wheels-universal2-apple-darwin.static-vectorscan | ||
- name: Publish to PyPI | ||
uses: messense/maturin-action@v1 | ||
env: | ||
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | ||
with: | ||
command: upload | ||
args: --skip-existing * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/target | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
.pytest_cache/ | ||
*.py[cod] | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
.venv/ | ||
env/ | ||
bin/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
include/ | ||
man/ | ||
venv/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
pip-selfcheck.json | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
|
||
# Translations | ||
*.mo | ||
|
||
# Mr Developer | ||
.mr.developer.cfg | ||
.project | ||
.pydevproject | ||
|
||
# Rope | ||
.ropeproject | ||
|
||
# Django stuff: | ||
*.log | ||
*.pot | ||
|
||
.DS_Store | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyCharm | ||
.idea/ | ||
|
||
# VSCode | ||
.vscode/ | ||
|
||
# Pyenv | ||
.python-version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[submodule "hyperscan-src/vectorscan"] | ||
path = hyperscan-sys/vectorscan | ||
url = https://github.com/VectorCamp/vectorscan | ||
[submodule "hyperscan-src/hyperscan"] | ||
path = hyperscan-sys/hyperscan | ||
url = https://git.sr.ht/~vlaci/hyperscan |
Oops, something went wrong.