-
Notifications
You must be signed in to change notification settings - Fork 11
260 lines (231 loc) · 9.65 KB
/
vcpkg_ci_mac.yml
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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
name: MacOS Continuous Integration
env:
# "Source" is set in the setup-dotnet action
VCPKG_BINARY_SOURCES: 'clear;nuget,Source,readwrite;nugettimeout,3601'
VCPKG_DEFAULT_HOST_TRIPLET: 'x64-osx-rel'
on:
release:
types:
- published
pull_request:
paths-ignore:
- 'docker/**'
- '.github/**'
- '**.md'
- '!.github/workflows/vcpkg_ci_mac.yml'
push:
paths-ignore:
- 'docker/**'
- '.github/**'
- '**.md'
- '!.github/workflows/vcpkg_ci_mac.yml'
tags-ignore:
- 'v*'
branches:
- 'master'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: false
matrix:
os:
- { runner: 'macos-13', xcode: '15.0' }
llvm: [
'llvm-16',
'llvm-17',
'llvm-17[liftingbits-llvm]'
]
target_arch: [ 'x64', 'arm64' ]
runs-on: ${{ matrix.os.runner }}
steps:
- name: Set Artifact Name
run: |
# Need to fix because paths with brackets cause issues
NAME="$(echo 'vcpkg_${{ matrix.os.runner }}_${{ matrix.llvm }}_xcode-${{ matrix.os.xcode }}_${{ matrix.target_arch == 'x64' && 'amd64' || matrix.target_arch }}' | tr '[' '-' | tr -d ']')"
echo "ARTIFACT_NAME=${NAME}" >> "$GITHUB_ENV"
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 2
# Used to get commit message since PRs are on a merge commit
- name: Get commit message
run: |
echo 'COMMIT_MESSAGE<<EOF' >> "$GITHUB_ENV"
if [[ '${{ github.event_name }}' == 'push' ]]; then
echo "$(git log --format=%B -n 1 HEAD)" >> "$GITHUB_ENV"
elif [[ '${{ github.event_name }}' == 'pull_request' ]]; then
echo "$(git log --format=%B -n 1 HEAD^2)" >> "$GITHUB_ENV"
fi
echo "EOF" >> "$GITHUB_ENV"
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '3.1.x' # SDK Version to use.
# Sets as "Source"
source-url: https://nuget.pkg.github.com/lifting-bits/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Select the XCode version
run: |
echo "Selecting XCode Version ${{ matrix.os.xcode }}"
sudo xcode-select -s /Applications/Xcode_${{ matrix.os.xcode }}.app/Contents/Developer
- name: Initialize vcpkg
shell: bash
run: |
{ read -r vcpkg_repo_url && read -r vcpkg_commit; } <./vcpkg_info.txt || exit 1
git clone "${vcpkg_repo_url}"
git -C vcpkg checkout "${vcpkg_commit}"
export VCPKG_DISABLE_METRICS=1
./vcpkg/bootstrap-vcpkg.sh
echo "VCPKG_ROOT=$(pwd)/vcpkg" >> $GITHUB_ENV
- name: 'vcpkg install dependencies'
shell: 'bash'
run: |
export VCPKG_DISABLE_METRICS=1
brew install bash ninja
# Setup NuGet authentication
mono "$(${VCPKG_ROOT}/vcpkg fetch nuget | tail -n 1)" setapikey \
-source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \
"${{ secrets.GITHUB_TOKEN }}"
./build_dependencies.sh --release --target-arch ${{ matrix.target_arch }} --export-dir ./${{ env.ARTIFACT_NAME }} ${{ matrix.llvm }} --clean-after-build --debug
echo "VCPKG_ROOT=$(pwd)/${{ env.ARTIFACT_NAME }}" >> $GITHUB_ENV
echo "TARGET_TRIPLET=${{ matrix.target_arch }}-osx-rel" >> $GITHUB_ENV
- name: Upload CMake logs on error
if: failure()
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}_logs
path: ${{ github.workspace }}/vcpkg/buildtrees/**/*.log
- name: 'Adhoc codesign'
shell: 'bash'
run: |
find ./${{ env.ARTIFACT_NAME }} \( -path '**/bin/*' -or -path '**/libexec/*' -or -path '**/tools/*' \) -type f -perm +111 -exec codesign --force -s - \{\} \;
- name: 'Export Packages'
if: contains(env.COMMIT_MESSAGE, 'debug artifacts') || github.event.release
shell: 'bash'
run: |
brew install pixz
tar --use-compress-program pixz -cf "${{ env.ARTIFACT_NAME }}.tar.xz" ./${{ env.ARTIFACT_NAME }}
- name: Publish Release Assets
if: github.event.release
uses: softprops/action-gh-release@v2
with:
files: ${{ env.ARTIFACT_NAME }}.tar.xz
prerelease: ${{ contains(github.ref, 'pre') || contains(github.ref, 'rc') }}
token: ${{ secrets.RELEASE_TOKEN }}
- uses: actions/upload-artifact@v4
if: contains(env.COMMIT_MESSAGE, 'debug artifacts') || github.event.release
with:
name: ${{ env.ARTIFACT_NAME }}.tar.xz
path: ${{ env.ARTIFACT_NAME }}.tar.xz
- name: 'Install build dependencies'
shell: 'bash'
run: |
brew install ninja ccache
- name: Prepare ccache
id: ccache_prep
shell: bash
run: |
echo "CCACHE_COMPRESS=true" >> $GITHUB_ENV
echo "CCACHE_COMPILERCHECK=content" >> $GITHUB_ENV
echo "CCACHE_DIR=${{ github.workspace }}/.ccache" >> $GITHUB_ENV
echo "CMAKE_C_COMPILER_LAUNCHER=$(which ccache)" >> $GITHUB_ENV
echo "CMAKE_CXX_COMPILER_LAUNCHER=$(which ccache)" >> $GITHUB_ENV
echo "timestamp=$(python -c 'from datetime import datetime; print(datetime.utcnow().strftime("%Y-%m-%d-%H:%M:%S"))')" >> ${GITHUB_OUTPUT}
- name: ccache cache files
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.ccache
key: ccache-${{ matrix.os.runner }}-${{ matrix.os.xcode }}-${{ matrix.llvm }}-${{ matrix.target_arch }}-${{ steps.ccache_prep.outputs.timestamp }}
restore-keys: |
ccache-${{ matrix.os.runner }}-${{ matrix.os.xcode }}-${{ matrix.llvm }}-$${{ matrix.target_arch }}
- name: ccache Initial stats
shell: bash
run: |
ccache --show-stats
- name: 'Rellic build'
shell: 'bash'
working-directory: rellic
if: matrix.target_arch == 'x64' && startswith(matrix.llvm, 'llvm-16')
run: |
cmake -G Ninja \
-DCMAKE_VERBOSE_MAKEFILE=ON \
"-DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" \
-DVCPKG_TARGET_TRIPLET=${TARGET_TRIPLET} \
-DVCPKG_HOST_TRIPLET=${TARGET_TRIPLET} \
-DCMAKE_OSX_ARCHITECTURES=${{ matrix.target_arch == 'x64' && 'x86_64' || matrix.target_arch }} \
"-DCMAKE_INSTALL_PREFIX=$(pwd)/install" \
-S . -B build
cmake --build build
cmake --install build
- name: 'Rellic test'
shell: 'bash'
working-directory: rellic
if: matrix.target_arch == 'x64' && startswith(matrix.llvm, 'llvm-16')
run: |
cmake --build build --target test
- name: 'Remill dependencies'
shell: 'bash'
working-directory: remill
if: matrix.target_arch == 'x64' && startswith(matrix.llvm, 'llvm-16')
run: |
python3 -m pip install poetry
python3 -m pip install --user ./scripts/diff_tester_export_insns
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: 'Remill build'
shell: 'bash'
working-directory: remill
if: matrix.target_arch == 'x64' && startswith(matrix.llvm, 'llvm-16')
run: |
cmake -G Ninja \
-DCMAKE_VERBOSE_MAKEFILE=ON \
"-DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" \
-DVCPKG_TARGET_TRIPLET=${TARGET_TRIPLET} \
-DVCPKG_HOST_TRIPLET=${TARGET_TRIPLET} \
-DCMAKE_OSX_ARCHITECTURES=${{ matrix.target_arch == 'x64' && 'x86_64' || matrix.target_arch }} \
"-DCMAKE_INSTALL_PREFIX=$(pwd)/install" \
-S . -B build
cmake --build build
cmake --install build
cmake --build build --target test_dependencies
- name: 'Remill test'
shell: 'bash'
working-directory: remill/build
if: matrix.target_arch == 'x64' && startswith(matrix.llvm, 'llvm-16')
run: |
# Only run test on x64
env CTEST_OUTPUT_ON_FAILURE=1 ctest .
- name: 'Anvill build'
shell: 'bash'
working-directory: anvill
if: matrix.target_arch == 'x64' && startswith(matrix.llvm, 'llvm-16')
run: |
cmake -G Ninja \
-DCMAKE_VERBOSE_MAKEFILE=ON \
"-DCMAKE_INSTALL_PREFIX=$(pwd)/install" \
"-DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" \
-DVCPKG_TARGET_TRIPLET=${TARGET_TRIPLET} \
-DVCPKG_HOST_TRIPLET=${TARGET_TRIPLET} \
-DCMAKE_OSX_ARCHITECTURES=${{ matrix.target_arch == 'x64' && 'x86_64' || matrix.target_arch }} \
-DANVILL_ENABLE_TESTS=true \
-DANVILL_ENABLE_INSTALL=true \
-DANVILL_ENABLE_PYTHON3_LIBS=OFF \
"-Dremill_DIR=$(pwd)/../remill/install/lib/cmake/remill" \
"-Dsleigh_DIR=$(pwd)/../remill/install/lib/cmake/sleigh" \
-S . -B build
cmake --build build
cmake --install build
- name: 'Anvill test'
shell: 'bash'
working-directory: anvill
if: matrix.target_arch == 'x64' && startswith(matrix.llvm, 'llvm-16')
run: |
cmake --build build --target test
- name: Cache cleanup and reporting
shell: 'bash'
run: |
rm -rf vcpkg/{buildtrees,installed,packages}
ccache --show-stats