1- name : " Check new library versions"
1+ name : Check new library versions for batch
22
3- # The workflow runs bi-weekly alternating with the scheduled release workflow. This way we have enough time to provide metadata for failing tests.
4- # In case we need more scans, there is a possibility to trigger the workflow manually.
53on :
6- schedule :
7- - cron : " 0 0 8 * *"
8- - cron : " 0 0 22 * *"
4+ workflow_call :
5+ inputs :
6+ items :
7+ required : true
8+ type : string
9+ batch_id :
10+ required : true
11+ type : string
912 workflow_dispatch :
13+ inputs :
14+ items :
15+ required : true
16+ description : " JSON array of batch items"
17+ type : string
18+ batch_id :
19+ required : true
20+ description : " Represents the unique id of this batch"
21+ type : string
1022
11- permissions :
12- contents : write
13- actions : write
23+ permissions : write-all
1424
1525concurrency :
16- group : " workflow = ${{ github.workflow }}, ref = ${{ github.event.ref }}, pr = ${{ github.event.pull_request.id }}"
17- cancel-in-progress : true
26+ group : " workflow = ${{ github.workflow }}, batch = ${{ inputs.batch_id }}"
27+ cancel-in-progress : false
1828
1929jobs :
20- get-all-libraries :
30+ process-batch :
2131 if : github.repository == 'oracle/graalvm-reachability-metadata'
22- name : " 📋 Get list of all supported libraries with newer versions "
32+ name : " 🧪 Processing ${{ matrix.item }} "
2333 permissions : write-all
24- runs-on : " ubuntu-22.04"
25- timeout-minutes : 5
26- env :
27- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
28- outputs :
29- matrix : ${{ steps.set-matrix.outputs.matrix }}
30- steps :
31- - name : " ☁️ Checkout repository"
32- uses : actions/checkout@v4
33- - name : " 🔧 Prepare environment"
34- uses : graalvm/setup-graalvm@v1
35- with :
36- java-version : ' 21'
37- distribution : ' graalvm'
38- github-token : ${{ secrets.GITHUB_TOKEN }}
39- - name : " 🕸️ Populate matrix"
40- id : set-matrix
41- run : |
42- ./gradlew fetchExistingLibrariesWithNewerVersions --matrixLimit=200
43- - name : " 🔨 Create branch"
44- run : |
45- git config --local user.email "[email protected] " 46- git config --local user.name "Github Actions"
47- git switch -C check-new-library-versions/$(date '+%Y-%m-%d')
48- git push origin check-new-library-versions/$(date '+%Y-%m-%d')
49-
50- test-all-metadata :
51- name : " 🧪 ${{ matrix.coordinates }} (GraalVM for JDK ${{ matrix.version }} @ ${{ matrix.os }})"
52- permissions : write-all
53- runs-on : ${{ matrix.os }}
34+ runs-on : ubuntu-22.04
5435 timeout-minutes : 20
5536 env :
5637 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
57- needs : get-all-libraries
5838 strategy :
5939 fail-fast : false
60- matrix : ${{ fromJson(needs.get-all-libraries.outputs.matrix) }}
40+ matrix :
41+ item : ${{ fromJson(inputs.items) }}
6142 steps :
6243 - name : " ☁️ Checkout repository"
6344 uses : actions/checkout@v4
45+
46+ - name : " Install tools"
47+ run : |
48+ sudo apt-get update
49+ sudo apt-get install -y jq
50+
6451 - name : " 🔧 Setup java"
6552 uses : actions/setup-java@v4
6653 with :
6754 distribution : ' oracle'
6855 java-version : ' 21'
56+
6957 - name : " 🔧 Prepare environment"
7058 uses : graalvm/setup-graalvm@v1
7159 with :
7260 set-java-home : ' false'
73- java-version : ${{ matrix.version }}
61+ java-version : 21
7462 distribution : ' graalvm'
7563 github-token : ${{ secrets.GITHUB_TOKEN }}
7664 native-image-job-reports : ' true'
65+
7766 - name : " Extract test path and library version"
7867 run : |
79- LIBRARY_PATH=$(echo ${{ matrix.coordinates }} | cut -d ':' -f1-2 | sed 's/:/\//g')
68+ LIBRARY_PATH=$(echo ${{ matrix.item }} | cut -d ':' -f1-2 | sed 's/:/\//g')
8069 LATEST_VERSION=$(find tests/src/$LIBRARY_PATH/* -maxdepth 1 -type d | sort -V | tail -1 | cut -d '/' -f5)
8170 TEST_PATH="$LIBRARY_PATH/$LATEST_VERSION"
8271 TEST_COORDINATES=$(echo "$TEST_PATH" | tr / :)
8372
8473 echo "LATEST_VERSION=$LATEST_VERSION" >> ${GITHUB_ENV}
8574 echo "TEST_PATH=$TEST_PATH" >> ${GITHUB_ENV}
8675 echo "TEST_COORDINATES=$TEST_COORDINATES" >> ${GITHUB_ENV}
76+
8777 - name : " Pull allowed docker images"
8878 run : |
8979 ./gradlew pullAllowedDockerImages --coordinates=${{ env.TEST_COORDINATES }}
80+
9081 - name : " Disable docker"
9182 run : |
9283 sudo apt-get install openbsd-inetd
@@ -96,22 +87,26 @@ jobs:
9687 sudo bash -c "cat ./.github/workflows/dockerd.service > /etc/systemd/system/docker.service.d/http-proxy.conf"
9788 sudo systemctl daemon-reload
9889 sudo systemctl restart docker
90+
9991 - name : " 🧪 Run '${{ env.TEST_COORDINATES }}' tests"
10092 run : |
101- TESTING_VERSION=$(echo ${{ matrix.coordinates }} | cut -d ":" -f3)
93+ TESTING_VERSION=$(echo ${{ matrix.item }} | cut -d ":" -f3)
10294 export GVM_TCK_LV=$TESTING_VERSION
10395
10496 ./gradlew test -Pcoordinates=${{ env.TEST_COORDINATES }}
97+
10598 - name : " ✔️ New library is supported"
10699 if : success()
107100 run : |
108- bash ./.github/workflows/tryPushVersionsUpdate.sh ${{ matrix.coordinates }} ${{ env.LATEST_VERSION }}
101+ bash ./.github/workflows/tryPushVersionsUpdate.sh ${{ matrix.item }} ${{ env.LATEST_VERSION }} ${{ inputs.batch_id }}
102+
109103 - name : " ❗ New library is not supported"
110104 if : failure()
111105 run : |
112- LIB=$(echo "${{ matrix.coordinates }}" | sed 's/:/_/g')
106+ LIB=$(echo "${{ matrix.item }}" | sed 's/:/_/g')
113107 touch $LIB
114108 echo "UNSUPPORTED_LIB=$LIB" >> $GITHUB_ENV
109+
115110 - name : " Upload artifacts"
116111 if : failure()
117112 id : upload
@@ -127,8 +122,7 @@ jobs:
127122 runs-on : " ubuntu-22.04"
128123 if : ${{ always() }}
129124 needs :
130- - get-all-libraries
131- - test-all-metadata
125+ - process-batch
132126 permissions : write-all
133127 env :
134128 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
@@ -144,25 +138,52 @@ jobs:
144138 run : |
145139 git config --local user.email "[email protected] " 146140 git config --local user.name "Github Actions"
147- git fetch origin check-new-library-versions/$(date '+%Y-%m-%d')
148- git checkout check-new-library-versions/$(date '+%Y-%m-%d')
141+ git fetch origin check-new-library-versions/batch-id-${{ inputs.batch_id }}/ $(date '+%Y-%m-%d')
142+ git checkout check-new-library-versions/batch-id-${{ inputs.batch_id }}/ $(date '+%Y-%m-%d')
149143 gh pr create --title "Update supported library versions" --body "This pull request updates supported versions of the existing libraries in the repo"
150144 - name : " Download artifacts for unsupported versions"
151145 uses : actions/download-artifact@v4
152146 with :
153147 path : ./unsupported
154148 - name : " ✏️ Issue for unsupported versions"
155149 run : |
156- git config --local user.email "[email protected] " 157- git config --local user.name "Github Actions"
150+ if [ -d "unsupported" ]; then
151+
152+ cd unsupported
153+ git config --local user.email "[email protected] " 154+ git config --local user.name "Github Actions"
155+
156+ # Map from <group_artifact> to list of versions
157+ declare -A failures
158+
159+ for FILENAME in *; do
160+ GROUPID=$(echo "$FILENAME" | cut -d'_' -f1)
161+ ARTIFACTID=$(echo "$FILENAME" | cut -d'_' -f2)
162+ VERSION=$(echo "$FILENAME" | cut -d'_' -f3)
163+ GA="${GROUPID}:${ARTIFACTID}"
164+ failures["$GA"]+="${VERSION}"$'\n'
165+ done
166+
167+ for GA in "${!failures[@]}"; do
168+ TITLE="Failure for $GA"
169+ EXISTING_ISSUE_URL=$(gh issue list --state "open" --search "$TITLE" --json title,url | jq -r ".[] | select(.title==\"$TITLE\") | .url")
170+
171+ BODY="${failures[$GA]}"
172+
173+ if [ -n "$EXISTING_ISSUE_URL" ]; then
174+ # issue exists, just append new failures
175+ EXISTING_BODY=$(gh issue view "$EXISTING_ISSUE_URL" --json body -q .body)
158176
159- LABEL="library-update"
160- ALL_LIBRARIES=$(ls unsupported)
161- FORMATTED_BODY=$(./gradlew -q groupLibrariesByName --libraries="$ALL_LIBRARIES")
177+ for VERSION in ${failures[$GA]}; do
178+ if ! grep -q "$VERSION" <<< "$EXISTING_BODY"; then
179+ EXISTING_BODY="${EXISTING_BODY}"$'\n'"$VERSION"
180+ fi
181+ done
162182
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
183+ gh issue edit "$EXISTING_ISSUE_URL" --body "$EXISTING_BODY"
184+ else
185+ # Create new issue with all versions
186+ gh issue create --title "$TITLE" --body "$BODY" --label library-update
187+ fi
188+ done
168189 fi
0 commit comments