Skip to content

Commit 7dded17

Browse files
authored
Release (#1)
Initial Release
1 parent 5ad0b68 commit 7dded17

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+14069
-1094
lines changed

.dockerignore

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.so
6+
.Python
7+
build/
8+
develop-eggs/
9+
dist/
10+
downloads/
11+
eggs/
12+
.eggs/
13+
lib/
14+
lib64/
15+
parts/
16+
sdist/
17+
var/
18+
wheels/
19+
*.egg-info/
20+
.installed.cfg
21+
*.egg
22+
23+
# Virtual environments
24+
venv/
25+
ENV/
26+
env/
27+
.venv
28+
29+
# IDE
30+
.vscode/
31+
.idea/
32+
*.swp
33+
*.swo
34+
*~
35+
36+
# Testing
37+
.pytest_cache/
38+
.coverage
39+
htmlcov/
40+
.tox/
41+
42+
# OS
43+
.DS_Store
44+
Thumbs.db
45+
46+
# Git
47+
.git/
48+
.gitignore
49+
.gitattributes
50+
51+
# CI
52+
.github/
53+
54+
# Documentation
55+
docs/_build/
56+
*.md
57+
58+
# Local development
59+
.uv/
60+
uv.lock

.github/workflows/_benchmark.yml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
name: Benchmark
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
primary-os:
7+
required: true
8+
type: string
9+
primary-python:
10+
required: true
11+
type: string
12+
13+
jobs:
14+
benchmark:
15+
name: Benchmark
16+
runs-on: ${{ inputs.primary-os }}
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: ${{ inputs.primary-python }}
25+
cache: 'pip'
26+
27+
- name: Cache apt packages (Linux)
28+
if: runner.os == 'Linux'
29+
uses: actions/cache@v4
30+
with:
31+
path: /var/cache/apt/archives
32+
key: apt-${{ runner.os }}-${{ hashFiles('.github/workflows/_benchmark.yml') }}
33+
restore-keys: |
34+
apt-${{ runner.os }}-
35+
36+
- name: Install system dependencies (Linux)
37+
if: runner.os == 'Linux'
38+
run: |
39+
sudo apt-get update
40+
sudo apt-get install -y cmake ninja-build libssl-dev pkg-config autoconf automake libtool
41+
42+
- name: Cache Homebrew packages (macOS)
43+
if: runner.os == 'macOS'
44+
uses: actions/cache@v4
45+
with:
46+
path: |
47+
~/Library/Caches/Homebrew
48+
/usr/local/Cellar
49+
/usr/local/opt
50+
key: brew-${{ runner.os }}-${{ hashFiles('.github/workflows/_benchmark.yml') }}
51+
restore-keys: |
52+
brew-${{ runner.os }}-
53+
54+
- name: Install system dependencies (macOS)
55+
if: runner.os == 'macOS'
56+
run: brew install cmake ninja libnghttp2
57+
58+
- name: Setup Go (for BoringSSL build)
59+
uses: actions/setup-go@v5
60+
with:
61+
go-version: '1.21'
62+
cache: true
63+
64+
- name: Setup ccache (Unix)
65+
if: runner.os != 'Windows'
66+
uses: hendrikmuhs/ccache-action@v1.2
67+
with:
68+
key: ccache-${{ runner.os }}-${{ inputs.primary-python }}
69+
max-size: 500M
70+
71+
- name: Configure ccache (Unix)
72+
if: runner.os != 'Windows'
73+
run: |
74+
echo "CC=ccache gcc" >> $GITHUB_ENV
75+
echo "CXX=ccache g++" >> $GITHUB_ENV
76+
shell: bash
77+
78+
- name: Restore vendor cache
79+
id: cache-vendor
80+
uses: actions/cache/restore@v4
81+
with:
82+
path: vendor
83+
key: vendor-${{ runner.os }}-${{ hashFiles('scripts/setup_vendors.sh') }}-v7
84+
restore-keys: |
85+
vendor-${{ runner.os }}-
86+
87+
- name: Setup vendor dependencies
88+
if: steps.cache-vendor.outputs.cache-hit != 'true'
89+
run: |
90+
chmod +x scripts/setup_vendors.sh
91+
./scripts/setup_vendors.sh
92+
93+
- name: Restore Python build cache
94+
id: cache-python-build
95+
uses: actions/cache/restore@v4
96+
with:
97+
path: |
98+
build/
99+
*.egg-info/
100+
key: python-build-${{ runner.os }}-${{ inputs.primary-python }}-${{ hashFiles('setup.py', 'pyproject.toml', 'src/**/*.c', 'src/**/*.cpp', 'src/**/*.h') }}
101+
restore-keys: |
102+
python-build-${{ runner.os }}-${{ inputs.primary-python }}-
103+
104+
- name: Install package
105+
run: pip install -e ".[dev,benchmark]"
106+
107+
- name: Run benchmarks
108+
run: pytest benchmarks/ --benchmark-only --benchmark-json=benchmark.json
109+
110+
- name: Store benchmark
111+
uses: benchmark-action/github-action-benchmark@v1
112+
with:
113+
tool: 'pytest'
114+
output-file-path: benchmark.json
115+
github-token: ${{ secrets.GITHUB_TOKEN }}
116+
auto-push: true
117+
118+
# Save caches even if benchmarks fail (using always())
119+
- name: Save vendor cache
120+
if: always() && steps.cache-vendor.outputs.cache-hit != 'true'
121+
uses: actions/cache/save@v4
122+
with:
123+
path: vendor
124+
key: vendor-${{ runner.os }}-${{ hashFiles('scripts/setup_vendors.sh') }}-v7
125+
126+
- name: Save Python build cache
127+
if: always()
128+
uses: actions/cache/save@v4
129+
with:
130+
path: |
131+
build/
132+
*.egg-info/
133+
key: python-build-${{ runner.os }}-${{ inputs.primary-python }}-${{ hashFiles('setup.py', 'pyproject.toml', 'src/**/*.c', 'src/**/*.cpp', 'src/**/*.h') }}

.github/workflows/_config.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
#
2+
# Global CI/CD Configuration
3+
#
4+
# This is a reusable workflow config that defines common settings across all workflows.
5+
# Edit this file to control which OS and Python versions to test against.
6+
#
7+
# During development, you can comment out OS/Python versions to speed up CI runs.
8+
#
9+
10+
name: Global Config
11+
12+
on:
13+
workflow_call:
14+
outputs:
15+
# OS matrix - comment out any you don't want to test
16+
os-matrix:
17+
description: "Operating systems to test"
18+
value: ${{ jobs.config.outputs.os-matrix }}
19+
20+
# Python versions - comment out any you don't want to test
21+
python-matrix:
22+
description: "Python versions to test"
23+
value: ${{ jobs.config.outputs.python-matrix }}
24+
25+
# Primary OS/Python for single-runner jobs (benchmark, coverage, etc.)
26+
primary-os:
27+
description: "Primary OS for single-runner jobs"
28+
value: ${{ jobs.config.outputs.primary-os }}
29+
30+
primary-python:
31+
description: "Primary Python version for single-runner jobs"
32+
value: ${{ jobs.config.outputs.primary-python }}
33+
34+
# Job toggles
35+
enable-tests:
36+
description: "Enable test job"
37+
value: ${{ jobs.config.outputs.enable-tests }}
38+
39+
enable-benchmark:
40+
description: "Enable benchmark job"
41+
value: ${{ jobs.config.outputs.enable-benchmark }}
42+
43+
jobs:
44+
config:
45+
runs-on: ubuntu-latest
46+
outputs:
47+
os-matrix: ${{ steps.set-config.outputs.os-matrix }}
48+
python-matrix: ${{ steps.set-config.outputs.python-matrix }}
49+
primary-os: ${{ steps.set-config.outputs.primary-os }}
50+
primary-python: ${{ steps.set-config.outputs.primary-python }}
51+
enable-tests: ${{ steps.set-config.outputs.enable-tests }}
52+
enable-benchmark: ${{ steps.set-config.outputs.enable-benchmark }}
53+
54+
steps:
55+
- id: set-config
56+
run: |
57+
# ============================================================
58+
# CONFIGURATION - Edit this section
59+
# ============================================================
60+
61+
# Operating Systems to test
62+
# Comment out any OS you want to skip during development
63+
OS_MATRIX='[
64+
"windows-latest", "ubuntu-latest", "macos-latest"
65+
]'
66+
# OS options: "windows-latest", "ubuntu-latest", "macos-latest"
67+
68+
# Python versions to test
69+
# Comment out any version you want to skip during development
70+
PYTHON_MATRIX='[
71+
"3.9", "3.10", "3.11", "3.12"
72+
]'
73+
# Python versions: "3.9", "3.10", "3.11", "3.12"
74+
75+
# Primary OS and Python for single-runner jobs
76+
PRIMARY_OS="ubuntu-latest"
77+
PRIMARY_PYTHON="3.11"
78+
79+
# Enable/Disable Jobs
80+
# Set to "true" or "false"
81+
ENABLE_TESTS="true"
82+
ENABLE_BENCHMARK="false"
83+
84+
# ============================================================
85+
# END CONFIGURATION
86+
# ============================================================
87+
88+
# Compact JSON (remove newlines and extra spaces)
89+
OS_MATRIX_COMPACT=$(echo "$OS_MATRIX" | jq -c .)
90+
PYTHON_MATRIX_COMPACT=$(echo "$PYTHON_MATRIX" | jq -c .)
91+
92+
echo "os-matrix=$OS_MATRIX_COMPACT" >> $GITHUB_OUTPUT
93+
echo "python-matrix=$PYTHON_MATRIX_COMPACT" >> $GITHUB_OUTPUT
94+
echo "primary-os=$PRIMARY_OS" >> $GITHUB_OUTPUT
95+
echo "primary-python=$PRIMARY_PYTHON" >> $GITHUB_OUTPUT
96+
echo "enable-tests=$ENABLE_TESTS" >> $GITHUB_OUTPUT
97+
echo "enable-benchmark=$ENABLE_BENCHMARK" >> $GITHUB_OUTPUT
98+
99+
echo "✓ Configuration loaded:"
100+
echo " OS: $OS_MATRIX_COMPACT"
101+
echo " Python: $PYTHON_MATRIX_COMPACT"
102+
echo " Primary: $PRIMARY_OS / $PRIMARY_PYTHON"
103+
echo " Tests: $ENABLE_TESTS"
104+
echo " Benchmark: $ENABLE_BENCHMARK"

0 commit comments

Comments
 (0)