microsoft/qdk

Public

mirrored fromhttps://github.com/microsoft/qdkAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
copilot/fix-wasm-logging-issue

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

.github/workflows/memory_profile.yml

83lines · modecode

1name: Benchmark Reports
2
3on:
4 pull_request:
5 branches: "main"
6 types:
7 - opened
8 - reopened
9 - synchronize
10 - ready_for_review
11 merge_group:
12 workflow_dispatch:
13
14env:
15 CARGO_TERM_COLOR: always
16 NODE_VERSION: "22.14.0"
17 PYTHON_VERSION: "3.11"
18 RUST_TOOLCHAIN_VERSION: "1.93"
19 RUST_TOOLCHAIN_COMPONENTS: rustfmt clippy
20
21jobs:
22 runMemoryProfile:
23 if: ${{ !github.event.pull_request.draft }}
24 name: run memory profile
25 runs-on: ubuntu-latest
26 permissions:
27 contents: read
28 pull-requests: write
29 steps:
30 - uses: actions/checkout@v6
31 with:
32 ref: main
33 - uses: actions/cache@v4
34 with:
35 path: |
36 ~/.cargo/bin/
37 ~/.cargo/registry/index/
38 ~/.cargo/registry/cache/
39 ~/.cargo/git/db/
40 target/
41 key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
42 - run: |
43 MAIN_MEASUREMENT=$(cargo run --bin memtest)
44 echo "MAIN_MEASUREMENT<<EOF" >> $GITHUB_ENV
45 echo "$MAIN_MEASUREMENT" >> $GITHUB_ENV
46 echo "EOF" >> $GITHUB_ENV
47 - run: |
48 echo "${{env.MAIN_MEASUREMENT}}"
49 echo $MAIN_MEASUREMENT
50
51 - uses: actions/checkout@v6
52 - run: |
53 BRANCH_MEASUREMENT=$(cargo run --bin memtest)
54 echo "BRANCH_MEASUREMENT<<EOF" >> $GITHUB_ENV
55 echo "$BRANCH_MEASUREMENT" >> $GITHUB_ENV
56 echo "EOF" >> $GITHUB_ENV
57 - run: |
58 echo "${{env.BRANCH_MEASUREMENT}}"
59 echo $BRANCH_MEASUREMENT
60 - uses: actions/github-script@v8
61 with:
62 script: |
63 if (${{ env.BRANCH_MEASUREMENT }} !== ${{ env.MAIN_MEASUREMENT }}) {
64 const difference = ${{ env.BRANCH_MEASUREMENT }} - ${{ env.MAIN_MEASUREMENT }};
65 try {
66 await github.rest.issues.createComment({
67 issue_number: context.issue.number,
68 owner: context.repo.owner,
69 repo: context.repo.repo,
70 body: `_Change in memory usage detected by benchmark._
71 ## Memory Report for ${{ github.sha }}
72
73 | Test | This Branch | On Main | Difference |
74 |-----------------------------|-------------|----------| ---------- |
75 | compile core + standard lib | ${{ env.BRANCH_MEASUREMENT }} bytes | ${{ env.MAIN_MEASUREMENT }} bytes | ${difference} bytes`
76 })
77 } catch (err) {
78 core.warning(`Failed writing comment on GitHub issue: ${err}`)
79 }
80 } else {
81 console.log("no change in memory usage detected by benchmark");
82 }
83 if: ${{ github.base_ref != null }}
84