Skip to content

Commit

Permalink
Add PR testing Github CI (#1393)
Browse files Browse the repository at this point in the history
Run on pull request to master:

    Enforce formatting of CMake files, if modified
    Check for changes in minimum required versions of dependencies
    Ensure Dyninst, test suite, examples, and external tests all build with gcc on Ubuntu-20.04

Run on push to master:

    Build and deploy new dev container, ghcr.io/dyninst/amd64/<OS>:latest
  • Loading branch information
hainest committed Mar 15, 2023
1 parent 1e7aa66 commit 0f5558a
Show file tree
Hide file tree
Showing 16 changed files with 310 additions and 531 deletions.
79 changes: 0 additions & 79 deletions .github/workflows/base-containers.yaml

This file was deleted.

9 changes: 6 additions & 3 deletions .github/workflows/cmake-formatting.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@

name: Formatting
name: CMake Formatting

on:
pull_request:
branches: [ master ]
paths:
- '**.cmake'
- '**CMakeLists.txt'

jobs:
cmake-formatting:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get update
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/dependency-version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Ensure the minimum dependency versions found in the various CMake
# files match the expected values. This ensures we synchronize versions
# across containers and workflows.

name: Check dependency versions

on:
pull_request:
branches: [ master ]
paths:
- '**.cmake'
- '**CMakeLists.txt'
- 'docker/dependencies.versions'

jobs:
check-version:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Version check
run: |
res=0
current=$(awk 'match($0,/set\(_boost_min_version (.+)\)/,a){print a[1]}' cmake/Boost.cmake)
expected=$(awk 'match($0,/boost:(.+)/,a){print a[1]}' docker/dependencies.versions)
if test "$current" != "$expected"; then
echo "Boost mismatch: Found $current, expected $expected" >/dev/stderr
res=1
fi
current=$(awk 'match($0,/set\(_tbb_min_version (.+)\)/,a){print a[1]}' cmake/ThreadingBuildingBlocks.cmake)
expected=$(awk 'match($0,/tbb:(.+)/,a){print a[1]}' docker/dependencies.versions)
IFS=' ' read -a versions <<< $(echo $current)
if test "${versions[0]}" != "$expected" -a "${versions[1]}" != "$expected"; then
echo "TBB mismatch: Found ('${versions[0]}','${versions[1]}'), expected $expected" >/dev/stderr
res=1
fi
current=$(awk 'match($0,/set\(_min_version (.+)\)/,a){print a[1]}' cmake/ElfUtils.cmake)
expected=$(awk 'match($0,/elfutils:(.+)/,a){print a[1]}' docker/dependencies.versions)
if test "$current" != "$expected"; then
echo "Elfutils mismatch: Found $current, expected $expected" >/dev/stderr
res=1
fi
exit $res
37 changes: 37 additions & 0 deletions .github/workflows/dev-containers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build and Deploy Development Containers

on:
push:
branches:
- master

jobs:
build:
permissions:
packages: write
strategy:
fail-fast: false
matrix:
os: ["ubuntu-20.04"]
runs-on: ubuntu-latest
name: Build
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Build Dyninst Dev Container
run: |
cd docker/
docker build --build-arg base=ghcr.io/dyninst/amd64/${{ matrix.os }}-base:latest
-f Dockerfile \
-t ghcr.io/dyninst/amd64/${{ matrix.os }}:latest ../
- name: GHCR Login
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Deploy
run: docker push ghcr.io/dyninst/amd64/${{ matrix.os }}:latest
102 changes: 102 additions & 0 deletions .github/workflows/pr-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# On each pull request, we build Dyninst, the test suite, the examples from
# dyninst/examples, and the external test from dyninst/external-tests
#
# The builds are carried out for each supported OS using the base containers
# at https://github.com/orgs/dyninst/packages

name: Pull Request Tests

on:
pull_request:
branches:
- master
jobs:
gcc-build:
permissions:
packages: read
strategy:
fail-fast: false
matrix:
os: ['ubuntu-20.04']
runs-on: ubuntu-latest
container:
image: ghcr.io/dyninst/amd64/${{ matrix.os }}-base:latest
credentials:
username: ${{ github.actor }}
password: ${{ secrets.github_token }}
name: gcc on ${{ matrix.os }}
steps:
- name: Checkout Dyninst
uses: actions/checkout@v3
with:
path: dyninst/src

- name: Build Dyninst
run: |
ln -s $PWD/dyninst /dyninst
export DYNINST_C_FLAGS="-Werror" DYNINST_CXX_FLAGS="-Werror"
export DYNINST_C_COMPILER="gcc" DYNINST_CXX_COMPILER="g++"
bash /dyninst/src/docker/build.sh /dyninst/src
- name: Checkout Test Suite
uses: actions/checkout@v3
with:
repository: dyninst/testsuite
path: testsuite

- name: Build testsuite
run: |
cd testsuite; mkdir build; cd build
cmake .. -DDyninst_DIR=/dyninst/install/lib/cmake/Dyninst
cmake --build .
- name: Checkout Examples
uses: actions/checkout@v3
with:
repository: dyninst/examples
path: examples

- name: Build examples
run: |
cd examples; mkdir build; cd build
cmake .. -DDyninst_DIR=/dyninst/install/lib/cmake/Dyninst
cmake --build .
- name: Checkout External Tests
uses: actions/checkout@v3
with:
repository: dyninst/external-tests
path: external-tests

- name: Build external tests
run: |
cd external-tests; mkdir build; cd build
cmake .. -DDyninst_DIR=/dyninst/install/lib/cmake/Dyninst
cmake --build .
clang-build:
permissions:
packages: read
strategy:
fail-fast: false
matrix:
os: ['ubuntu-20.04']
runs-on: ubuntu-latest
container:
image: ghcr.io/dyninst/amd64/${{ matrix.os }}-base:latest
credentials:
username: ${{ github.actor }}
password: ${{ secrets.github_token }}
name: clang on ${{ matrix.os }}
steps:
- name: Checkout Dyninst
uses: actions/checkout@v3
with:
path: dyninst/src

- name: Build Dyninst
run: |
ln -s $PWD/dyninst /dyninst
export DYNINST_C_FLAGS="-Werror" DYNINST_CXX_FLAGS="-Werror"
export DYNINST_C_COMPILER="clang" DYNINST_CXX_COMPILER="clang++"
bash /dyninst/src/docker/build.sh /dyninst/src
48 changes: 0 additions & 48 deletions .github/workflows/release.yaml

This file was deleted.

39 changes: 0 additions & 39 deletions .github/workflows/test-dyninst.yaml

This file was deleted.

0 comments on commit 0f5558a

Please sign in to comment.