Add performance profiling pipeline to perf tests #88
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: Profiling | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: [ dev ] | |
env: | |
TESTS_DIR_PATH: ".ci/perf_tests/k6scripts/" | |
PYTHON_VERSION: "3.8" | |
PORT: 8000 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
test_to_run: [ SyncHttpTriggerHelloWorld ] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ env.PYTHON_VERSION }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Set up Dotnet 2.x | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '3.1.405' | |
- name: Set up Dotnet 6.x | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '6.x' | |
- name: Install dependencies and the worker | |
run: | | |
cd $GITHUB_WORKSPACE | |
python -m pip install -q --upgrade pip | |
python -m pip install -q --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple -U -e .[dev] | |
python -m pip install -q --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple -U azure-functions --pre | |
python setup.py build | |
python setup.py webhost --branch-name=dev | |
python setup.py extension | |
pip install py-spy | |
- name: Build and Run the Docker image | |
run: | | |
docker build --build-arg PYTHON_VERSION=${{ env.PYTHON_VERSION }} --file .ci/perf_tests/dockerfiles/perf_tests.Dockerfile --tag perfimage:latest . | |
container_id=$(docker run -d --shm-size="2g" --env FUNCTIONS_WORKER_RUNTIME_VERSION=${{ env.PYTHON_VERSION }} -p ${PORT}:80 -v $GITHUB_WORKSPACE/azure_functions_worker:/azure-functions-host/workers/python/${{ env.PYTHON_VERSION }}/LINUX/X64/azure_functions_worker perfimage:latest) | |
echo "Container ID is: $container_id" | |
sleep 10 # host needs some time to start. | |
echo "Listing Python processes in the Docker container..." | |
docker ps | |
docker exec $container_id ps aux | grep '[p]ython' || true | |
# - name: Generate Worker Performance Summary | |
# run: | | |
# py-spy record -o profile.svg -- python |