-
Notifications
You must be signed in to change notification settings - Fork 8
215 lines (183 loc) · 7.42 KB
/
release.yml
File metadata and controls
215 lines (183 loc) · 7.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
name: svf-python-build
on:
workflow_dispatch:
inputs:
triggered_by:
description: 'Repository that triggered this workflow'
required: false
default: 'manual'
push:
branches:
- main
jobs:
calculate-version:
name: Calculate Next Version
runs-on: ubuntu-latest
outputs:
next_version: ${{ steps.get_next_version.outputs.next_version }}
steps:
- name: Install jq
run: sudo apt-get update && sudo apt-get install -y jq
- name: Get next version from PyPI
id: get_next_version
run: |
PACKAGE="pysvf"
INDEX_URL="https://pypi.org/pypi/$PACKAGE/json"
echo "Querying $INDEX_URL ..."
VERSIONS=$(curl -s "$INDEX_URL" | jq -r '.releases | keys[]' | grep -E '^1\.0\.0\.[0-9]+$' || true)
if [ -z "$VERSIONS" ]; then
NEXT_VERSION="1.0.0.0"
else
LAST_VERSION=$(echo "$VERSIONS" | sort -V | tail -n 1)
echo "Last version: $LAST_VERSION"
NEXT_VERSION=$(echo "$LAST_VERSION" | awk -F. '{$NF+=1; print $1 "." $2 "." $3 "." $4}')
fi
echo "Next version: $NEXT_VERSION"
echo "next_version=$NEXT_VERSION" >> $GITHUB_OUTPUT
stubtest:
needs: calculate-version
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
python-version: ['3.9']
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install system dependencies
run: |
# Avoid ppa:ubuntu-toolchain-r/test — Launchpad's PPA infrastructure
# has been intermittently unreachable from CI runners (HTTP 504 from
# add-apt-repository), and ubuntu-24.04's default gcc-13 is sufficient.
sudo apt-get update
sudo apt-get install -y \
cmake gcc g++ nodejs doxygen graphviz lcov libncurses5-dev libtinfo6 libzstd-dev \
python3 python3-pip python3-venv patchelf
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install svf-lib and set environment variables
run: |
npm install svf-lib
echo "SVF_DIR=$PWD/node_modules/svf-lib/SVF-linux-x86_64" >> $GITHUB_ENV
echo "LLVM_DIR=$PWD/node_modules/llvm-21.1.0.obj" >> $GITHUB_ENV
echo "Z3_DIR=$PWD/node_modules/z3.obj" >> $GITHUB_ENV
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install build wheel setuptools mypy typing-extensions pybind11
- name: Get system architecture
id: get_arch
run: |
ARCH=$(uname -m)
echo "ARCH=$ARCH" >> $GITHUB_ENV
echo "arch=$ARCH" >> $GITHUB_OUTPUT
- name: Clone and Build SVF-Python for stubtest
run: |
git clone https://github.com/SVF-tools/SVF-Python.git
cd SVF-Python
rm -rf build dist pysvf.egg-info
export PYBIND11_DIR=$(python3 -m pybind11 --cmakedir)
export CMAKE_BUILD_TYPE=Release
sed -i.bak "s/version=.*,/version='0.0.0.dev0',/" setup.py
SVF_DIR=${SVF_DIR} LLVM_DIR=${LLVM_DIR} Z3_DIR=${Z3_DIR} PYBIND11_DIR=${PYBIND11_DIR} \
python3 -m build --wheel
pip install dist/*.whl
- name: Run stubtest
run: |
cd SVF-Python
MYPYPATH=./pysvf stubtest pysvf --allowlist ../stubtest_allowlist.txt
build:
needs: [calculate-version, stubtest]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, macos-14, ubuntu-22.04-arm]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: macOS Setup
if: runner.os == 'macOS'
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.3.0'
- name: macOS Workaround
if: runner.os == 'macOS'
run: |
ln -sfn /Applications/Xcode_15.3.0.app /Applications/Xcode.app
- name: Linux Setup
if: runner.os == 'Linux'
run: |
# Avoid ppa:ubuntu-toolchain-r/test — Launchpad's PPA infrastructure
# has been intermittently unreachable from CI runners (HTTP 504 from
# add-apt-repository), and ubuntu-24.04's default gcc-13 is sufficient.
sudo apt-get update
sudo apt-get install -y \
cmake gcc g++ nodejs doxygen graphviz lcov libncurses5-dev libtinfo6 libzstd-dev \
python3 python3-pip python3-venv patchelf
- name: Install svf-lib and set environment variables
run: |
npm install svf-lib
if [[ "$RUNNER_OS" == "Linux" ]]; then
if [[ "$(uname -m)" == "x86_64" ]]; then
echo "SVF_DIR=$PWD/node_modules/svf-lib/SVF-linux-x86_64" >> $GITHUB_ENV
elif [[ "$(uname -m)" == "aarch64" ]]; then
echo "SVF_DIR=$PWD/node_modules/svf-lib/SVF-linux-aarch64" >> $GITHUB_ENV
fi
elif [[ "$RUNNER_OS" == "macOS" ]]; then
echo "SVF_DIR=$PWD/node_modules/svf-lib/SVF-osx" >> $GITHUB_ENV
fi
echo "LLVM_DIR=$PWD/node_modules/llvm-21.1.0.obj" >> $GITHUB_ENV
echo "Z3_DIR=$PWD/node_modules/z3.obj" >> $GITHUB_ENV
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install build wheel twine pybind11 auditwheel setuptools
- name: Get system architecture
id: get_arch
run: |
ARCH=$(uname -m)
echo "ARCH=$ARCH" >> $GITHUB_ENV
echo "arch=$ARCH" >> $GITHUB_OUTPUT
- name: Clone and Build SVF-Python
run: |
git clone https://github.com/SVF-tools/SVF-Python.git
cd SVF-Python
rm -rf build dist pysvf.egg-info
export PYBIND11_DIR=$(python3 -m pybind11 --cmakedir)
export CMAKE_BUILD_TYPE=Release
echo "Building with version: ${{ needs.calculate-version.outputs.next_version }}"
sed -i.bak "s/version=.*,/version='${{ needs.calculate-version.outputs.next_version }}',/" setup.py
PYTHON_EXEC=${PYTHON_EXEC:-python3}
if [[ "$(uname)" == "Darwin" ]]; then
SVF_DIR=${SVF_DIR} LLVM_DIR=${LLVM_DIR} Z3_DIR=${Z3_DIR} PYBIND11_DIR=${PYBIND11_DIR} \
${PYTHON_EXEC} setup.py bdist_wheel --plat-name macosx-11.0-arm64
else
SVF_DIR=${SVF_DIR} LLVM_DIR=${LLVM_DIR} Z3_DIR=${Z3_DIR} PYBIND11_DIR=${PYBIND11_DIR} \
${PYTHON_EXEC} setup.py bdist_wheel --plat-name manylinux2014_$(uname -m)
fi
echo "Built wheel files:"
ls -lh dist/
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
cd SVF-Python
twine upload dist/* --verbose
- name: Upload Python wheels
uses: actions/upload-artifact@v4
with:
name: python-wheels-${{ needs.calculate-version.outputs.next_version }}-${{ runner.os }}-${{ steps.get_arch.outputs.arch }}-py${{ matrix.python-version }}
path: SVF-Python/dist/