Skip to content

Merge branch 'code-inference-fixes' into 'main' #299

Merge branch 'code-inference-fixes' into 'main'

Merge branch 'code-inference-fixes' into 'main' #299

Workflow file for this run

name: DDisasm Build
on: [push]
jobs:
docker:
runs-on: ubuntu-latest
permissions:
packages: write
strategy:
matrix:
os: [focal]
include:
- os: focal
file_suffix: ubuntu20
outputs:
image_tag: ${{ steps.vars.outputs.image_tag }}
image_path: ${{ steps.vars.outputs.image_path }}
steps:
# We must generate output variables here in order to ensure the
# reference is lowercase, even if the repository reference is not
# (e.g., because of the organization "GrammaTech").
# For the tag, we replace forward slashes with hyphens and use the tag
# the "latest" for the "main" branch.
# We'd like to just generate the environment variables, but the `env`
# context is not available in the "jobs.<id>.container" field, despite
# what the Context Availability documentation says. See:
# https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability
- id: vars
run: |
export IMAGE_TAG=$([ "${{ github.ref_name }}" == "main" ] && echo latest || echo ${{ github.ref_name }} | sed -e "s/\//-/g")
echo "image_tag=$IMAGE_TAG" >> $GITHUB_ENV
echo "image_tag=$IMAGE_TAG" >> $GITHUB_OUTPUT
export IMAGE_PATH=$(echo ghcr.io/${{ github.repository }}/ | awk '{print tolower($0)}')
echo "image_path=$IMAGE_PATH" >> $GITHUB_ENV
echo "image_path=$IMAGE_PATH" >> $GITHUB_OUTPUT
- uses: actions/checkout@master
- name: Kaniko build
uses: aevea/[email protected]
with:
registry: ghcr.io
image: ${{ matrix.os }}
password: ${{ secrets.GITHUB_TOKEN }}
cache: true
cache_registry: ${{ matrix.os }}-cache
tag: ${{ env.image_tag }}
build_file: .ci/Dockerfile.${{ matrix.file_suffix }}
build:
runs-on: ubuntu-latest
permissions:
packages: read
strategy:
matrix:
os: [focal]
compiler: [g++, clang++]
needs: docker
env:
BUILD_TYPE: Release
container: ${{ needs.docker.outputs.image_path }}${{ matrix.os }}:${{ needs.docker.outputs.image_tag }}
steps:
- name: Install capstone, gtirb, gtirb-pprinter
run: |
curl https://download.grammatech.com/gtirb/files/apt-repo/conf/apt.gpg.key | apt-key add -
echo "deb https://download.grammatech.com/gtirb/files/apt-repo ${{ matrix.os }} unstable" >> /etc/apt/sources.list
apt-get update
apt-get -y install libcapstone-dev=1:5.0.0-gtdev libgtirb libgtirb-dev libgtirb-pprinter libgtirb-pprinter-dev gtirb-pprinter
- name: Checkout ddisasm
uses: actions/checkout@v3
- name: Build
run: |
mkdir build
cd build
cmake -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DLIEF_ROOT=/usr/ ..
make
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ddisasm-build-${{ matrix.os }}-${{ matrix.compiler }}
path: build
test:
runs-on: ubuntu-latest
permissions:
packages: read
strategy:
matrix:
os: [focal]
compiler: [g++, clang++]
needs: [docker, build]
container: ${{ needs.docker.outputs.image_path }}${{ matrix.os }}:${{ needs.docker.outputs.image_tag }}
steps:
# Checkout
- name: Checkout repository
uses: actions/checkout@v3
# Install deps
- name: Install capstone, gtirb, gtirb-pprinter
run: |
curl https://download.grammatech.com/gtirb/files/apt-repo/conf/apt.gpg.key | apt-key add -
echo "deb https://download.grammatech.com/gtirb/files/apt-repo ${{ matrix.os }} unstable" >> /etc/apt/sources.list
apt-get update
apt-get -y install libcapstone-dev=1:5.0.0-gtdev libgtirb libgtirb-dev libgtirb-pprinter libgtirb-pprinter-dev gtirb-pprinter
pip3 install https://download.grammatech.com/gtirb/files/python/gtirb-unstable-py3-none-any.whl
pip3 install -r requirements-dev.txt
# Download artifacts
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: ddisasm-build-${{ matrix.os }}-${{ matrix.compiler }}
path: build
- run: chmod +x build/bin/*
- run: mkdir ${HOME}/.wine
# Run tests
- run: cd build && PATH=$(pwd)/bin:$PATH ctest -V
build-pages:
runs-on: ubuntu-latest
permissions:
packages: read
needs: docker
container: ${{ needs.docker.outputs.image_path }}focal:${{ needs.docker.outputs.image_tag }}
steps:
- name: Checkout ddisasm
uses: actions/checkout@v3
- name: Generate API documentation
run: |
cd doc
pip3 install -r requirements-docs.txt
BUILDDIR=../public make -e
- name: Upload GitHub Pages artifact
uses: actions/[email protected]
with:
path: public
deploy-pages:
needs: build-pages
if: github.ref == 'refs/heads/main'
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2