Skip to content

Commit

Permalink
ci: 🎡 update macos runners (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
darvid committed Oct 11, 2024
1 parent 684b308 commit f53de7a
Show file tree
Hide file tree
Showing 10 changed files with 666 additions and 984 deletions.
31 changes: 15 additions & 16 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ jobs:
platform_id: musllinux_x86_64
- os: ubicloud-standard-2-arm
platform_id: manylinux_aarch64
- os: macos-12-xl
- os: macos-15-large
platform_id: macosx_x86_64
- os: flyci-macos-large-latest-m1
- os: macos-15
platform_id: macosx_arm64

steps:
Expand Down Expand Up @@ -192,46 +192,45 @@ jobs:
platform_id: musllinux_aarch64

# 🍎 macOS x86_64
- os: macos-12-xl
- os: macos-15-large
python: "3.9"
python_id: cp39
platform_id: macosx_x86_64
- os: macos-12-xl
- os: macos-15-large
python: "3.10"
python_id: cp310
platform_id: macosx_x86_64
- os: macos-12-xl
- os: macos-15-large
python: "3.11"
python_id: cp311
platform_id: macosx_x86_64
- os: macos-12-xl
- os: macos-15-large
python: "3.12"
python_id: cp312
platform_id: macosx_x86_64
- os: macos-12-xl
- os: macos-15-large
python: "3.13"
python_id: cp313
platform_id: macosx_x86_64

# 🍎 macOS arm64 (Apple silicon)
# XXX: ☠️ https://github.com/actions/setup-python/issues/696
# - os: flyci-macos-large-latest-m1
# python: "3.9"
# python_id: cp39
# platform_id: macosx_arm64
- os: flyci-macos-large-latest-m1
- os: macos-15
python: "3.9"
python_id: cp39
platform_id: macosx_arm64
- os: macos-15
python: "3.10"
python_id: cp310
platform_id: macosx_arm64
- os: flyci-macos-large-latest-m1
- os: macos-15
python: "3.11"
python_id: cp311
platform_id: macosx_arm64
- os: flyci-macos-large-latest-m1
- os: macos-15
python: "3.12"
python_id: cp312
platform_id: macosx_arm64
- os: flyci-macos-large-latest-m1
- os: macos-15
python: "3.13"
python_id: cp313
platform_id: macosx_arm64
Expand Down
3 changes: 3 additions & 0 deletions .mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[tools]
python = "3.13.0"
shfmt = "latest"
2 changes: 0 additions & 2 deletions .rtx.toml

This file was deleted.

18 changes: 18 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/usr/include/python3.10",
"/usr/include/hs"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c17",
"cppStandard": "gnu++17",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}
4 changes: 2 additions & 2 deletions build_tools/macos/build_hyperscan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ cd $(basename ${HYPERSCAN_GIT_SOURCE})
export PATH="$(brew --prefix gnu-tar)/bin:$PATH"
# build and install PCRE (static required for Chimera)
wget -qO- https://sourceforge.net/projects/pcre/files/pcre/${PCRE_VERSION}/pcre-${PCRE_VERSION}.tar.gz/download | tar xvz
cd "pcre-${PCRE_VERSION}"
mv "pcre-${PCRE_VERSION}" pcre
cd pcre

export CFLAGS=-fPIC
export CXXFLAGS=-fPIC
Expand All @@ -41,7 +42,6 @@ cmake \
-DBUILD_STATIC_LIBS=ON \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=${HYPERSCAN_BUILD_TYPE} \
-DPCRE_SOURCE=/tmp/vectorscan/pcre-${PCRE_VERSION} \
-DCMAKE_C_FLAGS="$CFLAGS" \
-DCMAKE_CXX_FLAGS="$CXXFLAGS -D_GLIBCXX_USE_CXX11_ABI=0"
cmake --build build --parallel ${nproc}
Expand Down
1,459 changes: 536 additions & 923 deletions pdm.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions pdm.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[strategy]
inherit_metadata = true
72 changes: 31 additions & 41 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ before-test = "bash {project}/build_tools/wheels/before_test.sh"
# Will avoid testing on emulated architectures and macOS Apple silicon
test-skip = "*-*linux_{ppc64le,s390x} *-macosx_arm64"

manylinux-x86_64-image = "ghcr.io/darvid/python_hyperscan_manylinux_2_28_x86_64:2024-01-27-1e3cb40"
manylinux-aarch64-image = "ghcr.io/darvid/python_hyperscan_manylinux_2_28_aarch64:2024-01-27-1e3cb40"
manylinux-pypy_x86_64-image = "ghcr.io/darvid/python_hyperscan_manylinux_2_28_x86_64:2024-01-27-1e3cb40"
manylinux-pypy_aarch64-image = "ghcr.io/darvid/python_hyperscan_manylinux_2_28_aarch64:2024-01-27-1e3cb40"
musllinux-x86_64-image = "ghcr.io/darvid/python_hyperscan_musllinux_1_1_x86_64:2024-01-27-1e3cb40"
musllinux-aarch64-image = "ghcr.io/darvid/python_hyperscan_musllinux_1_1_aarch64:2024-01-27-1e3cb40"
manylinux-x86_64-image = "ghcr.io/darvid/python_hyperscan_manylinux_2_28_x86_64:2024-10-10-743e228"
manylinux-aarch64-image = "ghcr.io/darvid/python_hyperscan_manylinux_2_28_aarch64:2024-10-10-743e228"
manylinux-pypy_x86_64-image = "ghcr.io/darvid/python_hyperscan_manylinux_2_28_x86_64:2024-10-10-743e228"
manylinux-pypy_aarch64-image = "ghcr.io/darvid/python_hyperscan_manylinux_2_28_aarch64:2024-10-10-743e228"
musllinux-x86_64-image = "ghcr.io/darvid/python_hyperscan_musllinux_1_1_x86_64:2024-10-10-743e228"
musllinux-aarch64-image = "ghcr.io/darvid/python_hyperscan_musllinux_1_1_aarch64:2024-10-10-743e228"

# repair-wheel-command = [
# 'pip install auditwheel-symbols',
Expand All @@ -70,50 +70,40 @@ is-purelib = false
run-setuptools = true

[tool.pdm.dev-dependencies]
dev = [
"ipython>=8.18.1",
"rich>=13.7.0",
]
dev = ["ipython>=8.18.1", "rich>=13.7.0"]
lint = [
"black>=24.1.1",
"isort>=5.13.2",
"ruff>=0.1.14",
"pre-commit>=3.6.0",
"clang-format>=17.0.6",
"isort>=5.13.2",
"ruff>=0.1.14",
"pre-commit>=3.6.0",
"clang-format>=17.0.6",
]
test = [
"pytest>=8.0.0",
"pytest-mock>=3.12.0",
"requests>=2.31.0",
"urllib3>=2.1.0",
"tox>=4.12.1",
"memunit>=0.5.2",
"pytest-xdist>=3.5.0",
"joblib>=1.3.2",
"pytest>=8.0.0",
"pytest-mock>=3.12.0",
"requests>=2.31.0",
"urllib3>=2.1.0",
"tox>=4.12.1",
"memunit>=0.5.2",
"pytest-xdist>=3.5.0",
"joblib>=1.3.2",
]
release = [
"python-semantic-release>=8.7.0",
"setuptools>=69.0.3",
]
build = [
"cibuildwheel>=2.16.4",
"build>=1.0.3",
]
memprofile = [
"matplotlib>=3.8.2",
"numpy>=1.26.3",
"scipy>=1.12.0",
"python-semantic-release>=8.7.0",
"setuptools>=69.0.3",
"pydantic>=2.9",
]
build = ["cibuildwheel>=2.21.3", "build>=1.0.3"]
# memprofile = [
# "matplotlib>=3.8.2",
# "numpy>=1.26.3",
# "scipy>=1.12.0",
# ]

[tool.semantic_release]
commit_parser = "emoji"
tag_format = "v{version}"
version_variables = [
"src/hyperscan/_version.py:__version__",
]
version_toml = [
"pyproject.toml:project.version",
]
version_variables = ["src/hyperscan/_version.py:__version__"]
version_toml = ["pyproject.toml:project.version"]

[tool.semantic_release.branches.release]
match = '(main|create-pull-request/patch|release/v?[\\d\\.\\-]+)'
Expand All @@ -123,7 +113,7 @@ prerelease = false
major_tags = [":boom:"]
minor_tags = [
":sparkles:",
":children_crossing:",
":children_`ing:",
":lipstick:",
":iphone:",
":egg:",
Expand Down
55 changes: 55 additions & 0 deletions tools/test_memory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env python
import os
import tracemalloc
from typing import Any, Callable, Generator

import psutil
from rich.progress import track

import hyperscan

db = hyperscan.Database(mode=hyperscan.HS_MODE_BLOCK)


def profile_mem(
target: Callable[..., Any],
iterations=100_000,
sample_interval=10_000,
) -> Generator[int, None, None]:
for i in range(iterations):
target()
if i % sample_interval == 0:
process = psutil.Process()
yield process.memory_info().rss


def main() -> None:
tracemalloc.start()
os.getpid()

db = hyperscan.Database(mode=hyperscan.HS_MODE_BLOCK)

def compile():
db.compile(
expressions=[b'test'],
ids=[1],
flags=[hyperscan.HS_FLAG_ALLOWEMPTY],
)

def dump():
compile()
hyperscan.dumpb(db)

for callback in (dump,):
for i, step in enumerate(
track(
profile_mem(callback),
description=f"📊 Profiling {callback.__name__}...",
total=10,
)
):
...


if __name__ == "__main__":
main()
4 changes: 4 additions & 0 deletions tools/test_memory.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
mprof rm 0 2>/dev/null
mprof run python test_memory.py
mprof plot >/dev/null 2>&1

0 comments on commit f53de7a

Please sign in to comment.