Skip to content

Commit 1dc8779

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 - Uses vcpkg for pybind11 dependency
1 parent ffe56d4 commit 1dc8779

File tree

2 files changed

+185
-0
lines changed

2 files changed

+185
-0
lines changed

.github/workflows/build.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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+
VCPKG_DEFAULT_TRIPLET: ${{ matrix.os == 'Windows' && 'x64-windows' || matrix.os == 'macOS' && 'arm64-osx' || 'x64-linux' }}
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
35+
- name: Setup Python
36+
uses: actions/setup-python@v5
37+
with:
38+
python-version: '3.12'
39+
40+
- name: Setup vcpkg
41+
uses: lukka/run-vcpkg@v11
42+
with:
43+
vcpkgGitCommitId: '01f602195983451bc83e72f4214af2cbc495aa94'
44+
45+
- name: Setup IDA SDK
46+
shell: bash
47+
run: |
48+
git clone --depth 1 https://github.com/HexRaysSA/ida-sdk ida-sdk
49+
git clone --depth 1 https://github.com/allthingsida/ida-cmake.git "${IDASDK}/ida-cmake"
50+
51+
- name: Configure
52+
shell: bash
53+
run: |
54+
cmake -B build -DCMAKE_BUILD_TYPE=Release \
55+
-DCMAKE_TOOLCHAIN_FILE="${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
56+
57+
- name: Build
58+
shell: bash
59+
run: cmake --build build --config Release

.github/workflows/release.yml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
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+
vcpkg_triplet: x64-linux
26+
- os: macos
27+
runner: macos-latest
28+
artifact_ext: dylib
29+
platform: macos-aarch64
30+
vcpkg_triplet: arm64-osx
31+
- os: windows
32+
runner: windows-latest
33+
artifact_ext: dll
34+
platform: windows-x86_64
35+
vcpkg_triplet: x64-windows
36+
env:
37+
IDASDK: ${{ github.workspace }}/ida-sdk/src
38+
VCPKG_DEFAULT_TRIPLET: ${{ matrix.vcpkg_triplet }}
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@v4
42+
43+
- name: Setup Python
44+
uses: actions/setup-python@v5
45+
with:
46+
python-version: '3.12'
47+
48+
- name: Setup vcpkg
49+
uses: lukka/run-vcpkg@v11
50+
with:
51+
vcpkgGitCommitId: '01f602195983451bc83e72f4214af2cbc495aa94'
52+
53+
- name: Setup IDA SDK
54+
shell: bash
55+
run: |
56+
git clone --depth 1 https://github.com/HexRaysSA/ida-sdk ida-sdk
57+
git clone --depth 1 https://github.com/allthingsida/ida-cmake.git "${IDASDK}/ida-cmake"
58+
59+
- name: Configure
60+
shell: bash
61+
run: |
62+
cmake -B build -DCMAKE_BUILD_TYPE=Release \
63+
-DCMAKE_TOOLCHAIN_FILE="${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
64+
65+
- name: Build
66+
shell: bash
67+
run: cmake --build build --config Release
68+
69+
- name: Package
70+
shell: bash
71+
run: |
72+
mkdir -p dist
73+
# Copy plugin
74+
find "${IDASDK}/bin/plugins" -name "python_ext.${{ matrix.artifact_ext }}" -exec cp {} dist/ \; 2>/dev/null || \
75+
find build -name "python_ext.${{ matrix.artifact_ext }}" -exec cp {} dist/ \;
76+
# Copy Python module
77+
[ -f mymodule.py ] && cp mymodule.py dist/
78+
# Copy docs
79+
[ -f README.md ] && cp README.md dist/
80+
81+
- name: Create archive
82+
shell: bash
83+
run: |
84+
cd dist
85+
if [ "${{ matrix.os }}" = "windows" ]; then
86+
7z a ../python_ext-${{ matrix.platform }}.zip *
87+
else
88+
zip -r ../python_ext-${{ matrix.platform }}.zip *
89+
fi
90+
91+
- name: Upload artifact
92+
uses: actions/upload-artifact@v4
93+
with:
94+
name: python_ext-${{ matrix.platform }}
95+
path: python_ext-${{ matrix.platform }}.zip
96+
97+
release:
98+
name: Create Release
99+
needs: build
100+
runs-on: ubuntu-latest
101+
permissions:
102+
contents: write
103+
steps:
104+
- name: Download artifacts
105+
uses: actions/download-artifact@v4
106+
with:
107+
path: artifacts
108+
109+
- name: Get tag
110+
id: tag
111+
run: |
112+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
113+
echo "tag=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
114+
else
115+
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
116+
fi
117+
118+
- name: Create Release
119+
uses: softprops/action-gh-release@v2
120+
with:
121+
tag_name: ${{ steps.tag.outputs.tag }}
122+
name: Release ${{ steps.tag.outputs.tag }}
123+
draft: false
124+
prerelease: false
125+
files: artifacts/**/*.zip
126+
generate_release_notes: true

0 commit comments

Comments
 (0)