Skip to content

Make built docker image runnable on Apple Silicon #202

Make built docker image runnable on Apple Silicon

Make built docker image runnable on Apple Silicon #202

Workflow file for this run

name: Diff test outputs
on:
pull_request:
branches:
- '*'
jobs:
do-the-job:
strategy:
fail-fast: false
matrix:
image:
- { name: 'ubuntu', tag: '20.04', codename: 'focal' }
llvm: [ '16' ]
common_base: [ 'https://github.com/lifting-bits/cxx-common/releases/download/v0.4.1' ]
env:
CC: clang-${{ matrix.llvm }}
CXX: clang++-${{ matrix.llvm }}
name: Diff in ouput between old and new rellic
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
- name: Fetch merge
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- name: Fetch base branch
uses: actions/checkout@v3
with:
ref: ${{ github.base_ref }}
fetch-depth: 0
submodules: true
path: old
- name: Install utility tools
shell: bash
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
echo "deb http://apt.llvm.org/${{ matrix.image.codename }}/ llvm-toolchain-${{ matrix.image.codename }}-${{ matrix.llvm }} main" >> /etc/apt/sources.list
echo "deb-src http://apt.llvm.org/${{ matrix.image.codename }}/ llvm-toolchain-${{ matrix.image.codename }}-${{ matrix.llvm }} main" >> /etc/apt/sources.list
apt-get update
apt-get install -y ninja-build pixz xz-utils make rpm python3.8 clang-${{ matrix.llvm }}
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 100
- name: Download cxx-commons
shell: bash
run: |
curl ${{ matrix.common_base }}/vcpkg_${{ matrix.image.name }}-${{ matrix.image.tag }}_llvm-${{ matrix.llvm }}_amd64.tar.xz \
-L -o vcpkg_${{ matrix.image.name }}-${{ matrix.image.tag }}_llvm-${{ matrix.llvm }}_amd64.tar.xz
tar xf vcpkg_${{ matrix.image.name }}-${{ matrix.image.tag }}_llvm-${{ matrix.llvm }}_amd64.tar.xz
- name: Build old rellic
shell: bash
run: |
cmake -G Ninja -S old -B rellic-build-old -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/vcpkg_${{ matrix.image.name }}-${{ matrix.image.tag }}_llvm-${{ matrix.llvm }}_amd64/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET="x64-linux-rel"
cmake --build rellic-build-old
- name: Build new rellic
shell: bash
run: |
cmake -G Ninja -S . -B rellic-build -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/vcpkg_${{ matrix.image.name }}-${{ matrix.image.tag }}_llvm-${{ matrix.llvm }}_amd64/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET="x64-linux-rel"
cmake --build rellic-build
- name: Print job summary
shell: bash
run: |
echo "# Test diffs" >> $GITHUB_STEP_SUMMARY
cd $GITHUB_WORKSPACE/tests/tools/decomp
env CLANG=clang-${{ matrix.llvm }} \
OLD_RELLIC=$GITHUB_WORKSPACE/rellic-build-old/tools/rellic-decomp \
NEW_RELLIC=$GITHUB_WORKSPACE/rellic-build/tools/rellic-decomp \
make -s -j1 -f diff_outputs.mk >> $GITHUB_STEP_SUMMARY
- name: Output generated markdown
shell: bash
id: md
run: |
cd $GITHUB_WORKSPACE/tests/tools/decomp
env CLANG=clang-${{ matrix.llvm }} \
OLD_RELLIC=$GITHUB_WORKSPACE/rellic-build-old/tools/rellic-decomp \
NEW_RELLIC=$GITHUB_WORKSPACE/rellic-build/tools/rellic-decomp \
make -s -j1 -f diff_outputs.mk >> $GITHUB_WORKSPACE/test-diff.md
- name: Add comment
uses: actions/github-script@v6
with:
script: |
const fs = require('fs')
const body = fs.readFileSync('test-diff.md', {encoding:'utf-8'})
const message = `See the diff generated by this PR for the tests here: https://github.com/lifting-bits/rellic/actions/runs/${{ github.run_id }}
<details>
${body}
</details>`
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: message
})