Rewrite BPF performance YAML to build and test on all platforms #25
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
# Copyright (c) Microsoft Corporation | ||
# SPDX-License-Identifier: MIT | ||
# This workflow will download the latest ebpf-for-windows MSI installer and run | ||
# the BPF performance tests. The results will be uploaded as an artifact. | ||
name: ebpf-for-windows | ||
on: | ||
# Permit manual runs of the workflow. | ||
workflow_dispatch: | ||
inputs: | ||
ref: | ||
description: 'EBPF Branch or Commit' | ||
required: false | ||
default: 'main' | ||
type: string | ||
profile: | ||
description: 'Capture CPU profile' | ||
required: false | ||
default: false | ||
type: boolean | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- .github/workflows/ebpf.yml | ||
repository_dispatch: | ||
types: [run-ebpf] | ||
# Args: { guid, sha, ref, pr } | ||
concurrency: | ||
group: ebpf-${{ github.event.client_payload.pr || github.event.client_payload.sha || inputs.ref || github.event.pull_request.number || 'main' }} | ||
cancel-in-progress: true | ||
permissions: | ||
contents: read | ||
security-events: write # Required by codeql task | ||
jobs: | ||
# For automated identification of the workflow. | ||
name: | ||
name: For ${{ github.event.client_payload.guid }} | ||
if: ${{ github.event_name == 'repository_dispatch' }} | ||
needs: [] | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- run: | | ||
echo "guid: ${{ github.event.client_payload.guid }}" | ||
echo "sha: ${{ github.event.client_payload.sha }}" | ||
echo "ref: ${{ github.event.client_payload.ref }}" | ||
echo "pr: ${{ github.event.client_payload.pr }}" | ||
build: | ||
name: Build ebpf-for-windows | ||
uses: microsoft/ebpf-for-windows/.github/workflows/reusable-build.yml@main | ||
with: | ||
build_artifact: Build-x64 | ||
build_msi: true | ||
build_nuget: true | ||
configurations: '["NativeOnlyRelease"]' | ||
ref: ${{ github.event.client_payload.sha || github.event.client_payload.ref || inputs.ref || 'main' }} | ||
test: | ||
name: Test Windows eBPF Performance | ||
needs: [build] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: ['windows-2022', 'windows-2019'] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Download ebpf-for-windows | ||
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe | ||
with: | ||
name: "ebpf-for-windows - MSI installer (Build-x64_NativeOnlyRelease)" | ||
path: . | ||
- name: Install ebpf-for-windows | ||
run: | | ||
$process = Start-Process -FilePath "msiexec" -ArgumentList "/i ebpf-for-windows.msi /quiet /qn /norestart /log install.log ADDLOCAL=ALL" -Wait -NoNewWindow | ||
echo "C:\Program Files\ebpf-for-windows" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | ||
- name: Upload install log | ||
if: always() | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: install.log | ||
path: install.log | ||
- name: Download bpf_performance repository artifacts | ||
run: | | ||
Invoke-WebRequest https://github.com/microsoft/bpf_performance/releases/download/v0.0.6/build-Release-windows-2022.zip -OutFile bpf_performance.zip | ||
- name: Unzip bpf_performance repository artifacts | ||
run: | | ||
Expand-Archive -Path bpf_performance.zip -DestinationPath . | ||
- name: Run BPF performance tests | ||
run: | | ||
if ("${{inputs.profile}}" -eq "true") { | ||
$pre_command = 'wpr.exe -start CPU' | ||
$post_command = 'wpr.exe -stop ""${{github.workspace}}\ETL\%NAME%.etl""' | ||
mkdir -Force -Path ${{github.workspace}}\ETL | ||
Release\bpf_performance_runner.exe -i tests.yml -e .sys -r --pre "$pre_command" --post "$post_command" | Tee-Object -FilePath result.csv | ||
} | ||
else { | ||
Release\bpf_performance_runner.exe -i tests.yml -e .sys -r | Tee-Object -FilePath result.csv | ||
} | ||
Get-Content result.csv | Where-Object { $_ -notmatch "^Program returned non-zero" } | Set-Content bpf_performance_native.csv | ||
- name: Upload BPF performance test results | ||
if: always() | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: bpf_performance_native_${{ matrix.os }} | ||
path: bpf_performance_native.csv | ||
- name: Uninstall ebpf-for-windows | ||
if: always() | ||
run: | | ||
$process = Start-Process -FilePath "msiexec" -ArgumentList "/x ebpf-for-windows.msi /quiet /norestart /log uninstall.log" -Wait -NoNewWindow | ||
- name: Upload uninstall log | ||
if: always() | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: uninstall.log | ||
path: uninstall.log | ||
- name: Upload CPU profile | ||
if: ${{ inputs.profile == true }} | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: CPU_Profile | ||
path: ETL |