Skip to content

Command line: quoted argfile paths, a closed thread pool, and the right flag in the --dry-run error #129

Command line: quoted argfile paths, a closed thread pool, and the right flag in the --dry-run error

Command line: quoted argfile paths, a closed thread pool, and the right flag in the --dry-run error #129

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install JDK 21
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
with:
distribution: temurin
java-version: '21'
- name: Build
run: ./gradlew test
- name: Publish Test Report
uses: mikepenz/action-junit-report@a9170d5795813c01ab4901ffb045b52bab4ab09d # v6.5.0
if: ${{ !cancelled() }}
with:
report_paths: '**/build/test-results/test/*.xml'
annotate_only: true
job_summary: true
# One explicit job per target, so every binary we ship is traceable to a named run.
native:
name: native (${{ matrix.platform }})
needs: build
runs-on: ${{ matrix.runner }}
timeout-minutes: 90
# bash on Windows too, so that every step reads the same on every runner.
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
include:
- platform: linux-x86-64
runner: ubuntu-latest
- platform: linux-aarch64
runner: ubuntu-24.04-arm
- platform: macos-aarch64
runner: macos-15
- platform: macos-x86-64
runner: macos-15-intel
- platform: windows-x86-64
runner: windows-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
# The jars compile with a Java 21 toolchain, which gradle.properties looks up in JDK21_HOME. On
# Linux and macOS Gradle also finds the runner's own JDK 21 by its location, on Windows it does not.
# Installed before GraalVM, so that Gradle itself still runs on GraalVM.
- name: Install JDK 21 for the jars
id: jdk21
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
with:
distribution: temurin
java-version: '21'
- name: Install GraalVM 25 for the image
uses: graalvm/setup-graalvm@5298d94fb55a4f185c602eeac5de1b553882abe2 # v1.6.4
with:
java-version: '25'
distribution: 'graalvm-community'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Compile the native image
run: ./gradlew -PnativeImage=true :open-java-format-native:nativeCompile
env:
JDK21_HOME: ${{ steps.jdk21.outputs.path }}
# The binary itself on a file that needs formatting, a formatted one and one that does not parse.
- name: Smoke-test the binary
run: |
binary="$PWD/$(ls open-java-format-native/build/native/nativeCompile/open-java-format-* | grep -v '\.txt$')"
mkdir smoke-test && cd smoke-test
"$binary" --version
printf 'class A{int x;}\n' > A.java
"$binary" --replace A.java
printf 'class A {\n int x;\n}\n' | diff - A.java
"$binary" --dry-run --set-exit-if-changed A.java
printf 'class B {\n' > B.java
set +e; "$binary" B.java; status=$?; set -e
test "$status" -eq 2
- name: Test the plugins against the image
run: ./gradlew -PnativeImage=true :open-java-format-jdk-bootstrap:test :gradle-open-java-format:test
env:
JDK21_HOME: ${{ steps.jdk21.outputs.path }}
- name: Publish Test Report
uses: mikepenz/action-junit-report@a9170d5795813c01ab4901ffb045b52bab4ab09d # v6.5.0
if: ${{ !cancelled() }}
with:
report_paths: '**/build/test-results/test/*.xml'
annotate_only: true
job_summary: true