Skip to content

Commit 46240a2

Browse files
committed
Polish GHA workflows
- Bump actions, old ones are deprecated. - Cache Gradle stuff via `gradle/actions/setup-gradle`. - Replace `gw check` with `gw build`, which includes check and the other tasks. - Replace build reports uploading with Gradle build scans published by the Develocity plugins. - Disables redundant jobs for the forked repositories.
1 parent 8228448 commit 46240a2

File tree

4 files changed

+47
-118
lines changed

4 files changed

+47
-118
lines changed

.github/workflows/auto-merge.yml

Lines changed: 15 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313

14-
# The type of runner that the job will run on
1514
runs-on: ubuntu-latest
15+
if: github.event.repository.fork == false
1616

1717
permissions:
1818
contents: write
1919

2020
steps:
21-
# Checkout
22-
- uses: actions/checkout@v2
21+
# Checkout
22+
- uses: actions/checkout@v5
2323
with:
2424
fetch-depth: 0
2525
ref: 2.3.3-release
26-
26+
2727
- name: merge commits from main to release branch
2828
run: |
2929
# Cherry pick new changes from main, except for version bumps.
@@ -41,48 +41,20 @@ jobs:
4141
TO_PICK=$(grep -Fxv -f <(echo "$PICKED"; echo "$VERSION_BUMPS"; echo "$DONT_PICK") <(echo "$CANDIDATES") | awk '{a[i++]=$0} END {for (j=i-1; j>=0;) print a[j--] }')
4242
echo Picking $TO_PICK
4343
if [ -n "$TO_PICK" ]; then git cherry-pick -x --allow-empty $TO_PICK; fi
44-
45-
- name: Setup Java 17
46-
uses: actions/[email protected]
44+
45+
- uses: actions/setup-java@v5
4746
with:
48-
java-version: '17'
49-
java-package: jdk
50-
architecture: x64
51-
47+
java-version: '21'
48+
distribution: 'zulu'
49+
5250
# Build cache
53-
- name: Cache Gradle Cache
54-
uses: actions/cache@v4
55-
with:
56-
path: ~/.gradle/caches
57-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('**/gradle.properties') }}
58-
# An ordered list of keys to use for restoring the cache if no cache hit occurred for key
59-
restore-keys: |
60-
${{ runner.os }}-gradle-
61-
- name: Cache gradle wrapper
62-
uses: actions/cache@v4
63-
with:
64-
path: ~/.gradle/wrapper
65-
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
66-
67-
# Check API compatibility
68-
- name: API compatibility check
69-
run: ./gradlew :api:checkApi
70-
71-
# Run ksp generated tests
72-
- name: test
73-
run: ./gradlew --stacktrace --info check
51+
- name: Cache Gradle
52+
uses: gradle/actions/setup-gradle@v5
53+
54+
# Run build
55+
- name: build
56+
run: ./gradlew --stacktrace --info build
7457

7558
- name: push to release branch
7659
if: success()
7760
run: git fetch && git rebase && git push origin
78-
79-
- name: Upload test results
80-
if: always()
81-
uses: actions/upload-artifact@v4
82-
with:
83-
name: test-reports
84-
path: |
85-
integration-tests/build/reports
86-
gradle-plugin/build/reports
87-
common-util/build/reports
88-
kotlin-analysis-api/build/reports

.github/workflows/main.yml

Lines changed: 11 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ on:
88
pull_request:
99
branches: [ main, '[0-9]+.[0-9]+.[0-9]+-release*' ]
1010
workflow_dispatch:
11-
branches: [ main, '[0-9]+.[0-9]+.[0-9]+-release*' ]
1211

1312
jobs:
1413
build-and-test:
@@ -23,58 +22,29 @@ jobs:
2322
- is_pull_request: true
2423
os: macos-latest
2524

26-
# The type of runner that the job will run on
2725
runs-on: ${{ matrix.os }}
2826

2927
steps:
3028
- name: configure Pagefile
3129
if: matrix.os == 'windows-latest'
32-
uses: al-cheb/configure-pagefile-action@v1.2
30+
uses: al-cheb/configure-pagefile-action@v1.5
3331
with:
3432
minimum-size: 8
3533
maximum-size: 16
3634
disk-root: "D:"
37-
- name: Setup Java 17
38-
uses: actions/setup-java@v1.4.3
35+
36+
- uses: actions/setup-java@v5
3937
with:
40-
java-version: '17'
41-
java-package: jdk
42-
architecture: x64
38+
java-version: '21'
39+
distribution: 'zulu'
4340

4441
# Checkout
45-
- uses: actions/checkout@v2
42+
- uses: actions/checkout@v5
4643

4744
# Build cache
48-
- name: Cache Gradle Cache
49-
uses: actions/cache@v4
50-
with:
51-
path: ~/.gradle/caches
52-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('**/gradle.properties') }}
53-
# An ordered list of keys to use for restoring the cache if no cache hit occurred for key
54-
restore-keys: |
55-
${{ runner.os }}-gradle-
56-
- name: Cache gradle wrapper
57-
uses: actions/cache@v4
58-
with:
59-
path: ~/.gradle/wrapper
60-
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
61-
62-
# Check API compatibility
63-
- name: API compatibility check
64-
if: matrix.os == 'ubuntu-latest'
65-
run: ./gradlew :api:checkApi
45+
- name: Cache Gradle
46+
uses: gradle/actions/setup-gradle@v5
6647

67-
# Run tests
68-
- name: test
69-
shell: bash
70-
run: ./gradlew --stacktrace --info check
71-
- name: Upload test results
72-
if: always()
73-
uses: actions/upload-artifact@v4
74-
with:
75-
name: test-reports-${{ matrix.branch }}-${{ matrix.os }}
76-
path: |
77-
integration-tests/build/reports
78-
gradle-plugin/build/reports
79-
common-util/build/reports
80-
kotlin-analysis-api/build/reports
48+
# Run build
49+
- name: Build
50+
run: ./gradlew --stacktrace --info build

.github/workflows/release.yml

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,57 +9,31 @@ on:
99
jobs:
1010
build-and-test:
1111

12-
# The type of runner that the job will run on
1312
runs-on: ubuntu-latest
13+
if: github.event.repository.fork == false
1414

1515
permissions:
1616
contents: write
1717

1818
steps:
19-
- name: Setup Java 17
20-
uses: actions/[email protected]
19+
- uses: actions/setup-java@v5
2120
with:
22-
java-version: '17'
23-
java-package: jdk
24-
architecture: x64
21+
java-version: '21'
22+
distribution: 'zulu'
2523

2624
# Checkout
27-
- uses: actions/checkout@v2
25+
- uses: actions/checkout@v5
2826

2927
# Build cache
30-
- name: Cache Gradle Cache
31-
uses: actions/cache@v4
32-
with:
33-
path: ~/.gradle/caches
34-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('**/gradle.properties') }}
35-
# An ordered list of keys to use for restoring the cache if no cache hit occurred for key
36-
restore-keys: |
37-
${{ runner.os }}-gradle-
38-
- name: Cache gradle wrapper
39-
uses: actions/cache@v4
40-
with:
41-
path: ~/.gradle/wrapper
42-
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
43-
44-
# Run tests
45-
- name: test
46-
shell: bash
47-
run: ./gradlew --stacktrace --info check
48-
- name: Upload test results
49-
if: always()
50-
uses: actions/upload-artifact@v4
51-
with:
52-
name: test-reports-${{ runner.os }}
53-
path: |
54-
integration-tests/build/reports
55-
gradle-plugin/build/reports
56-
common-util/build/reports
28+
- name: Cache Gradle
29+
uses: gradle/actions/setup-gradle@v5
5730

5831
# Build KSP artifacts
5932
- name: build
6033
run: |
6134
REF=${{ github.ref }} # refs/tags/$KSP_VERSION
6235
./gradlew --info -PkspVersion=${REF:10} -PoutRepo=$(pwd)/build/repos/release publishAllPublicationsToMavenRepository
36+
6337
- name: pack
6438
run: cd build/repos/release/ && zip -r ../../artifacts.zip .
6539
- name: Upload Release Asset

settings.gradle.kts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,19 @@ pluginManagement {
1717
}
1818
}
1919

20+
plugins {
21+
id("com.gradle.develocity") version "4.2.2"
22+
}
23+
24+
develocity {
25+
buildScan {
26+
termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use"
27+
termsOfUseAgree = "yes"
28+
val isCI = providers.environmentVariable("CI").isPresent
29+
publishing.onlyIf { isCI }
30+
}
31+
}
32+
2033
include("api")
2134
include("gradle-plugin")
2235
include("common-deps")

0 commit comments

Comments
 (0)