-
Notifications
You must be signed in to change notification settings - Fork 19
122 lines (106 loc) · 3.93 KB
/
benchmark.yml
File metadata and controls
122 lines (106 loc) · 3.93 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
# This workflow benchmarks the library API using a previously successful build.
#
# It is triggered manually and requires the user to input the workflow run ID of the build.
name: Benchmark
on:
workflow_dispatch:
inputs:
run_id:
description: "Workflow run ID of a successful build"
required: true
jobs:
benchmark:
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
steps:
- name: Get workflow run info
id: get_run_info
uses: actions/github-script@v7
env:
RUN_ID: ${{ github.event.inputs.run_id }}
with:
script: |
const runId = parseInt(process.env.RUN_ID, 10);
if (isNaN(runId) || runId <= 0) {
core.setFailed('Invalid run_id: must be a positive integer');
return;
}
const { data: run } = await github.rest.actions.getWorkflowRun({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: runId
});
core.setOutput('commit_sha', run.head_sha);
core.setOutput('run_id', runId);
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ steps.get_run_info.outputs.commit_sha }}
- name: Set up build environment
uses: ./.github/actions/setup-build-tools
with:
java: "true"
sonar-cache: "false"
- name: Download JARs from specified run
uses: actions/download-artifact@v4
with:
name: jars
run-id: ${{ steps.get_run_info.outputs.run_id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
path: jars/
- name: Get version from POM
id: get_version
run: |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout -f utilities/pom.xml)
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Get short SHA
id: get_short_sha
run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Install artifacts
run: |
VERSION="${{ steps.get_version.outputs.version }}"
# Install parent POM.
mvn install:install-file \
-Dfile=pom.xml \
-DpomFile=pom.xml \
-DgroupId=au.csiro.pathling \
-DartifactId=pathling \
-Dversion=$VERSION \
-Dpackaging=pom
# Install modules in dependency order.
for MODULE in utilities encoders terminology fhirpath library-api library-runtime; do
# Install main JAR.
mvn install:install-file \
-Dfile=jars/$MODULE/target/$MODULE-$VERSION.jar \
-DpomFile=$MODULE/pom.xml \
-DgroupId=au.csiro.pathling \
-DartifactId=$MODULE \
-Dversion=$VERSION \
-Dpackaging=jar
# Install sources JAR.
mvn install:install-file \
-Dfile=jars/$MODULE/target/$MODULE-$VERSION-sources.jar \
-DpomFile=$MODULE/pom.xml \
-DgroupId=au.csiro.pathling \
-DartifactId=$MODULE \
-Dversion=$VERSION \
-Dpackaging=jar \
-Dclassifier=sources
done
- name: Build benchmark JAR
run: mvn --batch-mode package -pl benchmark
- name: Run benchmark
run: |
java -Xshare:off -Xmx8g -ea -Duser.timezone=UTC \
--add-exports=java.base/sun.nio.ch=ALL-UNNAMED \
--add-opens=java.base/java.net=ALL-UNNAMED \
-jar benchmark/target/benchmark-${{ steps.get_version.outputs.version }}.jar \
-rf json -rff benchmark-${{ steps.get_short_sha.outputs.short_sha }}.json
- name: Save results
uses: actions/upload-artifact@v4
with:
name: benchmark-results-${{ steps.get_short_sha.outputs.short_sha }}
path: benchmark-*.json