Skip to content

Commit 99ad47b

Browse files
committed
Add standalone GitHub Actions
1 parent 3cbde78 commit 99ad47b

File tree

5 files changed

+197
-277
lines changed

5 files changed

+197
-277
lines changed

.github/workflows/build.yml

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
name: Build
2+
on: [push, pull_request]
3+
4+
# Automatically cancel previous runs of this workflow on the same branch
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.ref }}
7+
cancel-in-progress: true
8+
9+
jobs:
10+
linux:
11+
# Skip building pull requests from the same repository
12+
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }}
13+
runs-on: ubuntu-22.04
14+
# We use a clean container to avoid LLVM conflicts on the GH runner images
15+
container:
16+
image: ubuntu:22.04
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
llvm:
21+
- "15"
22+
- "16"
23+
- "17"
24+
- "18"
25+
- "19"
26+
- "20"
27+
- "21"
28+
steps:
29+
- name: Install LLVM and build tools
30+
run: |
31+
apt update
32+
apt install --no-install-recommends -y \
33+
lsb-release \
34+
wget \
35+
software-properties-common \
36+
gnupg \
37+
cmake \
38+
ninja-build \
39+
python-is-python3 \
40+
python3-pip \
41+
python3-setuptools \
42+
python3-venv \
43+
git
44+
wget https://apt.llvm.org/llvm.sh
45+
chmod +x llvm.sh
46+
./llvm.sh ${{ matrix.llvm }}
47+
apt install --no-install-recommends -y \
48+
llvm-${{ matrix.llvm }}-dev
49+
echo "LLVM_PREFIX=$$(llvm-config-${{ matrix.llvm }} --prefix)" >> $GITHUB_ENV
50+
echo "CC=clang-${{ matrix.llvm }}" >> $GITHUB_ENV
51+
echo "CXX=clang++-${{ matrix.llvm }}" >> $GITHUB_ENV
52+
53+
- name: Checkout
54+
uses: actions/checkout@v5
55+
56+
- name: Add workspace as safe directory (necessary for docker)
57+
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
58+
59+
- name: Build dependencies
60+
run: |
61+
cmake -G Ninja -S dependencies -B dependencies/build -DUSE_EXTERNAL_LLVM=ON "-DCMAKE_PREFIX_PATH=$LLVM_PREFIX"
62+
cmake --build dependencies/build
63+
64+
- name: Python venv for tests
65+
run: |
66+
python3 -m venv .venv
67+
.venv/bin/pip install scripts/diff_tester_export_insns
68+
69+
- name: Build remill
70+
run: |
71+
. .venv/bin/activate
72+
cmake -G Ninja -B build "-DCMAKE_PREFIX_PATH=$LLVM_PREFIX;$PWD/dependencies/install" "-DCMAKE_INSTALL_PREFIX=$PWD/install"
73+
cmake --build build
74+
75+
- name: Install remill
76+
run: |
77+
cmake --install build
78+
79+
- name: Smoketests with installed executable
80+
run: |
81+
install/bin/remill-lift-${{ matrix.llvm }} --arch amd64 --ir_out /dev/stdout --bytes c704ba01000000
82+
install/bin/remill-lift-${{ matrix.llvm }} --arch aarch64 --ir_out /dev/stdout --address 0x400544 --bytes FD7BBFA90000009000601891FD030091B7FFFF97E0031F2AFD7BC1A8C0035FD6
83+
install/bin/remill-lift-${{ matrix.llvm }} --arch aarch32 -ir_out /dev/stderr --bytes 0cd04de208008de504108de500208de508309de504009de500109de5903122e0c20fa0e110109fe5001091e5002081e5040081e50cd08de21eff2fe14000000000000000
84+
85+
- name: Test remill
86+
run: |
87+
cmake --build build --target test_dependencies
88+
env CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test
89+
90+
macos:
91+
# Skip building pull requests from the same repository
92+
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }}
93+
runs-on: macos-latest
94+
strategy:
95+
fail-fast: false
96+
matrix:
97+
llvm:
98+
- "15"
99+
- "16"
100+
- "17"
101+
- "18"
102+
- "19"
103+
- "20"
104+
- "21"
105+
steps:
106+
- name: Install LLVM
107+
run: |
108+
brew install llvm@${{ matrix.llvm }}
109+
LLVM_PREFIX=$(brew --prefix llvm@${{ matrix.llvm }})
110+
echo "LLVM_PREFIX=$LLVM_PREFIX" >> $GITHUB_ENV
111+
echo "CC=clang" >> $GITHUB_ENV
112+
echo "CXX=clang++" >> $GITHUB_ENV
113+
114+
- name: Checkout
115+
uses: actions/checkout@v5
116+
117+
- name: Build dependencies
118+
run: |
119+
cmake -G Ninja -S dependencies -B dependencies/build -DUSE_EXTERNAL_LLVM=ON "-DCMAKE_PREFIX_PATH=$LLVM_PREFIX"
120+
cmake --build dependencies/build
121+
122+
- name: Python venv for tests
123+
run: |
124+
python3 -m venv .venv
125+
.venv/bin/pip install scripts/diff_tester_export_insns
126+
127+
- name: Build remill
128+
run: |
129+
. .venv/bin/activate
130+
cmake -G Ninja -B build "-DCMAKE_PREFIX_PATH=$LLVM_PREFIX;$PWD/dependencies/install" "-DCMAKE_INSTALL_PREFIX=$PWD/install"
131+
cmake --build build
132+
133+
- name: Install remill
134+
run: |
135+
cmake --install build
136+
137+
- name: Smoketests with installed executable
138+
run: |
139+
install/bin/remill-lift-${{ matrix.llvm }} --arch amd64 --ir_out /dev/stdout --bytes c704ba01000000
140+
install/bin/remill-lift-${{ matrix.llvm }} --arch aarch64 --ir_out /dev/stdout --address 0x400544 --bytes FD7BBFA90000009000601891FD030091B7FFFF97E0031F2AFD7BC1A8C0035FD6
141+
install/bin/remill-lift-${{ matrix.llvm }} --arch aarch32 -ir_out /dev/stderr --bytes 0cd04de208008de504108de500208de508309de504009de500109de5903122e0c20fa0e110109fe5001091e5002081e5040081e50cd08de21eff2fe14000000000000000
142+
143+
- name: Test remill
144+
run: |
145+
cmake --build build --target test_dependencies
146+
env CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test
147+
148+
windows:
149+
# Skip building pull requests from the same repository
150+
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }}
151+
runs-on: windows-latest
152+
defaults:
153+
run:
154+
shell: powershell
155+
steps:
156+
- name: Checkout
157+
uses: actions/checkout@v5
158+
159+
- name: Download LLVM (17)
160+
run: |
161+
curl.exe -L -O https://github.com/thesecretclub/riscy-business/releases/download/transpiler-v0.3/llvm-17.0.2-win64.7z
162+
if ((Get-FileHash -Path "llvm-17.0.2-win64.7z" -Algorithm SHA256).Hash -ne "38F8574DAA2A392A6A3D9C3EF70FED4D5AE452B258FFF33983B2EDA4B6EDD179") {
163+
echo "Hash mismatch"
164+
exit 1
165+
}
166+
7z x llvm-17.0.2-win64.7z -ollvm-17.0.6-win64
167+
echo "LLVM_PREFIX=$PWD/llvm-17.0.6-win64" >> $env:GITHUB_ENV
168+
169+
- name: Build dependencies
170+
run: |
171+
cmake -G Ninja -S dependencies -B dependencies/build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DUSE_EXTERNAL_LLVM=ON "-DCMAKE_PREFIX_PATH=$env:LLVM_PREFIX"
172+
cmake --build dependencies/build
173+
174+
- name: Build remill
175+
run: |
176+
cmake -G Ninja -B build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ "-DCMAKE_PREFIX_PATH=$env:LLVM_PREFIX;$PWD/dependencies/install" "-DCMAKE_INSTALL_PREFIX=$PWD/install" -DCMAKE_BUILD_TYPE=RelWithDebInfo
177+
cmake --build build
178+
179+
- name: Install remill
180+
run: |
181+
cmake --install build
182+
183+
- name: Smoketests with installed executable
184+
run: |
185+
install/bin/remill-lift-17 --arch amd64 --ir_out CONOUT$ --bytes c704ba01000000
186+
install/bin/remill-lift-17 --arch aarch64 --ir_out CONOUT$ --address 0x400544 --bytes FD7BBFA90000009000601891FD030091B7FFFF97E0031F2AFD7BC1A8C0035FD6
187+
install/bin/remill-lift-17 --arch aarch32 -ir_out CONOUT$ --bytes 0cd04de208008de504108de500208de508309de504009de500109de5903122e0c20fa0e110109fe5001091e5002081e5040081e50cd08de21eff2fe14000000000000000

0 commit comments

Comments
 (0)