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
32 changes: 32 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build & Test

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']

steps:
- uses: actions/checkout@v7
with:
submodules: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Install
run: |
pip install -e .[dev]
48 changes: 34 additions & 14 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,54 @@ on:
branches:
- main

jobs:
docs:
runs-on: windows-2019
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

env:
# XXX https://github.com/scikit-build/scikit-build/issues/740
SETUPTOOLS_ENABLE_FEATURES: legacy-editable
jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
with:
submodules: true

- uses: actions/setup-python@v5
- uses: actions/setup-python@v7
with:
python-version: '3.12'
python-version: '3.14'
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade pip
- name: Install
run: |
pip install -e .[dev]
- name: Setup Pages
id: pages
uses: actions/configure-pages@v6
- name: Build documentation
run: |
make html
working-directory: ./docs
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v5
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build/html
path: ./docs/_build/html

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5
44 changes: 26 additions & 18 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,64 +5,72 @@ on:
branches:
- main
tags:
- v[0-9].*
- 'v[0-9].*'
workflow_dispatch:

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-2019]
os: [windows-2022]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
with:
submodules: true

- uses: actions/setup-python@v5
- uses: actions/setup-python@v7
with:
python-version: '3.12'
python-version: '3.14'

- name: Build sdist
if: matrix.os == 'windows-2019'
if: matrix.os == 'windows-2022'
run: |
pip install build
python -m build --sdist

- name: Build wheels
uses: pypa/cibuildwheel@v2.21.3
uses: pypa/cibuildwheel@v4.2.0
env:
CIBW_SKIP: 'pp*'
CIBW_BEFORE_BUILD: |
if exist _skbuild rmdir /s /q _skbuild
# XXX https://github.com/scikit-build/scikit-build/issues/740
CIBW_ENVIRONMENT: >
SETUPTOOLS_ENABLE_FEATURES=legacy-editable
with:
output-dir: dist

- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v7
with:
name: wheels-${{ matrix.os }}
path: dist/*

upload_release:
name: Upload release
publish:
name: Publish
needs: [build_wheels]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')

permissions:
contents: write
id-token: write

environment:
name: pypi
url: https://pypi.org/project/cyminhook/

steps:
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v8
with:
pattern: wheels-*
merge-multiple: true
path: dist

- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist

- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v3
with:
draft: true
files: dist/*
21 changes: 16 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
cmake_minimum_required(VERSION 3.22)
cmake_minimum_required(VERSION 3.22...4.4)

project(cyminhook)
find_package(PythonExtensions REQUIRED)
find_package(Cython REQUIRED)
project(${SKBUILD_PROJECT_NAME} LANGUAGES C)

find_package(
Python
COMPONENTS Interpreter Development.Module
REQUIRED)
find_package(Cython MODULE REQUIRED VERSION 3.0)
include(UseCython)

add_subdirectory(minhook)
add_subdirectory(cyminhook)

cython_transpile(cyminhook/_cyminhook.pyx LANGUAGE C
OUTPUT_VARIABLE _cyminhook_c)

python_add_library(_cyminhook MODULE ${_cyminhook_c} WITH_SOABI)
target_link_libraries(_cyminhook PRIVATE minhook)
install(TARGETS _cyminhook LIBRARY DESTINATION ${SKBUILD_PROJECT_NAME})
5 changes: 0 additions & 5 deletions cyminhook/CMakeLists.txt

This file was deleted.

45 changes: 43 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
[build-system]
requires = ["setuptools>=59", "scikit-build>=0.13.1", "cmake", "ninja; sys_platform != 'win32'", "cython"]
build-backend = "setuptools.build_meta"
requires = ["scikit-build-core", "cython>=3.0", "cython-cmake"]
build-backend = "scikit_build_core.build"

[project]
name = "cyminhook"
dynamic = ["version"]
authors = [{ name = "Segev Finer", email = "segev208@gmail.com" }]
description = "Hook functions on Windows using MinHook"
keywords = ["MinHook"]
license = "MIT"
license-files = ["LICENSE"]
readme = "README.rst"
requires-python = ">=3.9"
classifiers = [
"Development Status :: 3 - Alpha",
"Environment :: Win32 (MS Windows)",
"Intended Audience :: Developers",
"Topic :: Security",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Cython",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
]

[project.urls]
homepage = "https://github.com/segevfiner/cyminhook"
documentation = "https://segevfiner.github.io/cyminhook/"
issues = "https://github.com/segevfiner/cyminhook/issues"

[project.optional-dependencies]
dev = [
"sphinx==9.*; python_version >= '3.12'",
]

[[tool.dynamic-metadata]]
provider = "scikit_build_core.metadata.regex"
field = "version"
input = "cyminhook/__init__.py"
54 changes: 0 additions & 54 deletions setup.py

This file was deleted.