-
Notifications
You must be signed in to change notification settings - Fork 44
261 lines (221 loc) · 8.25 KB
/
ci.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
261
name: VCPKG Continuous Integration
on:
# Run this workflow once every 6 hours against the master branch
#schedule:
# - cron: "0 */6 * * *"
push:
branches:
- 'master'
tags:
- '*'
pull_request:
branches:
- '*'
env:
CC: clang
CXX: clang++
jobs:
build_linux:
strategy:
fail-fast: false
matrix:
image:
- { name: 'ubuntu', tag: '22.04' }
llvm: [
'16'
]
name: Rellic CI
runs-on: "gha-ubuntu-32"
container:
image: ghcr.io/lifting-bits/cxx-common/vcpkg-builder-${{ matrix.image.name }}-v2:${{ matrix.image.tag }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Adding github workspace as safe directory
# See issue https://github.com/actions/checkout/issues/760
run: git config --global --add safe.directory $GITHUB_WORKSPACE
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: true
- name: Install utility tools
shell: bash
run: |
# TODO some of these should probably live in the Docker build image
apt-get update
apt-get install -y ninja-build pixz xz-utils make rpm python3
- name: Build with build script
shell: bash
run: |
./scripts/build.sh --download-dir "$(pwd)/../pre-built-llvm-${{ matrix.llvm }}" --llvm-version ${{ matrix.llvm }}
cmake --build rellic-build --target install
- name: Tests
shell: bash
working-directory: rellic-build
run: |
# Test with CMake provided test
env CTEST_OUTPUT_ON_FAILURE=1 cmake --build . --target test
- name: Build with CMake Presets
shell: bash
run: |
export CMAKE_TOOLCHAIN_FILE=${GITHUB_WORKSPACE}/${VCPKG_ROOT_PART}/scripts/buildsystems/vcpkg.cmake
export INSTALL_DIR=${GITHUB_WORKSPACE}/${INSTALL_DIR_PART}
scripts/build-preset.sh debug
env:
VCPKG_ROOT_PART: ../pre-built-llvm-${{ matrix.llvm }}/vcpkg_${{ matrix.image.name }}-${{ matrix.image.tag }}_llvm-${{ matrix.llvm }}_amd64
INSTALL_DIR_PART: ../rellic-install
- name: Locate the packages
id: package_names
shell: bash
working-directory: rellic-build
run: |
echo "DEB_PACKAGE_PATH=rellic-build/$(ls *.deb)" >> ${GITHUB_OUTPUT}
echo "RPM_PACKAGE_PATH=rellic-build/$(ls *.rpm)" >> ${GITHUB_OUTPUT}
echo "TGZ_PACKAGE_PATH=rellic-build/$(ls *.tar.gz)" >> ${GITHUB_OUTPUT}
- name: Install the DEB package
run: |
dpkg -i ${{ steps.package_names.outputs.DEB_PACKAGE_PATH }}
- name: Test the DEB package
run: |
rellic-decomp --version
- name: Run Integration Tests (AnghaBench 1K, LLVM 14)
if: ${{ matrix.llvm == '14' && matrix.image.tag == '20.04' }}
shell: bash
run: |
apt-get install -y clang-${{ matrix.llvm }}
python3 -m pip install -r external/lifting-tools-ci/requirements.txt
scripts/test-angha-1k.sh \
--rellic-cmd "rellic-decomp"
- name: Store the DEB package
uses: actions/upload-artifact@v1
with:
name: ${{ matrix.image.name }}-${{ matrix.image.tag }}_llvm${{ matrix.llvm }}_deb_package
path: ${{ steps.package_names.outputs.DEB_PACKAGE_PATH }}
- name: Store the RPM package
uses: actions/upload-artifact@v1
with:
name: ${{ matrix.image.name }}-${{ matrix.image.tag }}_llvm${{ matrix.llvm }}_rpm_package
path: ${{ steps.package_names.outputs.RPM_PACKAGE_PATH }}
- name: Store the TGZ package
uses: actions/upload-artifact@v1
with:
name: ${{ matrix.image.name }}-${{ matrix.image.tag }}_llvm${{ matrix.llvm }}_tgz_package
path: ${{ steps.package_names.outputs.TGZ_PACKAGE_PATH }}
build_mac:
strategy:
fail-fast: false
matrix:
os: [
'macos-12'
]
llvm: [
'16'
]
runs-on: ${{ matrix.os }}
steps:
- name: Adding github workspace as safe directory
# See issue https://github.com/actions/checkout/issues/760
run: git config --global --add safe.directory $GITHUB_WORKSPACE
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: true
- name: Install Ninja Build
run: brew install ninja
- name: Build with build script
shell: bash
run: |
./scripts/build.sh --download-dir "$(pwd)/../pre-built-llvm-${{ matrix.llvm }}" --llvm-version ${{ matrix.llvm }}
cmake --build rellic-build --target install
- name: Tests
shell: bash
working-directory: rellic-build
run: |
# Test with CMake provided test
env CTEST_OUTPUT_ON_FAILURE=1 cmake --build . --target test
- name: Locate the packages
id: package_names
shell: bash
working-directory: rellic-build
run: |
echo "TGZ_PACKAGE_PATH=rellic-build/$(ls *.tar.gz)" >> ${GITHUB_OUTPUT}
- name: Store the TGZ package
uses: actions/upload-artifact@v1
with:
name: ${{ matrix.os }}_llvm${{ matrix.llvm }}_tgz_package
path: ${{ steps.package_names.outputs.TGZ_PACKAGE_PATH }}
release_packages:
# Do not run the release procedure if any of the builds has failed
needs: [ build_linux, build_mac ]
runs-on: ubuntu-22.04
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
steps:
- name: Adding github workspace as safe directory
# See issue https://github.com/actions/checkout/issues/760
run: git config --global --add safe.directory $GITHUB_WORKSPACE
- name: Clone the rellic repository
uses: actions/checkout@v2
with:
path: rellic
fetch-depth: 0
submodules: true
- name: Generate the changelog
shell: bash
working-directory: rellic
run: |
./scripts/generate_changelog.sh changelog.md
- name: Download all artifacts
uses: actions/download-artifact@v2
- name: Draft the new release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Version ${{ github.ref }}
body_path: rellic/changelog.md
draft: true
prerelease: true
- name: Group the packages by platform
run: |
zip -r9 rellic_ubuntu-22.04_packages.zip \
ubuntu-22.04*
zip -r9 rellic_macos-12_packages.zip \
macos-12*
- name: Upload the Ubuntu 22.04 packages
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: rellic_ubuntu-22.04_packages.zip
asset_name: rellic_ubuntu-22.04_packages.zip
asset_content_type: application/gzip
- name: Upload the macOS 12 packages
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: rellic_macos-12_packages.zip
asset_name: rellic_macos-12_packages.zip
asset_content_type: application/gzip
Docker_Linux:
runs-on: ubuntu-latest
strategy:
matrix:
llvm: ["16"]
ubuntu: ["22.04"]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: true
- name: Build LLVM ${{ matrix.llvm }} on ${{ matrix.ubuntu }}
run: |
docker build . -t docker.pkg.github.com/lifting-bits/rellic/rellic-llvm${{ matrix.llvm }}-ubuntu${{ matrix.ubuntu }}-amd64:latest -f Dockerfile --build-arg UBUNTU_VERSION=${{ matrix.ubuntu }} --build-arg ARCH=amd64 --build-arg LLVM_VERSION=${{ matrix.llvm }}
- name: Test Docker image
run: |
docker run --rm docker.pkg.github.com/lifting-bits/rellic/rellic-llvm${{ matrix.llvm }}-ubuntu${{ matrix.ubuntu }}-amd64:latest --version