Skip to content

Commit d297cea

Browse files
committed
caching
1 parent d1af7e8 commit d297cea

4 files changed

Lines changed: 33 additions & 50 deletions

File tree

.github/actions/setup_cached_java/action.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,18 @@ inputs:
1010
description: "The architecture"
1111
required: true
1212
default: "amd64"
13+
github_token:
14+
description: "GitHub Token for triggering workflows"
15+
required: true
1316

1417
runs:
1518
using: composite
1619
steps:
20+
- name: Install GitHub CLI
21+
shell: bash
22+
run: |
23+
sudo apt update
24+
sudo apt install -y gh
1725
- name: Infer Build JDK
1826
shell: bash
1927
id: infer_build_jdk
@@ -25,6 +33,7 @@ runs:
2533
echo "::set-output name=build_jdk::jdk11"
2634
fi
2735
- name: Cache Build JDK [${{ inputs.arch }}]
36+
id: cache_build_jdk
2837
uses: actions/cache/restore@v4
2938
with:
3039
path: |
@@ -33,13 +42,32 @@ runs:
3342
restore-keys: |
3443
${{ steps.infer_build_jdk.outputs.build_jdk }}-${{ inputs.arch }}--
3544
- name: Cache JDK ${{ inputs.version }} [${{ inputs.arch }}]
45+
id: cache_jdk
3646
uses: actions/cache/restore@v4
3747
with:
3848
path: |
3949
jdks/jdk${{ inputs.version }}
4050
key: jdk${{ inputs.version }}-${{ inputs.arch }}--${{ hashFiles('.github/workflows/cache_java.yml', '.github/scripts/java_setup.sh') }}
4151
restore-keys: |
4252
jdk${{ inputs.version }}-${{ inputs.arch }}--
53+
- name: Refresh JDK cache
54+
if: steps.cache_jdk.outputs.cache-hit != 'true' || steps.cache_build_jdk.outputs.cache-hit != 'true' || 'true' == 'true'
55+
shell: bash
56+
env:
57+
GH_TOKEN: ${{ inputs.github_token }}
58+
run: |
59+
echo "JDK cache miss detected! Triggering refresh workflow..."
60+
gh workflow run cache_java.yml
61+
- name: Wait for JDK cache refresh
62+
if: steps.cache_jdk.outputs.cache-hit != 'true' || steps.cache_build_jdk.outputs.cache-hit != 'true' || 'true' == 'true'
63+
shell: bash
64+
env:
65+
GH_TOKEN: ${{ inputs.github_token }}
66+
run: |
67+
while gh run list --workflow="cache_java.yml" --status="in_progress" | grep -q cache_java; do
68+
echo "Waiting for JDK cache refresh to complete..."
69+
sleep 10
70+
done
4371
- name: Setup Environment
4472
shell: bash
4573
run: |

.github/scripts/prepare_reports.sh

100644100755
File mode changed.

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ on:
1616
permissions:
1717
contents: read
1818
pull-requests: read
19-
actions: read
19+
actions: write
2020

2121
jobs:
2222
check-for-pr:

.github/workflows/test_workflow.yml

Lines changed: 4 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99

1010
permissions:
1111
contents: read
12-
actions: read
12+
actions: write
1313

1414
jobs:
1515
test-linux-glibc-amd64:
@@ -57,6 +57,7 @@ jobs:
5757
with:
5858
version: ${{ matrix.java_version }}
5959
arch: 'amd64'
60+
github_token: ${{ secrets.GITHUB_TOKEN }}
6061
- name: Setup OS
6162
if: steps.set_enabled.outputs.enabled == 'true'
6263
run: |
@@ -67,22 +68,6 @@ jobs:
6768
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 100 --slave /usr/bin/g++ g++ /usr/bin/g++-9
6869
sudo update-alternatives --set gcc /usr/bin/gcc-9
6970
fi
70-
- name: Refresh JDK cache
71-
if: steps.cache-jdk.outputs.cache-hit != 'true'
72-
env:
73-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74-
run: |
75-
echo "JDK cache miss detected! Triggering refresh workflow..."
76-
gh workflow run cache-java.yml
77-
- name: Wait for JDK cache refresh
78-
if: steps.cache-jdk.outputs.cache-hit != 'true'
79-
env:
80-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81-
run: |
82-
while gh run list --workflow="cache-java.yml" --status="in_progress" | grep -q cache-java; do
83-
echo "Waiting for JDK cache refresh to complete..."
84-
sleep 10
85-
done
8671
- name: Extract Versions
8772
if: steps.set_enabled.outputs.enabled == 'true'
8873
uses: ./.github/actions/extract_versions
@@ -163,22 +148,7 @@ jobs:
163148
with:
164149
version: ${{ matrix.java_version }}
165150
arch: 'amd64-musl'
166-
- name: Refresh JDK cache
167-
if: steps.cache-jdk.outputs.cache-hit != 'true'
168-
env:
169-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
170-
run: |
171-
echo "JDK cache miss detected! Triggering refresh workflow..."
172-
gh workflow run cache-java.yml
173-
- name: Wait for JDK cache refresh
174-
if: steps.cache-jdk.outputs.cache-hit != 'true'
175-
env:
176-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
177-
run: |
178-
while gh run list --workflow="cache-java.yml" --status="in_progress" | grep -q cache-java; do
179-
echo "Waiting for JDK cache refresh to complete..."
180-
sleep 10
181-
done
151+
github_token: ${{ secrets.GITHUB_TOKEN }}
182152
- name: Extract Versions
183153
uses: ./.github/actions/extract_versions
184154
- name: Test
@@ -277,6 +247,7 @@ jobs:
277247
with:
278248
version: ${{ matrix.java_version }}
279249
arch: 'aarch64'
250+
github_token: ${{ secrets.GITHUB_TOKEN }}
280251
- name: Setup OS
281252
if: steps.set_enabled.outputs.enabled == 'true'
282253
run: |
@@ -289,22 +260,6 @@ jobs:
289260
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 100 --slave /usr/bin/g++ g++ /usr/bin/g++-9
290261
sudo update-alternatives --set gcc /usr/bin/gcc-9
291262
fi
292-
- name: Refresh JDK cache
293-
if: steps.cache-jdk.outputs.cache-hit != 'true'
294-
env:
295-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
296-
run: |
297-
echo "JDK cache miss detected! Triggering refresh workflow..."
298-
gh workflow run cache-java.yml
299-
- name: Wait for JDK cache refresh
300-
if: steps.cache-jdk.outputs.cache-hit != 'true'
301-
env:
302-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
303-
run: |
304-
while gh run list --workflow="cache-java.yml" --status="in_progress" | grep -q cache-java; do
305-
echo "Waiting for JDK cache refresh to complete..."
306-
sleep 10
307-
done
308263
- name: Extract Versions
309264
if: steps.set_enabled.outputs.enabled == 'true'
310265
uses: ./.github/actions/extract_versions

0 commit comments

Comments
 (0)