-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (97 loc) · 2.93 KB
/
pr-tests.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
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.latest }}
steps:
- id: all
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 .