Skip to content

Commit 801ad4b

Browse files
committed
Migrate base CI workflow
1 parent 6b8cfd0 commit 801ad4b

7 files changed

Lines changed: 753 additions & 214 deletions

File tree

‎.circleci/.gitattributes‎

Lines changed: 0 additions & 2 deletions
This file was deleted.

‎.circleci/config.yml‎

Lines changed: 0 additions & 165 deletions
This file was deleted.

‎.github/workflows/ci.yml‎

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
permissions:
10+
contents: read
11+
12+
concurrency:
13+
group: ci-${{ github.ref }}
14+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
15+
16+
jobs:
17+
# Compiles everything, runs the whole test suite, and — because the GraalVM
18+
# plugin wires `nativeCompile` into `assemble` — also produces the
19+
# linux-x86-64 native image. This is the job every other one depends on.
20+
build:
21+
name: build (linux-x86-64)
22+
runs-on: ubuntu-24.04
23+
timeout-minutes: 90
24+
steps:
25+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
26+
with:
27+
# gradle-git-version derives the project version from `git describe`,
28+
# so it needs the full history and all tags.
29+
fetch-depth: 0
30+
31+
- name: Cache JDKs provisioned by gradle-jdks
32+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
33+
with:
34+
path: ~/.gradle/gradle-jdks
35+
key: gradle-jdks-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('gradle/jdks/**', 'gradle/gradle-daemon-jdk-version') }}
36+
37+
# gradle/actions/setup-gradle needs a JVM on PATH. This is only a bootstrap:
38+
# the Gradle daemon and every toolchain come from gradle-jdks (gradle/jdks/**),
39+
# because gradle.properties disables installation auto-detection. Kept in sync
40+
# with gradle/gradle-daemon-jdk-version.
41+
- name: Set up a bootstrap JDK
42+
uses: actions/setup-java@cf277c60eb25467037889841efdb72551f06f6c3 # v4.9.1
43+
with:
44+
distribution: temurin
45+
java-version: '21'
46+
47+
- uses: gradle/actions/setup-gradle@748248ddd2a24f49513d8f472f81c3a07d4d50e1 # v4.4.4
48+
with:
49+
# Only the default branch writes to the shared Gradle cache; every
50+
# other ref reads it. Avoids pinning the trunk name in two places.
51+
cache-read-only: ${{ github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }}
52+
53+
- name: Build
54+
run: ./gradlew --stacktrace --continue build
55+
56+
- name: Check that no git-tracked files were modified
57+
run: .github/scripts/check-no-files-changed.sh
58+
59+
- name: Upload native image
60+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
61+
with:
62+
name: native-image-linux-x86-64
63+
path: palantir-java-format-native/build/native/nativeCompile/*
64+
if-no-files-found: error
65+
66+
- name: Upload jars and plugin distributions
67+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
68+
with:
69+
name: jars
70+
path: |
71+
*/build/libs/*.jar
72+
idea-plugin/build/distributions/*.zip
73+
if-no-files-found: error
74+
75+
- name: Upload test results
76+
if: always()
77+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
78+
with:
79+
name: test-results-linux-x86-64
80+
path: '**/build/test-results/**/*.xml'
81+
if-no-files-found: warn
82+
83+
# The platforms the linux-x86-64 job cannot produce. One explicit job per
84+
# target, so every published binary is traceable to a named workflow run.
85+
native:
86+
name: nativeCompile (${{ matrix.platform }})
87+
needs: build
88+
runs-on: ${{ matrix.runner }}
89+
timeout-minutes: 90
90+
strategy:
91+
fail-fast: false
92+
matrix:
93+
include:
94+
- platform: linux-aarch64
95+
runner: ubuntu-24.04-arm
96+
- platform: macos-aarch64
97+
runner: macos-15
98+
steps:
99+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
100+
with:
101+
fetch-depth: 0
102+
103+
- name: Cache JDKs provisioned by gradle-jdks
104+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
105+
with:
106+
path: ~/.gradle/gradle-jdks
107+
key: gradle-jdks-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('gradle/jdks/**', 'gradle/gradle-daemon-jdk-version') }}
108+
109+
# gradle/actions/setup-gradle needs a JVM on PATH. This is only a bootstrap:
110+
# the Gradle daemon and every toolchain come from gradle-jdks (gradle/jdks/**),
111+
# because gradle.properties disables installation auto-detection. Kept in sync
112+
# with gradle/gradle-daemon-jdk-version.
113+
- name: Set up a bootstrap JDK
114+
uses: actions/setup-java@cf277c60eb25467037889841efdb72551f06f6c3 # v4.9.1
115+
with:
116+
distribution: temurin
117+
java-version: '21'
118+
119+
- uses: gradle/actions/setup-gradle@748248ddd2a24f49513d8f472f81c3a07d4d50e1 # v4.4.4
120+
with:
121+
cache-read-only: true
122+
123+
- name: Compile native image
124+
run: ./gradlew --stacktrace :palantir-java-format-native:nativeCompile
125+
126+
- name: Check that no git-tracked files were modified
127+
run: .github/scripts/check-no-files-changed.sh
128+
129+
- name: Upload native image
130+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
131+
with:
132+
name: native-image-${{ matrix.platform }}
133+
path: palantir-java-format-native/build/native/nativeCompile/*
134+
if-no-files-found: error

0 commit comments

Comments
 (0)