forked from dyninst/dyninst
-
Notifications
You must be signed in to change notification settings - Fork 0
158 lines (138 loc) · 4.57 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
name: Pull Request Tests
on:
pull_request:
branches:
- master
paths:
- '**.h'
- '**.C'
- '**.c'
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:
all: ${{ steps.all.outputs.all }}
steps:
- name: Checkout
uses: actions/checkout@v4
- id: all
uses: ./.github/actions/os-versions
get-compilers:
runs-on: ubuntu-latest
needs: check-if-needed
outputs:
all: ${{ steps.compilers.outputs.value }}
steps:
- name: Checkout
uses: actions/checkout@v4
- id: compilers
shell: bash
run: |
set -ex
script="./.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.all) }}
compiler: ${{ fromJson(needs.get-compilers.outputs.all) }}
install-dir: ["${GITHUB_WORKSPACE}/install", "/usr"]
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 }}, ${{ matrix.install-dir }})
steps:
- name: Checkout Dyninst
uses: actions/checkout@v4
with:
path: "src" # relative to ${GITHUB_WORKSPACE}
- name: Build Dyninst
uses: ./src/.github/actions/build
with:
os: ${{ matrix.os }}
compiler: ${{ matrix.compiler }}
extra-cmake-flags: "-DDYNINST_EXPORT_ALL=ON" # needed for unit tests
src-dir: "${GITHUB_WORKSPACE}/src"
install-dir: ${{ matrix.install-dir }}
- name: Checkout Test Suite
if: ${{ matrix.compiler != 'clang' }}
uses: actions/checkout@v4
with:
repository: dyninst/testsuite
path: "testsuite" # relative to ${GITHUB_WORKSPACE}
- name: Build testsuite
if: ${{ matrix.compiler != 'clang' }}
shell: bash
run: |
set -ex
cd ${GITHUB_WORKSPACE}/testsuite; mkdir build; cd build
cmake .. -DDyninst_ROOT=${{ matrix.install-dir }}
cmake --build . --parallel 2
- name: Checkout Examples
uses: actions/checkout@v4
with:
repository: dyninst/examples
path: "examples" # relative to ${GITHUB_WORKSPACE}
- name: Build examples
shell: bash
run: |
set -ex
cd ${GITHUB_WORKSPACE}/examples; mkdir build; cd build
cmake .. -DDyninst_ROOT=${{ matrix.install-dir }}
cmake --build . --parallel 2
- name: Checkout External Tests
uses: actions/checkout@v4
with:
repository: dyninst/external-tests
path: "external-tests" # relative to ${GITHUB_WORKSPACE}
- name: Build external tests
shell: bash
run: |
set -ex
cd ${GITHUB_WORKSPACE}/external-tests; mkdir build; cd build
cmake .. -DDyninst_ROOT=${{ matrix.install-dir }}
cmake --build . --parallel 2
- name: Run external tests
if: ${{ matrix.compiler != 'clang' }} # libdyninstAPI_RT doesn't work correctly with clang
shell: bash
run: |
set -ex
export DYNINSTAPI_RT_LIB=$(find ${{ matrix.install-dir }} -name libdyninstAPI_RT.so)
cd ${GITHUB_WORKSPACE}/external-tests/build
ctest -VV --output-on-failure .
- name: Checkout Unit Tests
uses: actions/checkout@v4
with:
repository: dyninst/unit-tests
path: unit-tests # Relative to $GITHUB_WORKSPACE
- name: Build unit tests
shell: bash
run: |
set -ex
cd unit-tests; mkdir build; cd build
cmake .. -DDyninst_ROOT=${{ matrix.install-dir }} -DDYNINST_SOURCE_TREE=${GITHUB_WORKSPACE}/src
cmake --build . --parallel 2
- name: Run unit tests
shell: bash
run: |
set -ex
cd ${GITHUB_WORKSPACE}/unit-tests/build
export DYNINSTAPI_RT_LIB=$(find ${{ matrix.install-dir }} -name libdyninstAPI_RT.so)
ctest -VV --output-on-failure .