Skip to content

Commit

Permalink
Add GitHub CI
Browse files Browse the repository at this point in the history
  • Loading branch information
hainest committed Dec 18, 2024
1 parent ab94617 commit dd37fff
Showing 1 changed file with 111 additions and 0 deletions.
111 changes: 111 additions & 0 deletions .github/workflows/pr-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Pull Request Tests

on:
pull_request:
branches:
- main
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:

jobs:

# Don't run the check if the PR is a draft
check-if-needed:
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.draft == false }}
steps:
- shell: bash
run: true

get-oses:
runs-on: ubuntu-latest
needs: check-if-needed
outputs:
latest: ${{ steps.all.outputs.all.latest }}
steps:
- id: all
shell: bash
run: |
echo "value=${ubuntu-20.04}" >> $GITHUB_OUTPUT
uses: dyninst/dyninst/.github/actions/os-versions@master

get-compilers:
runs-on: ubuntu-latest
needs: check-if-needed
outputs:
all: ${{ steps.compilers.outputs.value }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: dyninst/dyninst
fetch-depth: 1
path: dyninst

- id: compilers
shell: bash
run: |
set -ex
script="${GITHUB_WORKSPACE}/dyninst/.github/scripts/compiler_configs.py"
names=$(python3 ${script} --print-names)
echo "value=${names}" >> $GITHUB_OUTPUT
pr-tests:
runs-on: ubuntu-latest
needs: [get-oses, get-compilers]
strategy:
fail-fast: false
matrix:
os: ${{ fromJson(needs.get-oses.outputs.latest) }}
compiler: ${{ fromJson(needs.get-compilers.outputs.all) }}
permissions:
packages: read
container:
image: ghcr.io/dyninst/amd64/${{ matrix.os }}-base:latest
credentials:
username: ${{ github.actor }}
password: ${{ secrets.github_token }}
name: PR tests (${{ matrix.os }}, ${{ matrix.compiler }})
steps:
- name: Checkout Dyninst
uses: actions/checkout@v4
with:
repository: dyninst/dyninst
fetch-depth: 1
path: dyninst

- name: Build Dyninst
uses: ./dyninst/.github/actions/build
with:
os: ${{ matrix.os }}
compiler: ${{ matrix.compiler }}
extra-cmake-flags: "-DDYNINST_EXPORT_ALL=ON"
src-dir: "${GITHUB_WORKSPACE}/dyninst"
install-dir: "${GITHUB_WORKSPACE}/dyninst/install"

- name: Checkout unit-tests
uses: actions/checkout@v4
with:
path: unit-tests

- name: Build unit-tests
shell: bash
run: |
set -ex
cd unit-tests
mkdir build
case "${{ matrix.compiler }}" in
clang) cc=clang; cxx=clang++; ;;
gcc) cc=gcc; cxx=g++; ;;
esac
flags="-DCMAKE_C_COMPILER=${cc} "
flags+="-DCMAKE_CXX_COMPILER=${cxx} "
flags+="-DDYNINST_SOURCE_TREE=${GITHUB_WORKSPACE}/dyninst "
flags+="-DDyninst_ROOT=${GITHUB_WORKSPACE}/dyninst/install "
cmake . -B build ${flags}
cmake --build build --parallel 2
- name: Run unit-tests
run: |
cd unit-tests/build
ctest build -VV --output-on-failure .

0 comments on commit dd37fff

Please sign in to comment.