Skip to content

Commit 0c1a433

Browse files
committed
feat: Add CI/CD and release workflows
- Add build.yml for continuous integration on all platforms - Add release.yml for automated releases on tags - Use pip for pybind11 instead of vcpkg
1 parent ffe56d4 commit 0c1a433

File tree

2 files changed

+176
-0
lines changed

2 files changed

+176
-0
lines changed

.github/workflows/build.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches: ["**"]
6+
pull_request:
7+
branches: ["**"]
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: ci-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
build:
16+
name: Build (${{ matrix.os }})
17+
runs-on: ${{ matrix.runner }}
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
include:
22+
- os: Linux
23+
runner: ubuntu-latest
24+
- os: macOS
25+
runner: macos-latest
26+
- os: Windows
27+
runner: windows-latest
28+
env:
29+
IDASDK: ${{ github.workspace }}/ida-sdk/src
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
34+
- name: Setup Python
35+
uses: actions/setup-python@v5
36+
with:
37+
python-version: '3.12'
38+
39+
- name: Install pybind11
40+
run: pip install pybind11
41+
42+
- name: Setup IDA SDK
43+
shell: bash
44+
run: |
45+
git clone --depth 1 https://github.com/HexRaysSA/ida-sdk ida-sdk
46+
git clone --depth 1 https://github.com/allthingsida/ida-cmake.git "${IDASDK}/ida-cmake"
47+
48+
- name: Configure
49+
shell: bash
50+
run: |
51+
cmake -B build -DCMAKE_BUILD_TYPE=Release \
52+
-Dpybind11_DIR="$(python -c 'import pybind11; print(pybind11.get_cmake_dir())')"
53+
54+
- name: Build
55+
shell: bash
56+
run: cmake --build build --config Release

.github/workflows/release.yml

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: 'Release tag (e.g., v1.0.0)'
11+
required: true
12+
13+
jobs:
14+
build:
15+
name: Build (${{ matrix.os }})
16+
runs-on: ${{ matrix.runner }}
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
include:
21+
- os: linux
22+
runner: ubuntu-latest
23+
artifact_ext: so
24+
platform: linux-x86_64
25+
- os: macos
26+
runner: macos-latest
27+
artifact_ext: dylib
28+
platform: macos-aarch64
29+
- os: windows
30+
runner: windows-latest
31+
artifact_ext: dll
32+
platform: windows-x86_64
33+
env:
34+
IDASDK: ${{ github.workspace }}/ida-sdk/src
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
39+
- name: Setup Python
40+
uses: actions/setup-python@v5
41+
with:
42+
python-version: '3.12'
43+
44+
- name: Install pybind11
45+
run: pip install pybind11
46+
47+
- name: Setup IDA SDK
48+
shell: bash
49+
run: |
50+
git clone --depth 1 https://github.com/HexRaysSA/ida-sdk ida-sdk
51+
git clone --depth 1 https://github.com/allthingsida/ida-cmake.git "${IDASDK}/ida-cmake"
52+
53+
- name: Configure
54+
shell: bash
55+
run: |
56+
cmake -B build -DCMAKE_BUILD_TYPE=Release \
57+
-Dpybind11_DIR="$(python -c 'import pybind11; print(pybind11.get_cmake_dir())')"
58+
59+
- name: Build
60+
shell: bash
61+
run: cmake --build build --config Release
62+
63+
- name: Package
64+
shell: bash
65+
run: |
66+
mkdir -p dist
67+
# Copy plugin
68+
find "${IDASDK}/bin/plugins" -name "python_ext.${{ matrix.artifact_ext }}" -exec cp {} dist/ \; 2>/dev/null || \
69+
find build -name "python_ext.${{ matrix.artifact_ext }}" -exec cp {} dist/ \;
70+
# Copy Python module
71+
[ -f mymodule.py ] && cp mymodule.py dist/
72+
# Copy docs
73+
[ -f README.md ] && cp README.md dist/
74+
75+
- name: Create archive
76+
shell: bash
77+
run: |
78+
cd dist
79+
if [ "${{ matrix.os }}" = "windows" ]; then
80+
7z a ../python_ext-${{ matrix.platform }}.zip *
81+
else
82+
zip -r ../python_ext-${{ matrix.platform }}.zip *
83+
fi
84+
85+
- name: Upload artifact
86+
uses: actions/upload-artifact@v4
87+
with:
88+
name: python_ext-${{ matrix.platform }}
89+
path: python_ext-${{ matrix.platform }}.zip
90+
91+
release:
92+
name: Create Release
93+
needs: build
94+
runs-on: ubuntu-latest
95+
permissions:
96+
contents: write
97+
steps:
98+
- name: Download artifacts
99+
uses: actions/download-artifact@v4
100+
with:
101+
path: artifacts
102+
103+
- name: Get tag
104+
id: tag
105+
run: |
106+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
107+
echo "tag=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
108+
else
109+
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
110+
fi
111+
112+
- name: Create Release
113+
uses: softprops/action-gh-release@v2
114+
with:
115+
tag_name: ${{ steps.tag.outputs.tag }}
116+
name: Release ${{ steps.tag.outputs.tag }}
117+
draft: false
118+
prerelease: false
119+
files: artifacts/**/*.zip
120+
generate_release_notes: true

0 commit comments

Comments
 (0)