Skip to content

Commit 680aa8e

Browse files
authored
Use Artifacts to Collect Unsupported Library Versions from Parallel Jobs (#572)
* Use artifacts to collect results from failed jobs * Check existing issue url against null
1 parent 2c091ef commit 680aa8e

File tree

3 files changed

+33
-29
lines changed

3 files changed

+33
-29
lines changed

.github/workflows/check-new-library-versions.yml

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ jobs:
2727
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2828
outputs:
2929
matrix: ${{ steps.set-matrix.outputs.matrix }}
30-
issue: ${{ steps.set-issue.outputs.issue }}
3130
steps:
3231
- name: "☁️ Checkout repository"
3332
uses: actions/checkout@v4
@@ -47,14 +46,6 @@ jobs:
4746
git config --local user.name "Github Actions"
4847
git switch -C check-new-library-versions/$(date '+%Y-%m-%d')
4948
git push origin check-new-library-versions/$(date '+%Y-%m-%d')
50-
- name: "🔨 Create issue"
51-
id: set-issue
52-
run: |
53-
git config --local user.email "actions@github.com"
54-
git config --local user.name "Github Actions"
55-
56-
issue_url=$(gh issue create --title "List unsupported library versions" --body "This issue lists unsupported versions of the existing libraries in the repo")
57-
echo "::set-output name=issue::$issue_url"
5849
5950
test-all-metadata:
6051
name: "🧪 ${{ matrix.coordinates }} (GraalVM for JDK ${{ matrix.version }} @ ${{ matrix.os }})"
@@ -118,9 +109,18 @@ jobs:
118109
- name: "❗ New library is not supported"
119110
if: failure()
120111
run: |
121-
git config --local user.email "actions@github.com"
122-
git config --local user.name "Github Actions"
123-
gh issue comment "${{ needs.get-all-libraries.outputs.issue }}" --body "${{ matrix.coordinates }}"
112+
LIB=$(echo "${{ matrix.coordinates }}" | sed 's/:/_/g')
113+
touch $LIB
114+
echo "UNSUPPORTED_LIB=$LIB" >> $GITHUB_ENV
115+
- name: "Upload artifacts"
116+
if: failure()
117+
id: upload
118+
continue-on-error: true
119+
uses: actions/upload-artifact@v4
120+
with:
121+
name: ${{ env.UNSUPPORTED_LIB }}
122+
path: ${{ env.UNSUPPORTED_LIB }}
123+
retention-days: 1
124124

125125
process-results:
126126
name: "🧪 Process results"
@@ -147,13 +147,22 @@ jobs:
147147
git fetch origin check-new-library-versions/$(date '+%Y-%m-%d')
148148
git checkout check-new-library-versions/$(date '+%Y-%m-%d')
149149
gh pr create --title "Update supported library versions" --body "This pull request updates supported versions of the existing libraries in the repo"
150-
- name: "✏️ Edit issue for unsupported versions"
150+
- name: "Download artifacts for unsupported versions"
151+
uses: actions/download-artifact@v4
152+
with:
153+
path: ./unsupported
154+
- name: "✏️ Issue for unsupported versions"
151155
run: |
152156
git config --local user.email "actions@github.com"
153157
git config --local user.name "Github Actions"
154-
ALL_COMMENTS=$(gh issue view "${{ needs.get-all-libraries.outputs.issue }}" --comments)
155158
156-
FORMATTED_BODY=$(./gradlew -q extractLibrariesGroupsFromGithubComments --comments="$ALL_COMMENTS")
157-
gh issue create --title "List unsupported libraries versions" --body "$FORMATTED_BODY"
159+
LABEL="library-update"
160+
ALL_LIBRARIES=$(ls unsupported)
161+
FORMATTED_BODY=$(./gradlew -q groupLibrariesByName --libraries="$ALL_LIBRARIES")
158162
159-
gh issue close "${{ needs.get-all-libraries.outputs.issue }}"
163+
EXISTING_ISSUE=$(gh issue list --label "$LABEL" --state open --limit 1 --json url | jq -r '.[0].url')
164+
if [ $EXISTING_ISSUE != "null" ]; then
165+
gh issue edit $EXISTING_ISSUE --body "$FORMATTED_BODY"
166+
else
167+
gh issue create --title "List unsupported libraries versions" --body "$FORMATTED_BODY" --label $LABEL
168+
fi

tests/tck-build-logic/src/main/groovy/org.graalvm.internal.tck-harness.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ tasks.register("fetchExistingLibrariesWithNewerVersions", FetchExistingLibraries
171171
task.setAllLibraryCoordinates(matchingCoordinates)
172172
}
173173

174-
tasks.register("extractLibrariesGroupsFromGithubComments", GroupUnsupportedLibraries.class) { task ->
174+
tasks.register("groupLibrariesByName", GroupUnsupportedLibraries.class) { task ->
175175
task.setGroup(METADATA_GROUP)
176176
task.setDescription("Extracts groups of libraries from github comments provided in a form of string.")
177177
}

tests/tck-build-logic/src/main/groovy/org/graalvm/internal/tck/harness/tasks/GroupUnsupportedLibraries.groovy

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,19 @@ import org.gradle.api.tasks.TaskAction
77
import org.gradle.api.tasks.options.Option
88
import org.gradle.util.internal.VersionNumber
99

10-
import java.util.regex.Matcher
11-
import java.util.regex.Pattern
12-
1310
abstract class GroupUnsupportedLibraries extends DefaultTask {
1411

1512
@Input
16-
@Option(option = "comments", description = "Provides github comments for library grouping as string.")
17-
abstract Property<String> getGithubComments()
13+
@Option(option = "libraries", description = "Provides list of libraries that should be grouped.")
14+
abstract Property<String> getLibraries()
1815

1916
@TaskAction
2017
void action() {
21-
def pattern = Pattern.compile("--[\n ](.*?)[\n ]--")
22-
def matcher = pattern.matcher(getGithubComments().get())
18+
def libraries = getLibraries().get().split("\n")
2319

24-
def libraryGroups = new HashMap<String, List<String>>()
25-
while (matcher.find()) {
26-
def coordinates = matcher.group(1)
27-
def coordinatesPart = coordinates.split(":")
20+
Map<String, List<String>> libraryGroups = new HashMap<String, List<String>>()
21+
for (def library : libraries) {
22+
def coordinatesPart = library.split("_")
2823
def artifactKey = coordinatesPart[0] + ":" + coordinatesPart[1]
2924
def version = coordinatesPart[2]
3025

0 commit comments

Comments
 (0)