Skip to content

Commit dfea5a5

Browse files
committed
Improve cache isolation
1 parent 235f93c commit dfea5a5

File tree

4 files changed

+73
-35
lines changed

4 files changed

+73
-35
lines changed

.github/workflows/check-build.yml

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,29 @@ jobs:
2323
build:
2424
runs-on: ubuntu-latest
2525
timeout-minutes: 30
26-
2726
strategy:
2827
matrix:
2928
java: [21]
3029
distribution: [temurin]
31-
3230
steps:
3331
- uses: actions/checkout@v5
34-
32+
3533
- name: Set up JDK
3634
uses: actions/setup-java@v5
3735
with:
3836
distribution: ${{ matrix.distribution }}
3937
java-version: ${{ matrix.java }}
40-
cache: 'gradle'
41-
38+
39+
- name: Cache Gradle
40+
uses: actions/cache@v4
41+
with:
42+
path: |
43+
~/.gradle/caches
44+
~/.gradle/wrapper
45+
key: ${{ runner.os }}-gradle-build-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
46+
restore-keys: |
47+
${{ runner.os }}-gradle-build-
48+
4249
- name: Build
4350
run: ./gradlew build buildPlugin --info --stacktrace
4451

@@ -48,7 +55,7 @@ jobs:
4855
with:
4956
name: test-reports-${{ matrix.java }}
5057
path: build/reports/tests/test/**
51-
58+
5259
- name: Check for uncommited changes
5360
run: |
5461
if [[ "$(git status --porcelain)" != "" ]]; then
@@ -78,21 +85,28 @@ jobs:
7885
runs-on: ubuntu-latest
7986
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
8087
timeout-minutes: 15
81-
8288
strategy:
8389
matrix:
8490
java: [21]
8591
distribution: [temurin]
86-
8792
steps:
8893
- uses: actions/checkout@v5
89-
94+
9095
- name: Set up JDK
9196
uses: actions/setup-java@v5
9297
with:
9398
distribution: ${{ matrix.distribution }}
9499
java-version: ${{ matrix.java }}
95-
cache: 'gradle'
100+
101+
- name: Cache Gradle
102+
uses: actions/cache@v4
103+
with:
104+
path: |
105+
~/.gradle/caches
106+
~/.gradle/wrapper
107+
key: ${{ runner.os }}-gradle-checkstyle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
108+
restore-keys: |
109+
${{ runner.os }}-gradle-checkstyle-
96110
97111
- name: Run Checkstyle
98112
run: ./gradlew checkstyleMain checkstyleTest -PcheckstyleEnabled --stacktrace
@@ -101,25 +115,32 @@ jobs:
101115
runs-on: ubuntu-latest
102116
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
103117
timeout-minutes: 15
104-
105118
strategy:
106119
matrix:
107120
java: [21]
108121
distribution: [temurin]
109-
110122
steps:
111123
- uses: actions/checkout@v5
112-
124+
113125
- name: Set up JDK
114126
uses: actions/setup-java@v5
115127
with:
116128
distribution: ${{ matrix.distribution }}
117129
java-version: ${{ matrix.java }}
118-
cache: 'gradle'
119130

120131
- name: Run PMD
121132
run: ./gradlew pmdMain pmdTest -PpmdEnabled --stacktrace
122133

134+
- name: Cache Gradle
135+
uses: actions/cache@v4
136+
with:
137+
path: |
138+
~/.gradle/caches
139+
~/.gradle/wrapper
140+
key: ${{ runner.os }}-gradle-pmd-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
141+
restore-keys: |
142+
${{ runner.os }}-gradle-pmd-
143+
123144
- name: Upload report
124145
if: always()
125146
uses: actions/upload-artifact@v4

.github/workflows/check-ide-compatibility.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Check IDE Compatibility
22

33
on:
44
schedule:
5-
- cron: '55 2 * * 1'
5+
- cron: '55 8 * * 1'
66
workflow_dispatch:
77

88
jobs:
@@ -36,13 +36,23 @@ jobs:
3636
sudo df -h
3737
3838
- uses: actions/checkout@v5
39-
39+
4040
- name: Set up JDK
4141
uses: actions/setup-java@v5
4242
with:
4343
distribution: 'temurin'
4444
java-version: 21
45-
45+
46+
- name: Cache Gradle
47+
uses: actions/cache@v4
48+
with:
49+
path: |
50+
~/.gradle/caches
51+
~/.gradle/wrapper
52+
key: ${{ runner.os }}-gradle-ide-compatibility-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
53+
restore-keys: |
54+
${{ runner.os }}-gradle-ide-compatibility-
55+
4656
- name: Check compatibility
4757
run: ./gradlew verifyPlugin --info --stacktrace
4858

.github/workflows/release.yml

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,26 @@ jobs:
1414
timeout-minutes: 30
1515
steps:
1616
- uses: actions/checkout@v5
17-
17+
1818
- name: Set up JDK
1919
uses: actions/setup-java@v5
2020
with:
2121
java-version: '21'
2222
distribution: 'temurin'
23-
cache: 'gradle'
23+
24+
- name: Try restore Gradle Cache
25+
uses: actions/cache/restore@v4
26+
with:
27+
path: |
28+
~/.gradle/caches
29+
~/.gradle/wrapper
30+
key: ${{ runner.os }}-gradle-build-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
31+
restore-keys: |
32+
${{ runner.os }}-gradle-build-
2433
2534
- name: Build
2635
run: ./gradlew build buildPlugin --info --stacktrace
27-
36+
2837
- name: Check for uncommited changes
2938
run: |
3039
if [[ "$(git status --porcelain)" != "" ]]; then
@@ -51,12 +60,12 @@ jobs:
5160
upload_url: ${{ steps.create_release.outputs.upload_url }}
5261
steps:
5362
- uses: actions/checkout@v5
54-
63+
5564
- name: Configure Git
5665
run: |
5766
git config --global user.email "[email protected]"
5867
git config --global user.name "GitHub Actions"
59-
68+
6069
- name: UN-Snap version and output
6170
id: version
6271
run: |
@@ -71,15 +80,15 @@ jobs:
7180
7281
echo "Contents of gradle.properties"
7382
cat gradle.properties
74-
83+
7584
- name: Commit and Push
7685
run: |
7786
git add -A
7887
git commit -m "Release ${{ steps.version.outputs.release }}"
7988
git push origin
8089
git tag v${{ steps.version.outputs.release }}
8190
git push origin --tags
82-
91+
8392
- name: Create Release
8493
id: create_release
8594
uses: shogo82148/actions-create-release@4661dc54f7b4b564074e9fbf73884d960de569a3 # v1
@@ -104,20 +113,19 @@ jobs:
104113
timeout-minutes: 60
105114
steps:
106115
- uses: actions/checkout@v5
107-
116+
108117
- name: Set up JDK
109118
uses: actions/setup-java@v5
110119
with:
111120
distribution: 'temurin'
112121
java-version: 21
113-
cache: 'gradle'
114-
122+
115123
- name: Init Git and pull
116124
run: |
117125
git config --global user.email "[email protected]"
118126
git config --global user.name "GitHub Actions"
119127
git pull
120-
128+
121129
- name: Publish Plugin
122130
env:
123131
PUBLISH_TOKEN: ${{ secrets.JETBRAINS_MARKETPLACE_PUBLISH_TOKEN }}
@@ -138,20 +146,20 @@ jobs:
138146
timeout-minutes: 10
139147
steps:
140148
- uses: actions/checkout@v5
141-
149+
142150
- name: Init Git and pull
143151
run: |
144152
git config --global user.email "[email protected]"
145153
git config --global user.name "GitHub Actions"
146154
git pull
147-
155+
148156
- name: Inc Version and SNAP root
149157
run: |
150158
originalVersion=$(grep -Po 'pluginVersion=\K.*' gradle.properties)
151159
newVersion="$(echo $originalVersion | cut -d '-' -f1 | awk -F. -v OFS=. 'NF==1{print ++$NF}; NF>1{$NF=sprintf("%0*d", length($NF), ($NF+1)); print}')-SNAPSHOT"
152160
echo "New version: $newVersion"
153161
sed -i "s/pluginVersion=$originalVersion/pluginVersion=$newVersion/" gradle.properties
154-
162+
155163
echo "Contents of gradle.properties"
156164
cat gradle.properties
157165
@@ -160,7 +168,7 @@ jobs:
160168
git add -A
161169
git commit -m "Preparing for next development iteration"
162170
git push origin
163-
171+
164172
- name: pull-request
165173
env:
166174
GH_TOKEN: ${{ github.token }}

.github/workflows/test-deploy.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ jobs:
1515
with:
1616
distribution: 'temurin'
1717
java-version: 21
18-
cache: 'gradle'
19-
18+
2019
- name: Update/Generify version
2120
run: |
2221
originalVersion=$(grep -Po 'pluginVersion=\K.*' gradle.properties)
@@ -26,7 +25,7 @@ jobs:
2625
2726
echo "Contents of gradle.properties"
2827
cat gradle.properties
29-
28+
3029
- name: Publish Plugin
3130
env:
3231
PUBLISH_TOKEN: ${{ secrets.JETBRAINS_MARKETPLACE_PUBLISH_TOKEN }}

0 commit comments

Comments
 (0)