forked from pinpoint-apm/pinpoint-c-agent
-
Notifications
You must be signed in to change notification settings - Fork 1
311 lines (284 loc) · 9.77 KB
/
main.yml
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
name: CI
on:
pull_request:
workflow_dispatch:
push:
tags:
- "v*.*.*"
env:
MODULE_PAK: pinpoint_php-${{ github.head_ref || github.ref_name }}
jobs:
cpp:
strategy:
matrix:
os: [ubuntu-latest, macos-13]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: actions-setup-cmake
uses: jwlawson/[email protected]
with:
cmake-version: "3.16.x"
- name: Build agent
run: |
cd common
mkdir -p build
cd build
cmake -DWITH_TEST_CASE=1 -DWITH_CODECOVERAGE=1 -DCMAKE_BUILD_TYPE=Debug ..
make
./bin/TestCommon
- name: Codecovage
uses: codecov/codecov-action@v4
cpp-windows:
runs-on: [windows-latest]
steps:
- uses: actions/checkout@v2
- name: powershell allow...
shell: cmd
run: powershell -Command "Set-ExecutionPolicy RemoteSigned -Scope CurrentUser"
- name: Build agent
run: |
cd common
cmake --no-warn-unused-cli -DWITH_TEST_CASE=1 -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -S. -B./build -G "Visual Studio 17 2022" -T host=x86 -A win32
cmake --build build --target ALL_BUILD --config debug --
./build/bin/Debug/TestCommon.exe
memory-leak:
needs: [cpp, cpp-windows]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: actions-setup-cmake
uses: jwlawson/[email protected]
with:
cmake-version: "3.16.x"
- name: Build agent
run: |
sudo apt update || echo "update failed,but try to overlook it"
sudo apt install -y valgrind -y valgrind
cd common
mkdir -p build
cd build
cmake -DWITH_TEST_CASE=1 -DCMAKE_BUILD_TYPE=Debug ..
make
valgrind --leak-check=full \
--show-leak-kinds=all \
--track-origins=yes \
--verbose \
--log-file=valgrind-out.txt \
./bin/TestCommon
- name: Archive docs
uses: actions/upload-artifact@v4
with:
name: valgrind-out
path: common/build/valgrind-out.txt
retention-days: 5
if-no-files-found: error
PHP:
runs-on: ubuntu-latest
needs: cpp
strategy:
matrix:
php-version: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3"]
steps:
- uses: actions/checkout@v2
with:
submodules: "true"
- name: update docker compose
run: |
wget "https://github.com/docker/compose/releases/latest/download/docker-compose-linux-x86_64"
chmod +x docker-compose-linux-x86_64
./docker-compose-linux-x86_64 version
- name: start test environment
run: |
./docker-compose-linux-x86_64 -f "testapps/compose.yaml" build php-compatible --build-arg PHP_VERSION=${{ matrix.php-version }}
./docker-compose-linux-x86_64 -f "testapps/compose.yaml" up php-compatible
- name: Stop containers
# if: always()
run: ./docker-compose-linux-x86_64 -f "testapps/compose.yaml" down php-compatible
PHP-MacOS:
runs-on: macos-latest
needs: cpp
strategy:
matrix:
php-version: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3"]
ts: ["ts","nts"]
env:
SKIP_MACOS_ACTION: true
steps:
- uses: actions/checkout@v2
with:
submodules: "true"
- name: Setup PHP with PECL extension
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
env:
phpts: ${{ matrix.ts }}
- name: build pinpoint_php
run: phpize && ./configure && make
- name: make test
run: make test TESTS="--show-diff tests_macos"
PHP-Win-2019:
runs-on: windows-2019
needs: cpp-windows
strategy:
matrix:
php-versions: [ "7.4", "7.3", "7.2","7.1","8.0", "8.1", "8.2", "8.3"]
arch: [ "x64"]
ts: [ "ts", "nts" ]
env:
SKIP_WINDOWS_ACTION: true
steps:
- uses: actions/checkout@v2
- id: setup-php-sdk
uses: php/[email protected]
with:
version: ${{ matrix.php-versions }}
arch: ${{ matrix.arch }}
ts: ${{ matrix.ts }}
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
toolset: ${{steps.setup-php-sdk.outputs.toolset}}
- name: build pinpoint_php on windows
run: |
php -m
php -v
mkdir output
phpize
./configure.bat --enable-pinpoint_php --enable-debug-pack --enable-object-out-dir=output --with-prefix=${{steps.setup-php-sdk.outputs.prefix}}
nmake
- name: test pinpoint_php on windows
run: |
# from https://github.com/php/setup-php-sdk/issues/7
nmake test TESTS="--show-diff tests_win32"
echo "pinpoint_php_win32_pack_name=${{ env.MODULE_PAK }}-${{ matrix.php-versions }}-${{ matrix.ts }}-${{steps.setup-php-sdk.outputs.vs}}-${{ matrix.arch }}" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: package
run: |
mkdir _package_
if (Test-Path -Path output/Release/ -PathType Container) {
cp output/Release/php_pinpoint_php.dll _package_
cp output/Release/php_pinpoint_php.pdb _package_
cp output/Release/php_pinpoint_php.lib _package_
}
if (Test-Path -Path output/Release_TS/ -PathType Container) {
cp output/Release_TS/php_pinpoint_php.dll _package_
cp output/Release_TS/php_pinpoint_php.pdb _package_
cp output/Release_TS/php_pinpoint_php.lib _package_
}
cp NOTICE _package_
cp README.md _package_
cp CHANGES-PHP.md _package_
cp LICENSE _package_
Compress-Archive -Path _package_/* ${{ env.pinpoint_php_win32_pack_name }}.zip
- uses: actions/upload-artifact@v4
with:
name: ${{ env.pinpoint_php_win32_pack_name }}
path: ${{ env.pinpoint_php_win32_pack_name }}.zip
retention-days: 5
if-no-files-found: error
PHP-Release-Win32-Package:
needs: [ PHP-Win-2019, pack_php_module]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download All Artifacts
uses: actions/[email protected]
with:
path: pinpoint-artifact
pattern: pinpoint_php*
merge-multiple: true
- run: ls -R pinpoint-artifact
- name: Release php_package
id: rel_php_pak
uses: softprops/action-gh-release@v2
with:
files: pinpoint-artifact/*
pack_php_module:
runs-on: ubuntu-latest
needs: PHP
steps:
- uses: actions/checkout@v2
- name: Setup PHP without composer
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
- name: pecl package
run: |
pecl package
pecl build
# - name: Package pinpoint_php
# id: pack
# run: |
# tar -czf ${{ env.MODULE_PAK }} common/ config.m4 tests LICENSE pinpoint_php.cpp php_pinpoint_php.h
# md5=($(md5sum ${{ env.MODULE_PAK }} ))
# pinpoint_php_win32_pack_name=${{ env.MODULE_PAK }}-${md5}-$(date '+%Y-%m-%d').tar.gz
# mv ${{ env.MODULE_PAK }} $pinpoint_php_win32_pack_name
# echo "PACK=$pinpoint_php_win32_pack_name" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v4
with:
name: pinpoint_php.tgz
path: pinpoint_php*.tgz
retention-days: 5
if-no-files-found: error
Python:
strategy:
matrix:
os: [ubuntu-latest, macos-13]
python-version: ["3.8", "3.9", "3.10", "3.11"]
runs-on: ${{ matrix.os }}
needs: [cpp, cpp-windows]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: run unittest
run: |
# ref https://github.com/pypa/setuptools/issues/3198
pip install -e .
python -m unittest discover -s src/PY/test
python-plugins:
needs: Python
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: "true"
- name: update docker compose
run: |
wget "https://github.com/docker/compose/releases/latest/download/docker-compose-linux-x86_64"
chmod +x docker-compose-linux-x86_64
./docker-compose-linux-x86_64 version
# run: docker-compose -f "testapps/compose.yaml" build python-plugins
# - name: build python-plugins
- name: start test environment
run: ./docker-compose-linux-x86_64 -f "testapps/compose.yaml" up python-plugins --exit-code-from python-plugins
- name: Stop containers
# if: always()
run: ./docker-compose-linux-x86_64 -f "testapps/compose.yaml" down python-plugins
Collector-agent:
strategy:
matrix:
go-version: [1.19.x]
os: [ubuntu-latest,windows-latest,macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: "true"
- name: Setup protoc
uses: arduino/[email protected]
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: run unittest
run: |
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
# export PATH="$PATH:$(go env GOPATH)/bin"
cd collector-agent && go mod tidy && go test ./... -v