Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,33 @@
- name: Run tests
run: uv run --no-sync pytest -vs

walltime-macos-test:
Comment thread
GuillaumeLagrange marked this conversation as resolved.
runs-on: macos-latest
steps:
- uses: actions/checkout@v5
with:
submodules: true
- uses: astral-sh/setup-uv@v7
- uses: actions/setup-python@v6
with:
python-version: "3.14"
- name: Install dependencies
run: uv sync --all-extras --dev --locked
- name: Run the benchmarks
uses: CodSpeedHQ/action@main
env:
CODSPEED_SKIP_UPLOAD: "true"
with:
run: uv run pytest tests/benchmarks/test_bench_fibo.py --codspeed
mode: walltime
# TODO: Remove this once the runner has been released with macos support
runner-version: branch:main

all-checks:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
runs-on: ubuntu-latest
steps:
- run: echo "All CI checks passed."
needs:
- static-analysis
- tests
- walltime-macos-test
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
arch: x86_64
- runs-on: codspeedhq-arm64-ubuntu-24.04
arch: aarch64
- runs-on: macos-latest
arch: arm64

runs-on: ${{ matrix.platform.runs-on }}
steps:
Expand All @@ -34,7 +36,7 @@ jobs:

- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.platform.arch }}
name: wheels-${{ matrix.platform.runs-on }}-${{ matrix.platform.arch }}
path: wheelhouse/*.whl

build-py3-none-any:
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ push = false
]

[tool.cibuildwheel]
build = "cp*manylinux*"
build = "cp*{manylinux,macosx}*"
test-extras = ["build", "test", "compat"]
test-command = "pytest -v --ignore={project}/tests/benchmarks {project}/tests"

Expand All @@ -108,6 +108,9 @@ manylinux-x86_64-image = "manylinux_2_28"
manylinux-aarch64-image = "manylinux_2_28"
before-all = "yum -y install valgrind-devel"

[tool.cibuildwheel.macos]
environment = { PYTEST_CODSPEED_FORCE_EXTENSION_BUILD = "1" }

[tool.mypy]
python_version = "3.12"

Expand Down
7 changes: 3 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@

print(f"System: {system} ({current_arch})")

IS_EXTENSION_BUILDABLE = system == "Linux" and current_arch in [
"x86_64",
"aarch64",
]
IS_EXTENSION_BUILDABLE = (
system == "Linux" and current_arch in ["x86_64", "aarch64"]
) or (system == "Darwin" and current_arch == "arm64")

IS_EXTENSION_REQUIRED = (
os.environ.get("PYTEST_CODSPEED_FORCE_EXTENSION_BUILD") is not None
Expand Down
6 changes: 3 additions & 3 deletions src/pytest_codspeed/instruments/hooks/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

# Manually copied from `instrument-hooks/includes/core.h` to avoid parsing issues
ffibuilder.cdef("""
typedef uint64_t *InstrumentHooks;
typedef struct InstrumentHooks InstrumentHooks;

InstrumentHooks *instrument_hooks_init(void);
void instrument_hooks_deinit(InstrumentHooks *);
Expand All @@ -28,7 +28,7 @@
#define MARKER_TYPE_BENCHMARK_START 2
#define MARKER_TYPE_BENCHMARK_END 3

uint8_t instrument_hooks_add_marker(InstrumentHooks *, uint32_t pid,
uint8_t instrument_hooks_add_marker(InstrumentHooks *, int32_t pid,
uint8_t marker_type, uint64_t timestamp);
uint64_t instrument_hooks_current_timestamp(void);

Expand All @@ -44,7 +44,7 @@
const char *key,
const char *const *values,
uint32_t count);
uint8_t instrument_hooks_write_environment(InstrumentHooks *, uint32_t pid);
uint8_t instrument_hooks_write_environment(InstrumentHooks *, int32_t pid);
""")

ffibuilder.set_source(
Expand Down
Loading