[PHP] support windows/macOS #890
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v3 | |
with: | |
name: valgrind-out | |
path: common/build/valgrind-out.txt | |
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: [ "x86" ,"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 | |
where.exe php | |
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_ | |
cp output/Release/php_pinpoint_php.* _package_ -ErrorAction SilentlyContinue | |
cp output/Release_TS/php_pinpoint_php.* _package_ -ErrorAction SilentlyContinue | |
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 | |
overwrite: true | |
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/download-artifact@v4 | |
with: | |
# name: ${{ env.pinpoint_php_win32_pack_name }} | |
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 | |
# - 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@v3 | |
with: | |
name: ${{ env.MODULE_PAK }} | |
path: pinpoint_php*.tgz | |
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.18.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 |