Debian Codegraph @

others/mbedtls/tf-psa-crypto/drivers/pqcp/mldsa-native/.github/actions/bench/action.yml

raw symbols SCIP
1 # Copyright (c) The mlkem-native project authors
2 # Copyright (c) The mldsa-native project authors
3 # SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
4
5 name: Bench mldsa-native
6 description: Run benchmarking script
7
8 inputs:
9 name:
10 description: Name for the benchmarking run
11 required: true
12 perf:
13 description: Method of obtaining PMU metrics
14 required: true
15 default: "PERF"
16 cflags:
17 description: CFLAGS to pass to compilation
18 default: ""
19 archflags:
20 description: ARCHFLAGS to pass to compilation
21 default: ""
22 ldflags:
23 description: LDFLAGS to pass to compilation
24 default: ""
25 opt:
26 description: opt flag to set for tests script
27 default: "true"
28 bench_extra_args:
29 description: Further arguments to be appended to command line for `bench` script
30 default: ""
31 store_results:
32 description: Whether to push results to GH pages
33 default: "false"
34 gh_token:
35 description: GitHub access token
36 required: true
37 nix-shell:
38 description: Run in the specified Nix environment if exists
39 default: "ci-bench"
40 nix-cache:
41 description: Determine whether to enable nix cache
42 default: 'false'
43 nix-verbose:
44 description: Determine wether to suppress nix log or not
45 default: 'false'
46 custom_shell:
47 description: The shell to use. Only relevant if no nix-shell specified
48 default: "bash"
49 cross_prefix:
50 description: "Binary prefix for cross-compilation builds"
51 default: ""
52 alert_threshold:
53 description: "Set alert threshold in percentage for benchmark result"
54 default: "103%"
55 runs:
56 using: composite
57 steps:
58 - uses: ./.github/actions/setup-shell
59 with:
60 nix-shell: ${{ inputs.nix-shell }}
61 nix-cache: ${{ inputs.nix-cache }}
62 nix-verbose: ${{ inputs.nix-verbose }}
63 gh_token: ${{ inputs.gh_token }}
64 custom_shell: ${{ inputs.custom_shell }}
65 script: |
66 ARCH=$(uname -m)
67 cat >> $GITHUB_STEP_SUMMARY <<-EOF
68 ## Setup
69 Architecture: $ARCH
70 - $(uname -a)
71 - $(nix --version)
72 - $(${{ matrix.target.cross_prefix }}gcc --version | grep -m1 "")
73 - $(bash --version | grep -m1 "")
74
75 ## CPU Info
76 $(cat /proc/cpuinfo)
77 EOF
78 - name: Run benchmark
79 shell: ${{ env.SHELL }}
80 run: |
81 ./scripts/tests bench -c ${{ inputs.perf }} --cross-prefix="${{ inputs.cross_prefix }}" \
82 --cflags="${{ inputs.cflags }} ${{ inputs.archflags }}" \
83 --ldflags="${{ inputs.ldflags }}" \
84 --opt=$([[ ${{ inputs.opt }} == "false" ]] && echo "no_opt" || echo "opt") \
85 -v --output=output.json ${{ inputs.bench_extra_args }}
86
87 ./scripts/tests bench --components -c ${{ inputs.perf }} --cross-prefix="${{ inputs.cross_prefix }}" \
88 --cflags="${{ inputs.cflags }} ${{ inputs.archflags }}" \
89 --ldflags="${{ inputs.ldflags }}" \
90 --opt=$([[ ${{ inputs.opt }} == "false" ]] && echo "no_opt" || echo "opt") \
91 -v ${{ inputs.bench_extra_args }}
92 - name: Check namespace
93 shell: ${{ env.SHELL }}
94 run: |
95 check-namespace
96 - name: Store benchmark result
97 uses: benchmark-action/github-action-benchmark@d48d326b4ca9ba73ca0cd0d59f108f9e02a381c7 # v1.20.4
98 with:
99 name: ${{ inputs.name }}
100 tool: "customSmallerIsBetter"
101 output-file-path: output.json
102 github-token: ${{ inputs.gh_token }}
103 auto-push: ${{ inputs.store_results == 'true' }}
104 comment-on-alert: true
105 summary-always: true
106 alert-threshold: ${{ inputs.alert_threshold }}
107 comment-always: true
108 - name: Reset gh-pages if result is not pushed to gh-pages
109 shell: ${{ env.SHELL }}
110 if: ${{ inputs.store_results != 'true' }}
111 run: |
112 git -c advice.detachedHead=false switch gh-pages
113 git reset --hard HEAD~1
114 git checkout -