Skip to content

Commit b8bbd49

Browse files
committed
Cache included Micronaut Core checkout in CI
1 parent ad6cd4a commit b8bbd49

3 files changed

Lines changed: 90 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,22 @@ jobs:
4242
with:
4343
fetch-depth: 0
4444

45+
- name: Resolve Micronaut Core checkout cache key
46+
id: micronaut_core
47+
run: |
48+
set -euo pipefail
49+
sha="$(git ls-remote https://github.com/micronaut-projects/micronaut-core.git refs/heads/cdi-5.1.x | cut -f1)"
50+
test -n "${sha}"
51+
echo "sha=${sha}" >> "$GITHUB_OUTPUT"
52+
53+
- name: Cache Micronaut Core included build checkout
54+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
55+
with:
56+
path: checkouts/micronaut-core-cdi
57+
key: ${{ runner.os }}-micronaut-core-cdi-${{ steps.micronaut_core.outputs.sha }}
58+
restore-keys: |
59+
${{ runner.os }}-micronaut-core-cdi-
60+
4561
- name: Setup GraalVM CE
4662
uses: graalvm/setup-graalvm@bef4b0e916c7dd079bf60fb95d49139f67e32c5f # v1
4763
with:
@@ -76,12 +92,37 @@ jobs:
7692

7793
- name: Publish to Github Pages
7894
if: success() && github.event_name == 'push' && matrix.java == '25'
79-
uses: micronaut-projects/github-pages-deploy-action@76d63aafbab7108d74e83be4e5b3b0501382e829 # master
8095
env:
81-
TARGET_REPOSITORY: ${{ github.repository }}
82-
GH_TOKEN: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
83-
BRANCH: gh-pages
84-
FOLDER: build/docs
96+
GH_TOKEN: ${{ github.token }}
97+
run: |
98+
set -euo pipefail
99+
100+
docs_branch="gh-pages"
101+
docs_dir="$(mktemp -d)"
102+
repository_url="https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
103+
104+
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
105+
git config --global user.name "${GITHUB_ACTOR}"
106+
107+
if git ls-remote --exit-code --heads "${repository_url}" "${docs_branch}" > /dev/null 2>&1; then
108+
git clone --depth 1 --branch "${docs_branch}" "${repository_url}" "${docs_dir}"
109+
else
110+
git init "${docs_dir}"
111+
git -C "${docs_dir}" checkout -b "${docs_branch}"
112+
git -C "${docs_dir}" remote add origin "${repository_url}"
113+
fi
114+
115+
find "${docs_dir}" -mindepth 1 -maxdepth 1 ! -name .git -exec rm -rf {} +
116+
cp -R build/docs/. "${docs_dir}/"
117+
touch "${docs_dir}/.nojekyll"
118+
119+
git -C "${docs_dir}" add -A
120+
if git -C "${docs_dir}" diff --cached --quiet; then
121+
echo "No documentation changes to publish."
122+
else
123+
git -C "${docs_dir}" commit -m "Deploy docs for ${GITHUB_SHA}"
124+
git -C "${docs_dir}" push origin "${docs_branch}"
125+
fi
85126
86127
- name: Optional cleanup step
87128
run: |

.github/workflows/graalvm-latest.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,20 @@ jobs:
1515
matrix: ${{ steps.build-matrix.outputs.matrix }}
1616
steps:
1717
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
18+
- name: Resolve Micronaut Core checkout cache key
19+
id: micronaut_core
20+
run: |
21+
set -euo pipefail
22+
sha="$(git ls-remote https://github.com/micronaut-projects/micronaut-core.git refs/heads/cdi-5.1.x | cut -f1)"
23+
test -n "${sha}"
24+
echo "sha=${sha}" >> "$GITHUB_OUTPUT"
25+
- name: Cache Micronaut Core included build checkout
26+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
27+
with:
28+
path: checkouts/micronaut-core-cdi
29+
key: ${{ runner.os }}-micronaut-core-cdi-${{ steps.micronaut_core.outputs.sha }}
30+
restore-keys: |
31+
${{ runner.os }}-micronaut-core-cdi-
1832
- name: Build Matrix
1933
uses: micronaut-projects/github-actions/graalvm/build-matrix@300bf6db7c062dcba77c90bb90e475df31b2acab # master
2034
id: build-matrix
@@ -39,6 +53,20 @@ jobs:
3953
unset JAVA_HOME
4054
export PATH=$(echo "$PATH" | tr ':' '\n' | grep -v '/usr/lib/jvm' | paste -sd:)
4155
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
56+
- name: Resolve Micronaut Core checkout cache key
57+
id: micronaut_core
58+
run: |
59+
set -euo pipefail
60+
sha="$(git ls-remote https://github.com/micronaut-projects/micronaut-core.git refs/heads/cdi-5.1.x | cut -f1)"
61+
test -n "${sha}"
62+
echo "sha=${sha}" >> "$GITHUB_OUTPUT"
63+
- name: Cache Micronaut Core included build checkout
64+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
65+
with:
66+
path: checkouts/micronaut-core-cdi
67+
key: ${{ runner.os }}-micronaut-core-cdi-${{ steps.micronaut_core.outputs.sha }}
68+
restore-keys: |
69+
${{ runner.os }}-micronaut-core-cdi-
4270
- name: Pre-Build Steps
4371
uses: micronaut-projects/github-actions/graalvm/pre-build@300bf6db7c062dcba77c90bb90e475df31b2acab # master
4472
id: pre-build

.github/workflows/tck.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,22 @@ jobs:
3232
with:
3333
fetch-depth: 0
3434

35+
- name: Resolve Micronaut Core checkout cache key
36+
id: micronaut_core
37+
run: |
38+
set -euo pipefail
39+
sha="$(git ls-remote https://github.com/micronaut-projects/micronaut-core.git refs/heads/cdi-5.1.x | cut -f1)"
40+
test -n "${sha}"
41+
echo "sha=${sha}" >> "$GITHUB_OUTPUT"
42+
43+
- name: Cache Micronaut Core included build checkout
44+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
45+
with:
46+
path: checkouts/micronaut-core-cdi
47+
key: ${{ runner.os }}-micronaut-core-cdi-${{ steps.micronaut_core.outputs.sha }}
48+
restore-keys: |
49+
${{ runner.os }}-micronaut-core-cdi-
50+
3551
- name: Setup GraalVM CE
3652
uses: graalvm/setup-graalvm@bef4b0e916c7dd079bf60fb95d49139f67e32c5f # v1
3753
with:

0 commit comments

Comments
 (0)