Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
168 changes: 116 additions & 52 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,92 +1,152 @@
# BUILDCACHE_USER
# BUILDCACHE_PASS
# - rw access to buildcache.diffplug.com
name: CI 🏭
name: CI
on:
pull_request:
push:
branches: [main, release]
branches: [ main, release ]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
sanity-check:
name: Sanity Check 🦢
name: Sanity Check
runs-on: ubuntu-latest
env:
buildcacheuser: ${{ secrets.BUILDCACHE_USER }}
buildcachepass: ${{ secrets.BUILDCACHE_PASS }}
# Only push to the remote build cache on push events to prevent cache pollution and poisoning from PRs.
buildcacheuser: ${{ github.event_name == 'push' && secrets.BUILDCACHE_USER || '' }}
buildcachepass: ${{ github.event_name == 'push' && secrets.BUILDCACHE_PASS || '' }}
steps:
- name: Checkout
uses: actions/checkout@v6
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-java@v5
with:
distribution: "temurin"
java-version: 21
- name: gradle caching
uses: gradle/actions/setup-gradle@v6
- name: Spotless ✨
run: ./gradlew spotlessCheck
- name: assemble testClasses
run: ./gradlew assemble testClasses
build:
- uses: gradle/actions/setup-gradle@v6
- run: ./gradlew spotlessCheck
- run: ./gradlew assemble testClasses

build-gradle:
name: Gradle (Java ${{ matrix.jre }}, ${{ matrix.os }})
needs: sanity-check
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
jre: [ 17, 21, 24 ] # Test on all supported LTS and latest JDK.
include:
- os: windows-latest
jre: 24 # Test on the latest JDK for speeds.
runs-on: ${{ matrix.os }}
steps:
Comment on lines +46 to +47

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need this for now? But it should only be set on main pushes, see

spotless/settings.gradle

Lines 34 to 42 in cd8b6e2

// but we only push if it's a trusted build (not PRs)
String user = cred('buildcacheuser')
String pass = cred('buildcachepass')
if (user != null && pass != null) {
push = true
credentials {
username = user
password = pass
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's okay with me if it gets removed, but I believe the buildcache is working and does gain us a fair amount of speedup.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refined a bit.

# Only push to the remote build cache on push events to prevent cache pollution and poisoning from PRs.
buildcacheuser: ${{ github.event_name == 'push' && secrets.BUILDCACHE_USER || '' }}
buildcachepass: ${{ github.event_name == 'push' && secrets.BUILDCACHE_PASS || '' }}
steps:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

- uses: actions/checkout@v6
- uses: actions/setup-java@v5
with:
distribution: "temurin"
java-version: ${{ matrix.jre }}
- uses: gradle/actions/setup-gradle@v6
- run: ./gradlew build -x spotlessCheck -PSPOTLESS_EXCLUDE_MAVEN=true
- name: junit result
uses: mikepenz/action-junit-report@v6
if: always()
with:
check_name: JUnit Gradle ${{ matrix.jre }} ${{ matrix.os }}
report_paths: '*/build/test-results/*/TEST-*.xml'
check_retries: true

build-maven:
name: Maven (Java ${{ matrix.jre }}, ${{ matrix.os }})
needs: sanity-check
strategy:
fail-fast: false
matrix:
kind: [maven, gradle]
# Test on the latest Java version once Gradle & Maven support it.
jre: [17, 21, 24]
os: [ubuntu-latest, windows-latest]
os: [ ubuntu-latest ]
jre: [ 17, 21, 24 ] # Test on all supported LTS and latest JDK.
include:
# npm on linux only (crazy slow on windows)
- kind: npm
jre: 17
os: ubuntu-latest
- kind: shfmt
jre: 17
os: ubuntu-latest
shfmt-version: v3.8.0
- kind: idea
jre: 17
os: ubuntu-latest
- os: windows-latest
jre: 24 # Test on the latest JDK for speeds.
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v6
- uses: actions/checkout@v6
- uses: actions/setup-java@v5
with:
distribution: "temurin"
java-version: ${{ matrix.jre }}
- name: gradle caching
uses: gradle/actions/setup-gradle@v6
- name: build (maven-only)
if: matrix.kind == 'maven'
run: ./gradlew :plugin-maven:build -x spotlessCheck
- name: build (everything-but-maven)
if: matrix.kind == 'gradle'
run: ./gradlew build -x spotlessCheck -PSPOTLESS_EXCLUDE_MAVEN=true
- name: test npm
if: matrix.kind == 'npm'
run: ./gradlew testNpm
- name: Setup go
if: matrix.kind == 'shfmt'
uses: actions/setup-go@v6
- uses: gradle/actions/setup-gradle@v6
- run: ./gradlew :plugin-maven:build -x spotlessCheck
- name: junit result
uses: mikepenz/action-junit-report@v6
if: always()
with:
check_name: JUnit Maven ${{ matrix.jre }} ${{ matrix.os }}
report_paths: '*/build/test-results/*/TEST-*.xml'
check_retries: true

test-npm:
name: NPM
needs: sanity-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-java@v5
with:
distribution: "temurin"
java-version: 17
- uses: gradle/actions/setup-gradle@v6
- run: ./gradlew testNpm
- name: junit result
uses: mikepenz/action-junit-report@v6
if: always()
with:
check_name: JUnit NPM
report_paths: '*/build/test-results/*/TEST-*.xml'
check_retries: true

test-shfmt:
name: Shfmt
needs: sanity-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-java@v5
with:
distribution: "temurin"
java-version: 17
- uses: gradle/actions/setup-gradle@v6
- uses: actions/setup-go@v6
with:
go-version: 'stable'
- name: Install shfmt
if: matrix.kind == 'shfmt'
run: |
go install mvdan.cc/sh/v3/cmd/shfmt@${{ matrix.shfmt-version }}
go install mvdan.cc/sh/v3/cmd/shfmt@v3.8.0
- name: Test shfmt
if: matrix.kind == 'shfmt'
run: ./gradlew testShfmt
- name: junit result
uses: mikepenz/action-junit-report@v6
if: always()
with:
check_name: JUnit shfmt
report_paths: '*/build/test-results/*/TEST-*.xml'
check_retries: true

test-idea:
name: IntelliJ IDEA
needs: sanity-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-java@v5
with:
distribution: "temurin"
java-version: 17
- uses: gradle/actions/setup-gradle@v6
- name: Test idea
if: matrix.kind == 'idea'
run: |
download_link=$(curl https://data.services.jetbrains.com/products/releases\?code\=IIC\&latest\=true\&type\=release | jq -r '.IIC[0].downloads.linux.link')
curl --location "$download_link" -o idea.tar.gz
Expand All @@ -97,17 +157,21 @@ jobs:
./gradlew testIdea
- name: junit result
uses: mikepenz/action-junit-report@v6
if: always() # always run even if the previous step fails
if: always()
with:
check_name: JUnit ${{ matrix.kind }} ${{ matrix.jre }} ${{ matrix.os }}
check_name: JUnit IDEA
report_paths: '*/build/test-results/*/TEST-*.xml'
check_retries: true

# Status check that is required in branch protection rules.
final-status:
needs:
- sanity-check
- build
- build-gradle
- build-maven
- test-npm
- test-shfmt
- test-idea
runs-on: ubuntu-slim
Comment thread
Goooler marked this conversation as resolved.
Resolved
if: always()
steps:
Expand Down
Loading