11
11
description : ' List of perf tests to run'
12
12
required : false
13
13
default : SyncHelloWorld
14
+ report_format :
15
+ description : ' Format of profiling report'
16
+ type : choice
17
+ required : true
18
+ options :
19
+ - speedscope
20
+ - flamegraph
14
21
issue_comment :
15
22
types : [created]
16
23
env :
21
28
22
29
jobs :
23
30
build :
24
- if : ${{ github.event_name == 'workflow_dispatch' || github.event.issue.pull_request && contains(github.event.comment.body, '/profile') }}
31
+ if : ${{ github.event_name == 'workflow_dispatch' || github.event.issue.pull_request != null && contains(github.event.comment.body, '/profile') }}
25
32
runs-on : ubuntu-latest
33
+ permissions : read-all
26
34
strategy :
27
35
fail-fast : false
28
36
matrix :
74
82
docker exec $container_id sh -c "pip install py-spy"
75
83
docker exec $container_id sh -c "mkdir /home/profiling_reports"
76
84
profiling_sampling_rate=${{ github.event.inputs.profiling_sampling_rate }}
77
- # report_name="${GITHUB_REF#refs/heads/}_${{ github.run_id }}.svg"
78
- report_name="${{ github.run_id }}.svg"
79
- docker exec -d $container_id sh -c "RUST_BACKTRACE=1 py-spy record -p $worker_pid -o /home/profiling_reports/$report_name -f flamegraph --idle --nonblocking --rate $profiling_sampling_rate > /home/site/wwwroot/py-spy.log 2>&1 &"
85
+ report_format=${{ github.event.inputs.report_format }}
86
+ if [ "$report_format" == "flamegraph" ]; then
87
+ report_name="${{ github.run_id }}.svg"
88
+ elif [ "$report_format" == "speedscope" ]; then
89
+ report_name="${{ github.run_id }}.speedscope.json"
90
+ else
91
+ echo "Unsupported report format: $report_format"
92
+ exit 1
93
+ fi
94
+ docker exec -d $container_id sh -c "RUST_BACKTRACE=1 py-spy record -p $worker_pid -o /home/profiling_reports/$report_name -f $report_format --idle --nonblocking --rate $profiling_sampling_rate > /home/site/wwwroot/py-spy.log 2>&1 &"
80
95
sleep 2 # Give it a moment to start
81
96
py_spy_id=$(docker exec $container_id sh -c "ps aux | grep '[p]y-spy record'" | awk '{print $2}')
82
97
@@ -94,11 +109,9 @@ jobs:
94
109
docker exec $container_id cat /home/site/wwwroot/py-spy.log
95
110
docker exec $container_id sh -c "kill -2 $py_spy_id"
96
111
sleep 2
97
-
98
112
mkdir profiling_reports
99
113
chmod 777 profiling_reports
100
114
docker cp $container_id:/home/profiling_reports/$report_name profiling_reports
101
-
102
115
- name : Upload SVG to Azure Blob Storage
103
116
uses :
bacongobbler/[email protected]
104
117
with :
@@ -111,7 +124,7 @@ jobs:
111
124
run : |
112
125
blob_url="https://${{ env.PYTHON_FUNCTION_PROFILING_STORAGE_ACCT }}.blob.core.windows.net/profiling/${{ env.report_name }}"
113
126
echo "You can view the Blob at: $blob_url"
114
-
127
+
115
128
- name : Upload profiling result to artifact
116
129
uses : actions/upload-artifact@v2
117
130
with :
0 commit comments