-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow to upload BPF performance results (#2847)
* Add workflow to upload BPF performance results Signed-off-by: Alan Jowett <[email protected]> * Run perf on PR Signed-off-by: Alan Jowett <[email protected]> * Fix paths Signed-off-by: Alan Jowett <[email protected]> * Add script to gather CSV from artifact Signed-off-by: Alan Jowett <[email protected]> * Fix permissions Signed-off-by: Alan Jowett <[email protected]> * Remove checking into git for now Signed-off-by: Alan Jowett <[email protected]> * Update scripts Signed-off-by: Alan Jowett <[email protected]> * Update scripts Signed-off-by: Alan Jowett <[email protected]> * Skip perf upload for pull request * PR feedback Signed-off-by: Alan Jowett <[email protected]> * PR feedback Signed-off-by: Alan Jowett <[email protected]> --------- Signed-off-by: Alan Jowett <[email protected]> Co-authored-by: Alan Jowett <[email protected]>
- Loading branch information
1 parent
c1ef869
commit f0ec4cc
Showing
2 changed files
with
90 additions
and
2 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Copyright (c) Microsoft Corporation | ||
# SPDX-License-Identifier: MIT | ||
|
||
# This workflow executes a single test, optionally gathering code coverage and logs. | ||
|
||
name: Reusable Test Workflow | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
name: | ||
required: true | ||
type: string | ||
result_artifact: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
upload_results: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download performance result artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: Test-Logs-${{inputs.result_artifact}} | ||
path: ${{github.workspace}}/results_artifact | ||
|
||
- name: Gather CSV results into results directory | ||
run: | | ||
mkdir -p ${{github.workspace}}/results/${{github.sha}} | ||
curl https://raw.githubusercontent.com/microsoft/bpf_performance/1a50dae54c0c1d8b7f73331936e69a7154b3f659/scripts/gather_csv.sh > gather_csv.sh | ||
sha256sum gather_csv.sh | grep a279517d50093eaa46778642620ec11b2c07f47ace61c4d854982e23c46f22fa -q || exit 1 | ||
chmod a+x gather_csv.sh | ||
./gather_csv.sh ${{github.workspace}}/results_artifact ${{github.workspace}}/results/${{github.sha}}/results | ||
- name: Post-process results | ||
run: | | ||
# Download script to convert CSV to SQL from GitHub. | ||
curl https://raw.githubusercontent.com/microsoft/bpf_performance/ee798c5b299ea7e798503106e9d3d3884bec2833/scripts/process_results.py > process_results.py | ||
# Compare hash of downloaded script. | ||
sha256sum process_results.py | grep dc616f27b6d345e8086de451ffd3f73cc71b5d51d18894ce08c02db56d67e0f4 -q || exit 1 | ||
# Run script to convert CSV to SQL. | ||
python3 ./process_results.py --csv-directory ${{github.workspace}}/results --sql-script-file ${{github.workspace}}/results/upload.sql --commit_id ${{github.sha}} --platform "Windows 2019" --repository ${{github.repository}} | ||
- name: Log into Azure | ||
uses: azure/login@v1 | ||
with: | ||
client-id: ${{ secrets.AZURE_CLIENT_ID }} | ||
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | ||
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
|
||
- name: Fetch secrets | ||
run: | | ||
az keyvault secret show --vault-name bpfperformacesecrets --name PGDATABASE --query value | sed 's/"//g' > ${{github.workspace}}/PGDATABASE | ||
az keyvault secret show --vault-name bpfperformacesecrets --name PGHOST --query value | sed 's/"//g' >> ${{github.workspace}}/PGHOST | ||
az keyvault secret show --vault-name bpfperformacesecrets --name PGUSER --query value | sed 's/"//g' >> ${{github.workspace}}/PGUSER | ||
az keyvault secret show --vault-name bpfperformacesecrets --name PGPASSWORD --query value | sed 's/"//g' >> ${{github.workspace}}/PGPASSWORD | ||
az keyvault secret show --vault-name bpfperformacesecrets --name PGPORT --query value | sed 's/"//g' >> ${{github.workspace}}/PGPORT | ||
- name: Upload results to POSTGRES | ||
run: | | ||
export PGPASSWORD=$(cat ${{github.workspace}}/PGPASSWORD) | ||
export PGHOST=$(cat ${{github.workspace}}/PGHOST) | ||
export PGUSER=$(cat ${{github.workspace}}/PGUSER) | ||
export PGPORT=$(cat ${{github.workspace}}/PGPORT) | ||
export PGDATABASE=$(cat ${{github.workspace}}/PGDATABASE) | ||
psql -f ${{github.workspace}}/results/upload.sql | ||
- name: Upload results to POSTGRES | ||
env: | ||
PGHOST: ${{secrets.PGHOST}} | ||
PGUSER: ${{secrets.PGUSER}} | ||
PGPORT: ${{secrets.PGPORT}} | ||
PGDATABASE: ${{secrets.PGDATABASE}} | ||
PGPASSWORD: ${{secrets.PGPASSWORD}} | ||
run: | | ||
psql -f ${{github.workspace}}/results/upload.sql |