Skip to content

Commit

Permalink
Fix veristat baseline cache save/restore
Browse files Browse the repository at this point in the history
Github cache has S3-like structure, where key is a bucket and files
specified in the path argument makes its content.
Due to that fact save and restore actions MUST have the same path
argument.

Signed-off-by: Nikolay Yurin <[email protected]>
  • Loading branch information
yurinnick committed Sep 13, 2023
1 parent 3060688 commit b2b6e72
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 21 deletions.
29 changes: 14 additions & 15 deletions .github/actions/veristat_baseline_compare/action.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: 'run-veristat'
description: 'Run veristat benchmark'
inputs:
arch_and_tool:
description: 'arch and build tool string'
required: true
veristat_output:
description: 'veristat output'
description: 'Veristat output filepath'
required: true
baseline_name:
description: 'Veristat baseline cache name'
required: true
runs:
using: "composite"
steps:
- uses: actions/upload-artifact@v3
with:
name: ${{ inputs.arch_and_tool }}-baseline-${{ inputs.veristat_output }}
name: ${{ inputs.baseline_name }}
if-no-files-found: error
path: ${{ github.workspace }}/${{ inputs.veristat_output }}

Expand All @@ -22,27 +22,26 @@ runs:
- if: ${{ github.event_name == 'pull_request' }}
uses: actions/cache/restore@v3
with:
key: ${{ env.CACHE_RESULT_KEY }}
key: ${{ inputs.baseline_name }}
restore-keys: |
${{ env.CACHE_RESULT_KEY }}-
path: '${{ env.CACHE_RESULT_KEY }}'
env:
CACHE_RESULT_KEY: ${{ inputs.arch_and_tool }}-baseline-${{ inputs.veristat_output }}
${{ inputs.baseline_name }}-
path: '${{ github.workspace }}/${{ inputs.baseline_name }}'

- if: ${{ github.event_name == 'pull_request' }}
name: Show veristat comparison
shell: bash
run: ./.github/scripts/compare-veristat-results.sh
env:
CACHE_RESULT_KEY: ${{ inputs.arch_and_tool }}-baseline-${{ inputs.veristat_output }}
BASELINE_PATH: ${{ github.workspace }}/${{ inputs.baseline_name }}
VERISTAT_OUTPUT: ${{ inputs.veristat_output }}

# For push: just put baseline log to cache
- if: ${{ github.event_name == 'push' }}
run: |
mv "${{ github.workspace }}/${{ inputs.veristat_output }}" \
"${{ github.workspace }}/${{ inputs.baseline_name }}"
uses: actions/cache/save@v3
with:
key: ${{ env.CACHE_RESULT_KEY }}-${{ github.run_id }}
path: '${{ github.workspace }}/${{ inputs.veristat_output }}'
env:
CACHE_RESULT_KEY: ${{ inputs.arch_and_tool }}-baseline-${{ inputs.veristat_output }}

path: '${{ github.workspace }}/${{ inputs.baseline_name }}'
8 changes: 4 additions & 4 deletions .github/scripts/compare-veristat-results.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash

if [[ ! -f "${CACHE_RESULT_KEY}" ]]; then
echo "# No ${CACHE_RESULT_KEY} available" >> "${GITHUB_STEP_SUMMARY}"
if [[ ! -f "${BASELINE_PATH}" ]]; then
echo "# No ${BASELINE_PATH} available" >> "${GITHUB_STEP_SUMMARY}"

echo "No ${CACHE_RESULT_KEY} available"
echo "No ${BASELINE_PATH} available"
echo "Printing veristat results"
cat "${VERISTAT_OUTPUT}"

Expand All @@ -13,6 +13,6 @@ fi
selftests/bpf/veristat \
--output-format csv \
--emit file,prog,verdict,states \
--compare "${CACHE_RESULT_KEY}" "${VERISTAT_OUTPUT}" > compare.csv
--compare "${BASELINE_PATH}" "${VERISTAT_OUTPUT}" > compare.csv

python3 ./.github/scripts/veristat-compare.py compare.csv
6 changes: 4 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,13 @@ jobs:
- name: Compare and save veristat.kernel.csv
uses: ./.github/actions/veristat_baseline_compare
with:
arch_and_tool: ${{ env.ARCH_AND_TOOL}}
veristat_output: veristat-kernel
baseline_name: ${{ env.ARCH_AND_TOOL}}-baseline-veristat-kernel

- name: Compare and save veristat.meta.csv
uses: ./.github/actions/veristat_baseline_compare
with:
arch_and_tool: ${{ env.ARCH_AND_TOOL}}
veristat_output: veristat-meta
baseline_name: ${{ env.ARCH_AND_TOOL}}-baseline-veristat-meta


0 comments on commit b2b6e72

Please sign in to comment.