-
Notifications
You must be signed in to change notification settings - Fork 45
139 lines (125 loc) · 5.13 KB
/
anghabench-cron-jobs.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
name: Run AnghaBench CI Cron Jobs
on:
# Run this workflow every day at 3am
schedule:
- cron: "0 3 * * *"
jobs:
do-the-job:
strategy:
fail-fast: false
matrix:
llvm: [ '16' ]
run_size: [ '1k' ]
name: Run AnghaBench CI (AMD64)
runs-on: gha-ubuntu-32
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.workflow_run.head_branch }}
submodules: true
# https://stackoverflow.com/questions/58033366/how-to-get-current-branch-within-github-actions
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Fix github token auth
shell: bash
env:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
run: |
export HOME=${HOME:-/root}
git config --global user.name "CI User" && git config --global user.email "[email protected]"
git config --global url."https://${ACCESS_TOKEN}@github.com/".insteadOf "[email protected]:"
- name: Set up pre-requisies
run: |
sudo dpkg --add-architecture i386 && sudo apt-get update && sudo apt-get -qqy upgrade
sudo apt-get install -qqy \
git curl wget unzip xz-utils pixz jq s3cmd ninja-build pkg-config \
liblzma-dev zlib1g-dev libtinfo-dev build-essential \
libc6-dev:i386 libstdc++-*-dev:i386 g++-multilib
wget "https://github.com/Kitware/CMake/releases/download/v3.22.3/cmake-3.22.3-linux-$(uname -m).sh" && \
/bin/bash cmake-*.sh --skip-license --prefix=/usr/local && rm cmake-*.sh
python3 -m pip install requests
- name: Build rellic against LLVM ${{ matrix.llvm }}
run: |
./scripts/build.sh \
--install \
--extra-cmake-args "-DCMAKE_BUILD_TYPE=Release" \
--download-dir "$(pwd)/../pre-built-llvm-${{ matrix.llvm }}" \
--llvm-version ${{ matrix.llvm }} \
- name: Fetch Angha Data for LLVM {{ matrix.llvm }}
run: |
pushd external/lifting-tools-ci
if [[ -f requirements.txt ]]
then
python3 -m pip install -r requirements.txt
fi
mkdir -p $(pwd)/decompiled
mkdir -p $(pwd)/recompiled
datasets/fetch_anghabench.sh --clang "${LLVM_VERSION}" --bitcode --run-size "${RUN_SIZE}"
for i in *.tar.xz
do
tar -xJf $i
done
popd
env:
LLVM_VERSION: ${{ matrix.llvm }}
RUN_SIZE: ${{ matrix.run_size }}
- name: Run Angha Against LLVM {{ matrix.llvm }}
run: |
pushd external/lifting-tools-ci
# Run the benchmark
tool_run_scripts/rellic.py \
--run-name "[${RUN_NAME}] [size: ${RUN_SIZE}] [rellic: ${RELLIC_BRANCH}]" \
--rellic rellic-decomp \
--input-dir $(pwd)/bitcode \
--output-dir $(pwd)/decompiled \
--slack-notify
# Try to recompile our decompiled code
tool_run_scripts/recompile.py \
--run-name "[${RUN_NAME}] [size: ${RUN_SIZE}] [recompile]" \
--clang clang-${LLVM_VERSION} \
--input-dir $(pwd)/decompiled \
--output-dir $(pwd)/recompiled \
--slack-notify
env:
RUN_SIZE: ${{ matrix.run_size }}
RELLIC_BRANCH: ${{ steps.extract_branch.outputs.branch }}
RUN_NAME: "Rellic Cron Job CI Run"
SLACK_HOOK: ${{ secrets.SLACK_HOOK }}
DO_TOKEN: ${{ secrets.DO_TOKEN }}
LLVM_VERSION: ${{ matrix.llvm }}
- name: Save Angha Run for LLVM {{ matrix.llvm }}
run: |
# AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY passed in from original invocation environment
if [[ "${AWS_ACCESS_KEY_ID,,}" != "" ]]
then
datenow=$(date +'%F-%H-%M')
url_base="https://tob-amp-ci-results.nyc3.digitaloceanspaces.com"
tar -Ipixz -cf rellic-ci-${datenow}.tar.xz decompiled
tar -Ipixz -cf recompile-ci-${datenow}.tar.xz recompiled
s3cmd -c /dev/null \
'--host-bucket=%(bucket)s.nyc3.digitaloceanspaces.com' \
--acl-public \
put \
rellic-ci-${datenow}.tar.xz \
s3://tob-amp-ci-results/rellic/
tool_run_scripts/slack.py \
--msg "Uploaded rellic decompilation results to ${url_base}/rellic/rellic-ci-${datenow}.tar.xz"
s3cmd -c /dev/null \
'--host-bucket=%(bucket)s.nyc3.digitaloceanspaces.com' \
--acl-public \
put \
recompile-ci-${datenow}.tar.xz \
s3://tob-amp-ci-results/recompile/
tool_run_scripts/slack.py \
--msg "Uploaded recompilation results to ${url_base}/recompile/recompile-ci-${datenow}.tar.xz"
fi
env:
AWS_ACCESS_KEY_ID: ${{ secrets.DO_SPACES_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.DO_SPACES_SECRET }}
SLACK_HOOK: ${{ secrets.SLACK_HOOK }}