-
Notifications
You must be signed in to change notification settings - Fork 2
175 lines (152 loc) · 4.92 KB
/
Copy pathbuild-release.yml
File metadata and controls
175 lines (152 loc) · 4.92 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
name: Build Release
on:
workflow_dispatch:
jobs:
create-release:
runs-on: ubuntu-slim
outputs:
version: ${{ steps.get-version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
# fetch full history + tags
fetch-depth: 0
- name: Get version
id: get-version
run: |
VERSION=$(ci/git_version.sh | xargs)
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Create release
env:
GH_TOKEN: ${{ github.token }}
VERSION: ${{ steps.get-version.outputs.version }}
run: |
gh release create ${VERSION} \
--draft \
--title "mrbind ${VERSION}"
build-linux:
needs:
- create-release
runs-on: ${{ matrix.runner }}
container:
image: almalinux:8
strategy:
fail-fast: false
matrix:
arch: [x64, arm64]
include:
- arch: x64
runner: ubuntu-24.04
- arch: arm64
runner: ubuntu-24.04-arm
steps:
- name: Install tools
run: |
dnf install -y epel-release
dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo
dnf install -y --enablerepo powertools \
gcc-toolset-14 cmake ninja-build \
$(: CI requirements ) \
git gh unzip zip \
$(: test requirements ) \
gcc-c++ findutils python38-devel
- name: Checkout
uses: actions/checkout@v6
with:
submodules: true
- name: Fix git permissions
run: |
git config --global --add safe.directory '*'
- name: Download and unpack LLVM
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release download llvm-22.1.8 --pattern "llvm-linux-$(uname -m).zip"
unzip "llvm-linux-$(uname -m).zip"
rm "llvm-linux-$(uname -m).zip"
- name: Build
run: |
source /opt/rh/gcc-toolset-14/enable
cmake -B build -G Ninja \
-D Clang_DIR=llvm/lib/cmake/clang \
-D CMAKE_BUILD_TYPE=Release \
-D MRBIND_STATIC_BUILD=ON \
-D CMAKE_CXX_FLAGS="-ffunction-sections -fdata-sections" \
-D CMAKE_EXE_LINKER_FLAGS="-Wl,--gc-sections -Wl,-s"
cmake --build build --parallel $(nproc)
- name: Verify binaries
run: |
ls -l build/mrbind*
ldd build/mrbind*
- name: Test
run: |
export CLANG_RESOURCE_DIR="$(pwd)/llvm/lib/clang/22"
source /opt/rh/gcc-toolset-14/enable
echo g++ > examples/cxx.txt
examples/c/run.sh
PYTHON=python3.8 examples/python/run.sh
- name: Create package
run: |
mkdir mrbind
mv build/mrbind{,_gen_c,_gen_csharp} mrbind/
mv llvm/lib/clang/22 mrbind/resource-dir
zip -r mrbind-linux-$(uname -m).zip mrbind/
- name: Upload package
env:
GH_TOKEN: ${{ github.token }}
VERSION: ${{ needs.create-release.outputs.version }}
run: |
gh release upload ${VERSION} mrbind-linux-$(uname -m).zip --clobber
build-macos:
needs:
- create-release
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
arch: [arm64, x64]
include:
- arch: arm64
runner: macos-15
- arch: x64
runner: macos-15-intel
steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: true
- name: Build
run: |
export PATH="$(brew --prefix llvm@18)/bin:$PATH"
cmake -B build -G Ninja \
-D Clang_DIR=$(brew --prefix llvm@18)/lib/cmake/clang \
-D CMAKE_BUILD_TYPE=Release \
-D MRBIND_STATIC_BUILD=ON \
-D MRBIND_FORCE_LLVM_STATIC=ON \
-D CMAKE_PREFIX_PATH=$(brew --prefix zstd) \
-D CMAKE_OSX_DEPLOYMENT_TARGET=12.0
cmake --build build --parallel $(sysctl -n hw.logicalcpu)
- name: Verify build
run: |
ls -l build/mrbind*
otool -L build/mrbind*
ls -1 build/mrbind* | xargs -n1 vtool -show-build
- name: Test
run: |
export CLANG_RESOURCE_DIR=$(brew --prefix llvm@18)/lib/clang/18
echo clang++ > examples/cxx.txt
examples/c/run.sh
PYTHON=python3.11 examples/python/run.sh
- name: Create package
run: |
mkdir mrbind
mv build/mrbind{,_gen_c,_gen_csharp} mrbind/
cp -R $(brew --prefix llvm@18)/lib/clang/18 mrbind/resource-dir
zip -r mrbind-macos-$(uname -m).zip mrbind/
- name: Upload package
env:
GH_TOKEN: ${{ github.token }}
VERSION: ${{ needs.create-release.outputs.version }}
run: |
gh release upload ${VERSION} mrbind-macos-$(uname -m).zip --clobber