Skip to content

Add release workflow for GitHub releases #1635

Add release workflow for GitHub releases

Add release workflow for GitHub releases #1635

Workflow file for this run

# BUILDCACHE_USER
# BUILDCACHE_PASS
# - rw access to buildcache.diffplug.com
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
sanityCheck:
name: spotlessCheck assemble testClasses
runs-on: ubuntu-latest
env:
buildcacheuser: ${{ secrets.BUILDCACHE_USER }}
buildcachepass: ${{ secrets.BUILDCACHE_PASS }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install JDK 11
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 11
- name: gradle caching
uses: gradle/actions/setup-gradle@v3
with:
gradle-home-cache-cleanup: true
- name: spotlessCheck
run: ./gradlew spotlessCheck
- name: assemble testClasses
run: ./gradlew assemble testClasses
build:
needs: sanityCheck
strategy:
fail-fast: false
matrix:
kind: [maven, gradle]
# Test on the latest Java version once Gradle & Maven support it.
jre: [11, 17, 21, 22]
os: [ubuntu-latest]
include:
# test windows at the diagonals of the above matrix
- kind: maven
jre: 11
os: windows-latest
- kind: gradle
jre: 17
os: windows-latest
# npm on linux only (crazy slow on windows)
- kind: npm
jre: 11
os: ubuntu-latest
- kind: shfmt
jre: 11
os: ubuntu-latest
shfmt-version: v3.8.0
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install JDK ${{ matrix.distribution }} ${{ matrix.java_version }}
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: ${{ matrix.jre }}
- name: gradle caching
uses: gradle/actions/setup-gradle@v3
with:
gradle-home-cache-cleanup: true
- 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@v5
with:
go-version: 'stable'
- name: Install shfmt
if: matrix.kind == 'shfmt'
run: |
go install mvdan.cc/sh/v3/cmd/shfmt@${{ matrix.shfmt-version }}
- name: Test shfmt
if: matrix.kind == 'shfmt'
run: ./gradlew testShfmt
- name: junit result
uses: mikepenz/action-junit-report@v4
if: always() # always run even if the previous step fails
with:
check_name: JUnit ${{ matrix.kind }} ${{ matrix.jre }} ${{ matrix.os }}
report_paths: '*/build/test-results/*/TEST-*.xml'
check_retries: true