diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0132b3f..9e3b817 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,6 +76,28 @@ jobs: - name: Run tests run: uv run --no-sync pytest -vs + walltime-macos-test: + 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: runs-on: ubuntu-latest steps: @@ -83,3 +105,4 @@ jobs: needs: - static-analysis - tests + - walltime-macos-test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bc92b50..5355e8b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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: @@ -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: diff --git a/pyproject.toml b/pyproject.toml index 5b2e0f4..86b4d00 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" @@ -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" diff --git a/setup.py b/setup.py index e0657bb..260dd88 100644 --- a/setup.py +++ b/setup.py @@ -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 diff --git a/src/pytest_codspeed/instruments/hooks/build.py b/src/pytest_codspeed/instruments/hooks/build.py index 5577e4a..24f6fcc 100644 --- a/src/pytest_codspeed/instruments/hooks/build.py +++ b/src/pytest_codspeed/instruments/hooks/build.py @@ -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 *); @@ -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); @@ -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( diff --git a/src/pytest_codspeed/instruments/hooks/instrument-hooks b/src/pytest_codspeed/instruments/hooks/instrument-hooks index 9097bfd..ecdf31a 160000 --- a/src/pytest_codspeed/instruments/hooks/instrument-hooks +++ b/src/pytest_codspeed/instruments/hooks/instrument-hooks @@ -1 +1 @@ -Subproject commit 9097bfd9e018777c566e3e11a148e464258d52e2 +Subproject commit ecdf31a3afd0fb879823e40df65129ec823d374b