-
Notifications
You must be signed in to change notification settings - Fork 436
208 lines (182 loc) · 7.14 KB
/
parparvm-tests.yml
File metadata and controls
208 lines (182 loc) · 7.14 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
name: ParparVM Java Tests
on:
pull_request:
paths:
- 'vm/**'
- '!vm/**/README.md'
- '!vm/**/readme.md'
- '!vm/**/docs/**'
push:
branches: [ master, main ]
paths:
- 'vm/**'
- '!vm/**/README.md'
- '!vm/**/readme.md'
- '!vm/**/docs/**'
release:
types:
- published
jobs:
vm-tests:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install native build tools
run: |
sudo apt-get update
sudo apt-get install -y clang
# Install JDKs and export their paths
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
- name: Save JDK 8 Path
run: echo "JDK_8_HOME=$JAVA_HOME" >> $GITHUB_ENV
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- name: Save JDK 11 Path
run: echo "JDK_11_HOME=$JAVA_HOME" >> $GITHUB_ENV
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Save JDK 17 Path
run: echo "JDK_17_HOME=$JAVA_HOME" >> $GITHUB_ENV
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Save JDK 21 Path
run: echo "JDK_21_HOME=$JAVA_HOME" >> $GITHUB_ENV
- name: Set up JDK 25
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '25'
- name: Save JDK 25 Path
run: echo "JDK_25_HOME=$JAVA_HOME" >> $GITHUB_ENV
# Restore JDK 8 as the main runner
- name: Restore JDK 8
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
cache: 'maven'
- name: Run ParparVM JVM tests
working-directory: vm
run: mvn -B clean package -pl JavaAPI -am -DskipTests && mvn -B test -pl tests -am -DexcludedGroups=benchmark
env:
JDK_8_HOME: ${{ env.JDK_8_HOME }}
JDK_11_HOME: ${{ env.JDK_11_HOME }}
JDK_17_HOME: ${{ env.JDK_17_HOME }}
JDK_21_HOME: ${{ env.JDK_21_HOME }}
JDK_25_HOME: ${{ env.JDK_25_HOME }}
- name: Run ParparVM Benchmark
working-directory: vm
run: mvn -B test -pl tests -am -Dgroups=benchmark -Djacoco.skip=true
env:
JDK_8_HOME: ${{ env.JDK_8_HOME }}
JDK_11_HOME: ${{ env.JDK_11_HOME }}
JDK_17_HOME: ${{ env.JDK_17_HOME }}
JDK_21_HOME: ${{ env.JDK_21_HOME }}
JDK_25_HOME: ${{ env.JDK_25_HOME }}
- name: Publish ByteCodeTranslator quality previews
if: ${{ always() && github.server_url == 'https://github.com' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
id: publish-bytecode-quality-previews
env:
GITHUB_TOKEN: ${{ github.token }}
SERVER_URL: ${{ github.server_url }}
REPOSITORY: ${{ github.repository }}
RUN_ID: ${{ github.run_id }}
RUN_ATTEMPT: ${{ github.run_attempt }}
run: |
set -euo pipefail
if [ "${SERVER_URL}" != "https://github.com" ]; then
echo "HTML previews are only published for github.com instances."
exit 0
fi
coverage_dir="vm/tests/target/site/jacoco"
if [ ! -f "${coverage_dir}/index.html" ]; then
echo "No HTML outputs detected; skipping preview publishing."
exit 0
fi
run_dir="runs/${RUN_ID}-${RUN_ATTEMPT}"
tmp_dir=$(mktemp -d)
dest_dir="${tmp_dir}/${run_dir}/coverage"
mkdir -p "${dest_dir}"
cp -R "${coverage_dir}/." "${dest_dir}/"
printf '%s\n%s\n%s\n' \
'# Quality report previews' \
'' \
'This branch is automatically managed by the PR CI workflow and may be force-pushed.' \
> "${tmp_dir}/README.md"
git -C "${tmp_dir}" init -b previews >/dev/null
git -C "${tmp_dir}" config user.name "github-actions[bot]"
git -C "${tmp_dir}" config user.email "github-actions[bot]@users.noreply.github.com"
git -C "${tmp_dir}" add .
git -C "${tmp_dir}" commit -m "Publish quality report previews for run ${RUN_ID} (attempt ${RUN_ATTEMPT})" >/dev/null
remote_url="${SERVER_URL}/${REPOSITORY}.git"
token_remote_url="${remote_url/https:\/\//https://x-access-token:${GITHUB_TOKEN}@}"
git -C "${tmp_dir}" push --force "${token_remote_url}" previews:quality-report-previews >/dev/null
commit_sha=$(git -C "${tmp_dir}" rev-parse HEAD)
raw_base="https://raw.githubusercontent.com/${REPOSITORY}/${commit_sha}/${run_dir}"
preview_base="https://htmlpreview.github.io/?${raw_base}"
echo "jacoco_url=${preview_base}/coverage/index.html" >> "$GITHUB_OUTPUT"
- name: Generate ByteCodeTranslator quality report
if: ${{ always() }}
env:
QUALITY_REPORT_TARGET_DIRS: vm/tests/target
QUALITY_REPORT_SERVER_URL: ${{ github.server_url }}
QUALITY_REPORT_REPOSITORY: ${{ github.repository }}
QUALITY_REPORT_REF: ${{ github.event.pull_request.head.sha || github.sha }}
QUALITY_REPORT_TITLE: "✅ ByteCodeTranslator Quality Report"
JACOCO_HTML_URL: ${{ steps.publish-bytecode-quality-previews.outputs.jacoco_url }}
run: python3 .github/scripts/generate-quality-report.py
- name: Publish ByteCodeTranslator quality comment
if: ${{ github.event_name == 'pull_request' }}
uses: actions/github-script@v7
with:
script: |
const { publishQualityComment } = require('./.github/scripts/publish-quality-comment.js');
await publishQualityComment({
github,
context,
core,
marker: '<!-- bytecode-quality-report -->',
reportPath: 'quality-report.md',
});
release-jars:
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
cache: 'maven'
- name: Build release jars
run: |
mvn -B -f vm/JavaAPI/pom.xml package
mvn -B -f vm/ByteCodeTranslator/pom.xml package
- name: Verify release jars
run: |
test -f vm/JavaAPI/target/JavaAPI-1.0-SNAPSHOT.jar
test -f vm/ByteCodeTranslator/target/ByteCodeTranslator-1.0-SNAPSHOT.jar
- name: Attach JavaAPI and ByteCodeTranslator jars to release
uses: softprops/action-gh-release@v1
with:
files: |
vm/JavaAPI/target/JavaAPI-1.0-SNAPSHOT.jar
vm/ByteCodeTranslator/target/ByteCodeTranslator-1.0-SNAPSHOT.jar