Skip to content

Run AnghaBench CI After Build #849

Run AnghaBench CI After Build

Run AnghaBench CI After Build #849

name: Run AnghaBench CI After Build
on:
# Only run when normal CI steps complete
# Otherwise we'd just fail to build this rellic branch
workflow_run:
workflows: ["VCPKG Continuous Integration"]
types: [completed]
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" && \
sudo /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 After Build 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 }}