Skip to content

Commit 181e01c

Browse files
authored
merge initial version (#1)
2 parents 88521bd + 0c1f2e4 commit 181e01c

File tree

167 files changed

+10973
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+10973
-0
lines changed

.gitattributes

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#
2+
# https://help.github.com/articles/dealing-with-line-endings/
3+
#
4+
# Linux start script should use lf
5+
/gradlew text eol=lf
6+
7+
# These are Windows script files and should use crlf
8+
*.bat text eol=crlf
9+
10+
# Binary files should be left untouched
11+
*.jar binary
12+

.github/renovate.json5

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": [
4+
"config:recommended",
5+
],
6+
"packageRules": [
7+
]
8+
}

.github/workflows/ci.yml

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
---
2+
name: "ci_checks"
3+
on:
4+
pull_request: null
5+
push:
6+
branches:
7+
- "main"
8+
- "initial-version"
9+
workflow_dispatch:
10+
inputs:
11+
force_gradle_cache_clean:
12+
description: "Force gradle cache clean"
13+
required: false
14+
default: "false"
15+
concurrency:
16+
group: "${{ github.workflow }}-${{ github.ref }}"
17+
cancel-in-progress: true
18+
jobs:
19+
gradleCheck:
20+
name: "run checks using gradlew"
21+
runs-on: "ubuntu-latest"
22+
outputs:
23+
RELEASE_VERSION: ${{ steps.get_version.outputs.VERSION }}
24+
env:
25+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: "15"
26+
steps:
27+
- name: "Checkout"
28+
uses: "actions/checkout@v4"
29+
with:
30+
fetch-depth: 0
31+
- name: "Install JDK 21"
32+
uses: "actions/setup-java@v4"
33+
with:
34+
distribution: "graalvm"
35+
java-version: 21
36+
- name: "Install Node.js"
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: "lts/jod" # 22
40+
- name: "debug node"
41+
run: "node --version && npm --version"
42+
- name: "Setup Gradle"
43+
uses: "gradle/actions/setup-gradle@v4"
44+
with:
45+
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/initial-version' }} # TODO remove when initial-version is removed
46+
- name: "Nuke gradle cache"
47+
if: "${{ github.event.inputs.force_gradle_cache_clean == 'true' }}"
48+
run: "rm -rf ~/.gradle/caches"
49+
- name: "Run check on build-logic subproject"
50+
run: "./gradlew :build-logic:check --no-configuration-cache"
51+
- name: "Run check on project"
52+
run: "./gradlew generateUsage && ./gradlew check"
53+
- name: "Get version and set to output"
54+
id: get_version
55+
run: echo "VERSION=$(./gradlew changelogPrintCurrentVersion --quiet)" >> "$GITHUB_OUTPUT"
56+
- name: "junit result"
57+
uses: "mikepenz/action-junit-report@v5"
58+
if: "always()"
59+
with:
60+
check_name: "JUnit Report"
61+
report_paths: "**/build/test-results/tes*/*.xml" # multiple test tasks
62+
nativeCompile:
63+
name: "${{ matrix.platform.name }} nativeCompile testing"
64+
needs: "gradleCheck"
65+
strategy:
66+
matrix:
67+
platform:
68+
- name: "linux-x86_64"
69+
runner: "ubuntu-latest"
70+
- name: "linux-aarch_64"
71+
runner: "ubuntu-24.04-arm"
72+
- name: "windows-x86_64"
73+
runner: "windows-latest"
74+
- name: "osx-aarch_64"
75+
runner: "macos-latest"
76+
- name: "osx-x86_64"
77+
runner: "macos-13"
78+
fail-fast: false
79+
runs-on: "${{ matrix.platform.runner }}"
80+
env:
81+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: "15"
82+
steps:
83+
- name: "Checkout"
84+
uses: "actions/checkout@v4"
85+
with:
86+
fetch-depth: 0
87+
- name: "Install JDK 21"
88+
uses: "actions/setup-java@v4"
89+
with:
90+
distribution: "graalvm"
91+
java-version: 21
92+
- name: "Install Node.js"
93+
uses: actions/setup-node@v4
94+
with:
95+
node-version: "lts/jod" # 22
96+
- name: "Setup Gradle"
97+
uses: "gradle/actions/setup-gradle@v4"
98+
with:
99+
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/initial-version' }} # TODO remove when initial-version is removed
100+
- name: "Check if binary works"
101+
run: "./gradlew testAllCliNative"
102+
- name: "junit result"
103+
uses: "mikepenz/action-junit-report@v5"
104+
if: "always()"
105+
with:
106+
check_name: "JUnit Report ${{ matrix.platform.name }}"
107+
report_paths: "**/build/test-results/tes*/*.xml" # multiple test tasks
108+
- name: "upload binary" # for debugging
109+
uses: actions/upload-artifact@v4
110+
with:
111+
name: "spotless-native-binary--${{ matrix.platform.name }}"
112+
path: app/build/native/nativeCompile/spotless*
113+
retention-days: 7
114+
if-no-files-found: "error"
115+
116+
dryRunRelease:
117+
name: "dry run release"
118+
needs: ["gradleCheck", "nativeCompile"]
119+
strategy:
120+
matrix:
121+
platform:
122+
- name: "linux-x86_64"
123+
runner: "ubuntu-latest"
124+
- name: "windows-x86_64"
125+
runner: "windows-latest"
126+
runs-on: "${{ matrix.platform.runner }}"
127+
steps:
128+
- name: "Checkout"
129+
uses: "actions/checkout@v4"
130+
with:
131+
fetch-depth: 0
132+
- name: "Install JDK 21"
133+
uses: "actions/setup-java@v4"
134+
with:
135+
distribution: "graalvm"
136+
java-version: 21
137+
- name: "Setup Gradle"
138+
uses: "gradle/actions/setup-gradle@v4"
139+
- name: "Retrieve binaries"
140+
uses: "actions/download-artifact@v4"
141+
with:
142+
# no name - download all artifacts
143+
path: "app/build/collected-binaries"
144+
- name: "Prepare release zips for distribution"
145+
run: "./gradlew -PreleaseBinariesRootDir=app/build/collected-binaries prepareReleaseBinaryZips"
146+
- name: "Prepare jreleaser for distribution"
147+
run: "./gradlew prepareJReleaserConfig"
148+
- name: "Dry-run choco distribution"
149+
if: "${{ matrix.platform.name == 'windows-x86_64' }}"
150+
uses: jreleaser/release-action@v2
151+
with:
152+
setup-java: false
153+
arguments: "publish --dry-run"
154+
env:
155+
JRELEASER_PROJECT_VERSION: ${{ needs.gradleCheck.outputs.RELEASE_VERSION }}
156+
JRELEASER_GITHUB_TOKEN: abc # don't provide correct token, just a dry-run
157+
JRELEASER_DISTRIBUTIONS_SPOTLESS_CLI_CHOCOLATEY_ACTIVE: ALWAYS
158+
JRELEASER_CHOCOLATEY_GITHUB_TOKEN: abc # don't provide correct token, just a dry-run
159+
JRELEASER_CHOCOLATEY_USER: abc # don't provide correct token, just a dry-run
160+
JRELEASER_CHOCOLATEY_API_KEY: abc # don't provide correct token, just a dry-run
161+
- name: "Dry-run brew distribution"
162+
if: "${{ matrix.platform.name == 'linux-x86_64' }}"
163+
uses: jreleaser/release-action@v2
164+
with:
165+
setup-java: false
166+
arguments: "publish --dry-run"
167+
env:
168+
JRELEASER_PROJECT_VERSION: ${{ needs.gradleCheck.outputs.RELEASE_VERSION }}
169+
JRELEASER_GITHUB_TOKEN: abc # don't provide correct token, just a dry-run
170+
JRELEASER_DISTRIBUTIONS_SPOTLESS_CLI_BREW_ACTIVE: ALWAYS
171+
JRELEASER_HOMEBREW_GITHUB_TOKEN: abc # don't provide correct token, just a dry-run
172+
- name: "Persist jreleaser output"
173+
if: always()
174+
uses: actions/upload-artifact@v4
175+
with:
176+
name: "jreleaser-distribution-dry-run--${{ matrix.platform.name }}"
177+
path: |
178+
out/jreleaser/trace.log
179+
out/jreleaser/output.properties
180+
out/jreleaser/package/spotless-cli/**
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: "Validate Gradle Wrapper"
3+
4+
on:
5+
workflow_dispatch: null
6+
push:
7+
paths:
8+
- "gradlew"
9+
- "gradlew.bat"
10+
- "gradle/wrapper/"
11+
pull_request:
12+
paths:
13+
- "gradlew"
14+
- "gradlew.bat"
15+
- "gradle/wrapper/"
16+
17+
jobs:
18+
validation:
19+
name: "Validation"
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
- uses: gradle/actions/wrapper-validation@v4

.github/workflows/publish.yml

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
---
2+
name: "publish a release"
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
force_version:
8+
description: "Force version number to publish (empty for automatic semver versioning)"
9+
required: false
10+
default: ""
11+
to_publish: #TODO
12+
description: "What to publish"
13+
required: true
14+
default: "all"
15+
type: choice
16+
options:
17+
- plugin-gradle
18+
- plugin-maven
19+
- all
20+
- lib
21+
22+
permissions:
23+
contents: write
24+
25+
concurrency:
26+
group: "${{ github.workflow }}-${{ github.ref }}"
27+
cancel-in-progress: true
28+
jobs:
29+
nativeCompile:
30+
name: "${{ matrix.platform.name }}: create production-binary"
31+
strategy:
32+
matrix:
33+
platform:
34+
- name: "linux-x86_64"
35+
runner: "ubuntu-latest"
36+
- name: "linux-aarch_64"
37+
runner: "ubuntu-24.04-arm"
38+
- name: "windows-x86_64"
39+
runner: "windows-latest"
40+
- name: "osx-aarch_64"
41+
runner: "macos-latest"
42+
- name: "osx-x86_64"
43+
runner: "macos-13"
44+
runs-on: "${{ matrix.platform.runner }}"
45+
env:
46+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: "15"
47+
steps:
48+
- name: "Checkout"
49+
uses: "actions/checkout@v4"
50+
with:
51+
fetch-depth: 0
52+
- name: "Install JDK 21"
53+
uses: "actions/setup-java@v4"
54+
with:
55+
distribution: "graalvm"
56+
java-version: 21
57+
- name: "Install Node.js"
58+
uses: actions/setup-node@v4
59+
with:
60+
node-version: "lts/jod" # 22
61+
- name: "Setup Gradle"
62+
uses: "gradle/actions/setup-gradle@v4"
63+
- name: "Run nativeCompile"
64+
run: "./gradlew -Prelease=true nativeCompile"
65+
- name: "upload binary" # for collecting later
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: "spotless-native-binary--${{ matrix.platform.name }}"
69+
path: app/build/native/nativeCompile/spotless*
70+
retention-days: 3
71+
if-no-files-found: "error"
72+
createRelease:
73+
needs: nativeCompile
74+
name: "Create a new release"
75+
runs-on: ubuntu-latest
76+
outputs:
77+
RELEASE_VERSION: ${{ steps.get_version.outputs.VERSION }}
78+
env:
79+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: "15"
80+
steps:
81+
- name: "Checkout"
82+
uses: actions/checkout@v4
83+
with:
84+
fetch-depth: 0
85+
- name: "Install JDK 21"
86+
uses: "actions/setup-java@v4"
87+
with:
88+
distribution: "graalvm"
89+
java-version: 21
90+
- name: "Setup Gradle"
91+
uses: "gradle/actions/setup-gradle@v4"
92+
- name: "Retrieve production-binaries"
93+
uses: "actions/download-artifact@v4"
94+
with:
95+
# no name - download all artifacts
96+
path: "app/build/collected-binaries"
97+
- name: "Create release"
98+
run: "./gradlew -Prelease=true -PreleaseBinariesRootDir=app/build/collected-binaries changelogPush"
99+
- name: "Get version and set to output"
100+
id: get_version
101+
run: echo "VERSION=$(./gradlew changelogPrintCurrentVersion -Prelease=true --quiet)" >> "$GITHUB_OUTPUT"
102+
- name: "Prepare jreleaser for distribution"
103+
run: "./gradlew prepareJReleaserConfig"
104+
- name: "Publish distributions"
105+
uses: jreleaser/release-action@v2
106+
with:
107+
setup-java: false
108+
arguments: "publish"
109+
env:
110+
JRELEASER_PROJECT_VERSION: ${{ steps.get_version.outputs.VERSION }}
111+
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112+
JRELEASER_HOMEBREW_GITHUB_TOKEN: ${{ secrets.BREW_CHOCO_CLI_GH_TOKEN }}
113+
JRELEASER_DISTRIBUTIONS_SPOTLESS_CLI_BREW_ACTIVE: ALWAYS
114+
- name: "Persist jreleaser output"
115+
if: always()
116+
uses: actions/upload-artifact@v4
117+
with:
118+
name: jreleaser-release-unix
119+
path: |
120+
out/jreleaser/trace.log
121+
out/jreleaser/output.properties
122+
createChocoRelase:
123+
needs: createRelease
124+
name: "Publish chocolatey package"
125+
runs-on: windows-latest
126+
env:
127+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: "15"
128+
steps:
129+
- name: "Checkout"
130+
uses: actions/checkout@v4
131+
with:
132+
fetch-depth: 0
133+
- name: "Install JDK 21"
134+
uses: "actions/setup-java@v4"
135+
with:
136+
distribution: "graalvm"
137+
java-version: 21
138+
- name: "Retrieve production-binaries"
139+
uses: "actions/download-artifact@v4"
140+
with:
141+
# no name - download all artifacts
142+
path: "app/build/collected-binaries"
143+
- name: "Publish distributions"
144+
uses: jreleaser/release-action@v2
145+
with:
146+
setup-java: false
147+
arguments: "publish"
148+
env:
149+
JRELEASER_PROJECT_VERSION: ${{ needs.createRelease.outputs.RELEASE_VERSION }}
150+
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
151+
JRELEASER_CHOCOLATEY_GITHUB_TOKEN: ${{ secrets.BREW_CHOCO_CLI_GH_TOKEN }}
152+
JRELEASER_CHOCOLATEY_USER: ${{ secrets.CHOCO_USER }} #manually extracted in jreleaser.yml
153+
JRELEASER_CHOCOLATEY_API_KEY: ${{ secrets.CHOCO_API_KEY }}
154+
JRELEASER_DISTRIBUTIONS_SPOTLESS_CLI_CHOCOLATEY_ACTIVE: ALWAYS
155+
- name: "Persist jreleaser output"
156+
if: always()
157+
uses: actions/upload-artifact@v4
158+
with:
159+
name: jreleaser-release-windows
160+
path: |
161+
out/jreleaser/trace.log
162+
out/jreleaser/output.properties

0 commit comments

Comments
 (0)