-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (117 loc) · 3.67 KB
/
benchmark-impl.yml
File metadata and controls
124 lines (117 loc) · 3.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: ⚙️ Benchmark
on:
workflow_call: # This is a component workflow
inputs:
python:
required: true
type: string
description: >
Which Pythons to use, as a string or JSON array of strings (the version IDs).
num_elements:
required: true
type: string
description: >
How many elements to make in the workflow, as a number or JSON array of numbers.
platform:
required: true
type: string
description: >
Which OS to use, as a string or JSON array of strings (the runner IDs).
executable_name:
required: true
type: string
description: >
Template parameter.
Root name of executable.
benchmark_make_workflow:
required: true
type: string
description: >
Template parameter.
Path to application workflow used for benchmarking purposes.
ref:
required: true
type: string
description: The `github.ref` to benchmark.
poetry-version:
required: false
type: string
default: "2.1.3"
description: >
The version of Poetry to use.
outputs:
url:
description: >
Where you may download the benchmark data from.
This is a temporary URL with access controls applied.
value: ${{ jobs.upload.outputs.url }}
jobs:
make:
strategy:
fail-fast: false
matrix:
python-version: ${{ fromJSON(inputs.python)}}
os: ${{ fromJSON(inputs.platform)}}
num_elements: ${{ fromJSON(inputs.num_elements)}}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
ref: ${{ inputs.ref }}
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Set up poetry
uses: hpcflow/github-support/setup-poetry@0.4
with:
version: ${{ inputs.poetry-version }}
- name: Cache dependencies
uses: hpcflow/github-support/init-cache@0.4
with:
name: benchmark
version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
poetry install --without dev,pyinstaller
- name: Set up variables
id: vars
run: |
echo "timeit=benchmark_make_workflow_${{ matrix.num_elements }}_elements-${{ runner.os }}-py-${{ matrix.python-version }}.txt" >> $GITHUB_OUTPUT
shell: bash
- name: Run app make workflow command
run: |
poetry run $EXECUTABLE --timeit-file $TIMEIT_FILE make $BENCHMARK --var N $N_ELEMS
env:
EXECUTABLE: ${{ inputs.executable_name }}
BENCHMARK: ${{ inputs.benchmark_make_workflow }}
TIMEIT_FILE: ${{ steps.vars.outputs.timeit }}
N_ELEMS: ${{ matrix.num_elements }}
shell: bash
- name: Store benchmark file
uses: actions/upload-artifact@v6
with:
name: ${{ steps.vars.outputs.timeit }}
path: ${{ steps.vars.outputs.timeit }}
retention-days: 1
upload:
needs: make
outputs:
url: ${{ steps.upload.outputs.artifact-url }}
runs-on: ubuntu-latest
steps:
- name: Make directory
run: |
mkdir benchmarks
- name: Fetch benchmark files
uses: actions/download-artifact@v7
with:
merge-multiple: true
path: benchmarks
- name: Store benchmark data archive
uses: actions/upload-artifact@v6
id: upload
with:
name: benchmarks
path: benchmarks