Skip to content

Commit

Permalink
feat(py): flask plugins pinpoint-apm#538
Browse files Browse the repository at this point in the history
    - remove cmake
    - rename pinpintPy
    - add testcase for plugins

    close pinpoint-apm#538
  • Loading branch information
eeliu committed Oct 20, 2023
1 parent f51dfaa commit e2435ce
Show file tree
Hide file tree
Showing 68 changed files with 573 additions and 321 deletions.
7 changes: 4 additions & 3 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt update && apt install -y apt-utils gcc g++ gdb pkg-config libxml2-dev libsqlite3-dev libcurl4-openssl-dev zlib1g-dev make cmake wget autoconf git clangd iputils-ping python3 python3.8-venv python3-pip clang-format protobuf-compiler vim
# enable php-7.4
ENV PHP_VESION=php-7.4.33
RUN cd ~ && wget http://mirror.internode.on.net/pub/php/${PHP_VESION}.tar.gz -q --show-progress && tar xvf ${PHP_VESION}.tar.gz && cd ${PHP_VESION} && ./configure --prefix=/opt/${PHP_VESION} --enable-fpm --enable-opcache --enable-debug && make -j && make install
COPY ${PHP_VESION}.tar.gz /repo/${PHP_VESION}.tar.gz
RUN cd /repo && tar xvf ${PHP_VESION}.tar.gz && cd ${PHP_VESION} && ./configure --prefix=/opt/${PHP_VESION} --enable-fpm --enable-opcache --enable-debug && make -j && make install
ENV PATH="$PATH:/opt/php/bin/:/opt/php/sbin/"
COPY php.ini /opt/$PHP_VESION/lib

Expand Down Expand Up @@ -61,8 +62,8 @@ COPY php.ini /opt/$PHP_VESION/lib


# install golang 1.18

RUN wget https://go.dev/dl/go1.18.10.linux-amd64.tar.gz && rm -rf /usr/local/go && tar -C /usr/local -xzf go1.18.10.linux-amd64.tar.gz
COPY go1.18.10.linux-amd64.tar.gz /repo/go1.18.10.linux-amd64.tar.gz
RUN rm -rf /usr/local/go && cd /repo/ && tar -C /usr/local -xzf go1.18.10.linux-amd64.tar.gz
ENV PATH=$PATH:/usr/local/go/bin
ENV GO_PATH=~/go
ENV PATH=$PATH:/$GO_PATH/bin
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@ name: build-wheels
on:
workflow_dispatch:
inputs:
release-testpypi:
description: Do you want to release to test-pypi
required: true
default: "true"
release:
description: Do you want to release to pipy
description: Do you want to release to pypi
required: true
default: "false"

jobs:
build_wheels_pypitest:
if: ${{ github.event.inputs.release-testpypi }} == "true"
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
Expand Down Expand Up @@ -58,7 +63,6 @@ jobs:
publish-pypitest:
needs: build_wheels_pypitest
runs-on: ubuntu-latest
if: ${{ github.event.inputs.release }} == "true"
steps:
- uses: actions/download-artifact@v3
with:
Expand All @@ -78,6 +82,7 @@ jobs:
repository_url: https://test.pypi.org/legacy/

build_wheels:
if: ${{ github.event.inputs.release }} == "true"
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
Expand Down Expand Up @@ -121,7 +126,6 @@ jobs:
publish:
needs: build_wheels
runs-on: ubuntu-latest
if: ${{ github.event.inputs.release }} == "true"
steps:
- uses: actions/download-artifact@v3
with:
Expand Down
21 changes: 5 additions & 16 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,6 @@ jobs:
php-versions: ["7.0"]
steps:
- uses: actions/checkout@v2
# - name: set mysql
# run: |
# sudo service mysql start
# sudo mysql --host='127.0.0.1' --user='root' --password='root' < '/home/runner/work/pinpoint-c-agent/pinpoint-c-agent/testapps/PHP/tests/script.sql'
# - name: set redis
# run: |
# sudo apt-get install redis-server
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
Expand Down Expand Up @@ -117,13 +110,13 @@ jobs:
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- run: |
- name: run unittest
run: |
pip install -r requirements.txt
python setup.py install || echo "failed, but ignore"
# nosetests does not support python3 anymore
# nosetests src/PY/test --ignore-files="TestCoroutines.*"
python -m unittest discover -s src/PY/test -p 'Test*.py'
python -m unittest discover -s src/PY/test
pip install -r plugins/PY/requirements.txt
python -m unittest discover -s plugins/PY/pinpointPy
Collector-agent:
strategy:
matrix:
Expand All @@ -145,8 +138,4 @@ jobs:

- run: |
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest && go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
# cd collector-agent
# go mod download
# go build
# go test ./... -v
cd collector-agent && make && go test ./... -v
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ aclocal.m4
src/PHP/pinpoint_php.dep
testapps/PHP/composer.phar
collector-agent/collector-agent
common/include/common.h
.cache
compile_commands.json
wheelhouse/
Expand Down
10 changes: 4 additions & 6 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
include *.txt README.md NOTICE LICENSE MANIFEST.in
recursive-include common *.cmake *.h *.txt *.in *.cc *.c *.cpp *.h *.inl
recursive-include src/PY *.c *.h
recursive-include plugins/PY/pinpointPy *.py
recursive-exclude plugins/PY/pinpointPy *_test.py
global-exclude *test.py *.pyc Test*.py
#include *.txt README.md NOTICE LICENSE MANIFEST.in
#recursive-include common *.cmake *.h *.txt *.in *.cc *.c *.cpp *.h *.inl
#recursive-include src/PY *.c *.h
#recursive-include plugins/PY/ *.py
Loading

0 comments on commit e2435ce

Please sign in to comment.