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 d7e9bef
Show file tree
Hide file tree
Showing 8 changed files with 238 additions and 702 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
2 changes: 2 additions & 0 deletions .mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[tools]
python = "3.13.0"
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
}
756 changes: 113 additions & 643 deletions pdm.lock

Large diffs are not rendered by default.

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.16.4", "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 d7e9bef

Please sign in to comment.