Skip to content

Commit d864f0d

Browse files
committed
bugfix: build fix for linux
1 parent 3907754 commit d864f0d

File tree

3 files changed

+384
-11
lines changed

3 files changed

+384
-11
lines changed

.github/workflows/ci.yml

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
#
2+
# Master CI/CD Pipeline
3+
#
4+
# This workflow orchestrates all CI/CD jobs. Comment out any jobs you want to skip during development.
5+
# OS and Python version configuration is centralized in config.yml.
6+
#
7+
8+
name: CI/CD
9+
10+
on:
11+
push:
12+
branches: [main, develop]
13+
pull_request:
14+
branches: [main, develop]
15+
workflow_dispatch: # Allow manual triggering
16+
17+
jobs:
18+
# ============================================================
19+
# Load Configuration
20+
# ============================================================
21+
load-config:
22+
uses: ./.github/workflows/config.yml
23+
24+
# ============================================================
25+
# Pipeline Jobs - Comment out any you want to skip
26+
# ============================================================
27+
28+
# Job 1: Run tests across all OS/Python combinations
29+
test:
30+
name: Test (${{ matrix.os }}, Python ${{ matrix.python-version }})
31+
needs: load-config
32+
runs-on: ${{ matrix.os }}
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
os: ${{ fromJSON(needs.load-config.outputs.os-matrix) }}
37+
python-version: ${{ fromJSON(needs.load-config.outputs.python-matrix) }}
38+
39+
steps:
40+
- uses: actions/checkout@v4
41+
with:
42+
submodules: recursive
43+
44+
- name: Set up Python
45+
uses: actions/setup-python@v5
46+
with:
47+
python-version: ${{ matrix.python-version }}
48+
cache: 'pip'
49+
50+
- name: Install system dependencies (Linux)
51+
if: runner.os == 'Linux'
52+
run: |
53+
sudo apt-get update
54+
sudo apt-get install -y cmake ninja-build libssl-dev pkg-config autoconf automake libtool
55+
56+
- name: Install system dependencies (macOS)
57+
if: runner.os == 'macOS'
58+
run: brew install cmake ninja openssl@3 libnghttp2
59+
60+
- name: Install system dependencies (Windows)
61+
if: runner.os == 'Windows'
62+
run: choco install cmake -y
63+
64+
- name: Setup MSVC (Windows)
65+
if: runner.os == 'Windows'
66+
uses: microsoft/setup-msbuild@v2
67+
68+
- name: Setup vendor dependencies
69+
run: |
70+
chmod +x scripts/setup_vendors.sh
71+
./scripts/setup_vendors.sh
72+
shell: bash
73+
74+
- name: Install package
75+
run: pip install -e ".[dev]"
76+
77+
- name: Lint
78+
run: ruff check src/ tests/
79+
80+
- name: Run tests
81+
run: pytest tests/ -v --cov=httpmorph --cov-report=xml
82+
83+
- name: Upload coverage
84+
if: matrix.os == needs.load-config.outputs.primary-os && matrix.python-version == needs.load-config.outputs.primary-python
85+
uses: codecov/codecov-action@v4
86+
with:
87+
file: ./coverage.xml
88+
89+
# Job 2: Run benchmarks (comment out to skip)
90+
# benchmark:
91+
# name: Benchmark
92+
# needs: [load-config, test]
93+
# runs-on: ${{ needs.load-config.outputs.primary-os }}
94+
95+
# steps:
96+
# - uses: actions/checkout@v4
97+
98+
# - name: Set up Python
99+
# uses: actions/setup-python@v5
100+
# with:
101+
# python-version: ${{ needs.load-config.outputs.primary-python }}
102+
# cache: 'pip'
103+
104+
# - name: Install dependencies
105+
# run: |
106+
# sudo apt-get update && sudo apt-get install -y cmake ninja-build libssl-dev
107+
# chmod +x scripts/setup_vendors.sh
108+
# ./scripts/setup_vendors.sh
109+
# pip install -e ".[dev,benchmark]"
110+
111+
# - name: Run benchmarks
112+
# run: pytest benchmarks/ --benchmark-only --benchmark-json=benchmark.json
113+
114+
# - name: Store benchmark
115+
# uses: benchmark-action/github-action-benchmark@v1
116+
# with:
117+
# tool: 'pytest'
118+
# output-file-path: benchmark.json
119+
# github-token: ${{ secrets.GITHUB_TOKEN }}
120+
# auto-push: true
121+
122+
# Job 3: Type checking (comment out to skip)
123+
# typecheck:
124+
# name: Type Check
125+
# needs: load-config
126+
# runs-on: ${{ needs.load-config.outputs.primary-os }}
127+
#
128+
# steps:
129+
# - uses: actions/checkout@v4
130+
#
131+
# - name: Set up Python
132+
# uses: actions/setup-python@v5
133+
# with:
134+
# python-version: ${{ needs.load-config.outputs.primary-python }}
135+
# cache: 'pip'
136+
#
137+
# - name: Install package
138+
# run: pip install -e ".[dev]"
139+
#
140+
# - name: Run mypy
141+
# run: mypy src/
142+
143+
# Job 4: Security scanning (comment out to skip)
144+
# security:
145+
# name: Security Scan
146+
# needs: load-config
147+
# runs-on: ${{ needs.load-config.outputs.primary-os }}
148+
#
149+
# steps:
150+
# - uses: actions/checkout@v4
151+
#
152+
# - name: Set up Python
153+
# uses: actions/setup-python@v5
154+
# with:
155+
# python-version: ${{ needs.load-config.outputs.primary-python }}
156+
#
157+
# - name: Run bandit
158+
# run: |
159+
# pip install bandit
160+
# bandit -r src/ -f json -o bandit-report.json
161+
#
162+
# - name: Upload security report
163+
# uses: actions/upload-artifact@v4
164+
# with:
165+
# name: security-report
166+
# path: bandit-report.json
167+
168+
# ============================================================
169+
# Status Check - All jobs must pass
170+
# ============================================================
171+
all-checks-passed:
172+
name: All Checks Passed
173+
needs: [test] # Add other job dependencies here when uncommented
174+
runs-on: ubuntu-latest
175+
if: always()
176+
177+
steps:
178+
- name: Check all jobs succeeded
179+
run: |
180+
if [ "${{ needs.test.result }}" != "success" ]; then
181+
echo "❌ Tests failed"
182+
exit 1
183+
fi
184+
# Uncomment when benchmark job is enabled
185+
# if [ "${{ needs.benchmark.result }}" != "success" ]; then
186+
# echo "❌ Benchmarks failed"
187+
# exit 1
188+
# fi
189+
echo "✅ All checks passed!"

.github/workflows/config.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
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+
jobs:
35+
config:
36+
runs-on: ubuntu-latest
37+
outputs:
38+
os-matrix: ${{ steps.set-config.outputs.os-matrix }}
39+
python-matrix: ${{ steps.set-config.outputs.python-matrix }}
40+
primary-os: ${{ steps.set-config.outputs.primary-os }}
41+
primary-python: ${{ steps.set-config.outputs.primary-python }}
42+
43+
steps:
44+
- id: set-config
45+
run: |
46+
# ============================================================
47+
# CONFIGURATION - Edit this section
48+
# ============================================================
49+
50+
# Operating Systems to test
51+
# Comment out any OS you want to skip during development
52+
OS_MATRIX='[
53+
"ubuntu-latest",
54+
# "macos-latest",
55+
# "windows-latest"
56+
]'
57+
58+
# Python versions to test
59+
# Comment out any version you want to skip during development
60+
PYTHON_MATRIX='[
61+
# "3.9",
62+
# "3.10",
63+
"3.11"
64+
# "3.12"
65+
]'
66+
67+
# Primary OS and Python for single-runner jobs
68+
PRIMARY_OS="ubuntu-latest"
69+
PRIMARY_PYTHON="3.11"
70+
71+
# ============================================================
72+
# END CONFIGURATION
73+
# ============================================================
74+
75+
# Compact JSON (remove newlines and extra spaces)
76+
OS_MATRIX_COMPACT=$(echo "$OS_MATRIX" | jq -c .)
77+
PYTHON_MATRIX_COMPACT=$(echo "$PYTHON_MATRIX" | jq -c .)
78+
79+
echo "os-matrix=$OS_MATRIX_COMPACT" >> $GITHUB_OUTPUT
80+
echo "python-matrix=$PYTHON_MATRIX_COMPACT" >> $GITHUB_OUTPUT
81+
echo "primary-os=$PRIMARY_OS" >> $GITHUB_OUTPUT
82+
echo "primary-python=$PRIMARY_PYTHON" >> $GITHUB_OUTPUT
83+
84+
echo "✓ Configuration loaded:"
85+
echo " OS: $OS_MATRIX_COMPACT"
86+
echo " Python: $PYTHON_MATRIX_COMPACT"
87+
echo " Primary: $PRIMARY_OS / $PRIMARY_PYTHON"

0 commit comments

Comments
 (0)