Skip to content

Commit

Permalink
Add workflow to upload BPF performance results (#2847)
Browse files Browse the repository at this point in the history
* 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
Alan-Jowett and Alan Jowett authored Sep 16, 2023
1 parent c1ef869 commit f0ec4cc
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 2 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ jobs:
# Always run this job.
# Only run this on repos that have self-host runners.
needs: regular
if: github.repository == 'microsoft/ebpf-for-windows'
if: github.repository == 'microsoft/ebpf-for-windows' && (github.event_name == 'schedule' || github.event_name == 'pull_request' || github.event_name == 'push' || github.event_name == 'merge_group')
uses: ./.github/workflows/reusable-test.yml
with:
pre_test: .\setup_ebpf_cicd_tests.ps1
Expand Down Expand Up @@ -344,6 +344,7 @@ jobs:
# Run the fault injection simulator in GitHub.
fault_injection:
needs: regular
if: github.event_name == 'schedule' || github.event_name == 'pull_request' || github.event_name == 'push' || github.event_name == 'merge_group'
uses: ./.github/workflows/reusable-test.yml
with:
name: fault_injection
Expand All @@ -358,6 +359,7 @@ jobs:
# Run the low memory simulator for netebpfext_unit tests.
fault_injection_netebpfext_unit:
needs: regular
if: github.event_name == 'schedule' || github.event_name == 'pull_request' || github.event_name == 'push' || github.event_name == 'merge_group'
uses: ./.github/workflows/reusable-test.yml
with:
name: netebpfext_fault_injection
Expand All @@ -373,6 +375,7 @@ jobs:
# Added as a 'per-PR' test to catch usersim regressions and/or run-time usage issues.
quick_user_mode_multi_threaded_stress_test:
needs: regular
if: github.event_name == 'schedule' || github.event_name == 'pull_request' || github.event_name == 'push' || github.event_name == 'merge_group'
uses: ./.github/workflows/reusable-test.yml
with:
name: quick_user_mode_multi_threaded_stress
Expand Down Expand Up @@ -498,5 +501,13 @@ jobs:
test_command: .\execute_ebpf_cicd_tests.ps1 -TestMode "Performance" -Options @("CaptureProfile")
post_test: .\cleanup_ebpf_cicd_tests.ps1
build_artifact: Build-x64
environment: ebpf_cicd_perf
configurations: '["Release"]'
environment: ebpf_cicd_perf

upload_perf_results:
needs: performance
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request'
uses: ./.github/workflows/upload-perf-results.yml
with:
name: upload_perf_results
result_artifact: km_performance-x64-Release
77 changes: 77 additions & 0 deletions .github/workflows/upload-perf-results.yml
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

0 comments on commit f0ec4cc

Please sign in to comment.