Skip to content

Commit 1be0923

Browse files
[CI] Add initial workflow for measuring performance
1 parent 02f5d9c commit 1be0923

File tree

1 file changed

+115
-0
lines changed

1 file changed

+115
-0
lines changed

.github/workflows/performance.yml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: Performance
2+
3+
on:
4+
# Can be triggered via manual "dispatch" (from workflow view in GitHub Actions tab)
5+
workflow_dispatch:
6+
inputs:
7+
pr_no:
8+
description: PR number (if 0, it'll run on the main)
9+
type: number
10+
required: true
11+
12+
permissions:
13+
contents: read
14+
pull-requests: write
15+
16+
env:
17+
BUILD_DIR : "${{github.workspace}}/build"
18+
INSTL_DIR : "${{github.workspace}}/../install-dir"
19+
20+
jobs:
21+
perf-l0:
22+
name: Build UMF and run performance tests
23+
runs-on: "L0_PERF"
24+
25+
steps:
26+
# Workspace on self-hosted runners is not cleaned automatically.
27+
# We have to delete the files created outside of using actions.
28+
- name: Cleanup self-hosted workspace
29+
if: always()
30+
run: |
31+
ls -la ./
32+
rm -rf ./* || true
33+
34+
- name: Add comment to PR
35+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
36+
if: ${{ always() && inputs.pr_no != 0 }}
37+
with:
38+
script: |
39+
const pr_no = '${{ inputs.pr_no }}';
40+
const provider = 'LEVEL_ZERO';
41+
const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
42+
const body = `Performance workflow for ${provider}_PROVIDER run:\n${url}`;
43+
44+
github.rest.issues.createComment({
45+
issue_number: pr_no,
46+
owner: context.repo.owner,
47+
repo: context.repo.repo,
48+
body: body
49+
})
50+
51+
- name: Checkout UMF
52+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
53+
54+
- name: Get information about platform
55+
run: .github/scripts/get_system_info.sh
56+
57+
# We need to fetch special ref for proper PR's merge commit. Note, this ref may be absent if the PR is already merged.
58+
- name: Fetch PR's merge commit
59+
if: ${{ inputs.pr_no != 0 }}
60+
working-directory: ${{github.workspace}}
61+
env:
62+
PR_NO: ${{ inputs.pr_no }}
63+
run: |
64+
git fetch -- https://github.com/${{github.repository}} +refs/pull/${PR_NO}/*:refs/remotes/origin/pr/${PR_NO}/*
65+
git checkout origin/pr/${PR_NO}/merge
66+
git rev-parse origin/pr/${PR_NO}/merge
67+
68+
- name: Configure build
69+
run: >
70+
cmake
71+
-B ${{env.BUILD_DIR}}
72+
-DCMAKE_BUILD_TYPE=Release
73+
-DCMAKE_INSTALL_PREFIX="${{env.INSTL_DIR}}"
74+
-DUMF_BUILD_SHARED_LIBRARY=ON
75+
-DUMF_BUILD_BENCHMARKS=ON
76+
-DUMF_BUILD_BENCHMARKS_MT=ON
77+
-DUMF_BUILD_TESTS=OFF
78+
-DUMF_FORMAT_CODE_STYLE=OFF
79+
-DUMF_DEVELOPER_MODE=OFF
80+
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
81+
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
82+
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
83+
84+
- name: Build
85+
run: cmake --build ${{env.BUILD_DIR}} -j $(nproc)
86+
87+
- name: Run benchmarks
88+
id: benchmarks
89+
run: numactl -N 1 ctest -V --test-dir benchmark -C Release
90+
91+
- name: Add comment to PR
92+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
93+
if: ${{ always() && inputs.pr_no != 0 }}
94+
with:
95+
script: |
96+
let markdown = ""
97+
try {
98+
const fs = require('fs');
99+
markdown = fs.readFileSync('umf_perf_results.md', 'utf8');
100+
} catch(err) {
101+
}
102+
103+
const pr_no = '${{ inputs.pr_no }}';
104+
const provider = 'LEVEL_ZERO';
105+
const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
106+
const test_status = '${{ steps.benchmarks.outcome }}';
107+
const job_status = '${{ job.status }}';
108+
const body = `Performance workflow for ${provider}_PROVIDER run:\n${url}\nJob status: ${job_status}. Test status: ${test_status}.\n ${markdown}`;
109+
110+
github.rest.issues.createComment({
111+
issue_number: pr_no,
112+
owner: context.repo.owner,
113+
repo: context.repo.repo,
114+
body: body
115+
})

0 commit comments

Comments
 (0)