Skip to content

Commit 94db3bf

Browse files
committed
refactor: build 크기 수정, CICD fix
1 parent d053537 commit 94db3bf

File tree

6 files changed

+55
-141
lines changed

6 files changed

+55
-141
lines changed

.github/workflows/ci-develop.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,15 @@ on:
99
jobs:
1010
build:
1111
runs-on: ubuntu-latest
12-
13-
strategy:
14-
matrix:
15-
java-version: [8, 11, 17, 21, 24]
1612

1713
steps:
1814
- name: Checkout code
1915
uses: actions/checkout@v4
2016

21-
- name: Set up JDK ${{ matrix.java-version }}
17+
- name: Set up JDK 8 (for Java 8-24 compatibility)
2218
uses: actions/setup-java@v4
2319
with:
24-
java-version: ${{ matrix.java-version }}
20+
java-version: '8'
2521
distribution: 'temurin'
2622

2723
- name: Cache Gradle packages
@@ -30,9 +26,9 @@ jobs:
3026
path: |
3127
~/.gradle/caches
3228
~/.gradle/wrapper
33-
key: ${{ runner.os }}-gradle-develop-jdk${{ matrix.java-version }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
29+
key: ${{ runner.os }}-gradle-develop-jdk8-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
3430
restore-keys: |
35-
${{ runner.os }}-gradle-develop-jdk${{ matrix.java-version }}-
31+
${{ runner.os }}-gradle-develop-jdk8-
3632
${{ runner.os }}-gradle-develop-
3733
3834
- name: Setup Gradle

.github/workflows/release-jitpack.yml

Lines changed: 36 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -10,102 +10,46 @@ on:
1010
jobs:
1111
test:
1212
runs-on: ubuntu-latest
13-
1413
strategy:
1514
matrix:
1615
java-version: [8, 11, 17, 21, 24]
17-
18-
steps:
19-
- uses: actions/checkout@v4
20-
21-
- name: Set up JDK ${{ matrix.java-version }}
22-
uses: actions/setup-java@v4
23-
with:
24-
java-version: ${{ matrix.java-version }}
25-
distribution: 'temurin'
26-
27-
- name: Grant execute permission for gradlew
28-
run: chmod +x gradlew
29-
30-
- name: Cache Gradle packages
31-
uses: actions/cache@v4
32-
with:
33-
path: |
34-
~/.gradle/caches
35-
~/.gradle/wrapper
36-
key: ${{ runner.os }}-gradle-jdk${{ matrix.java-version }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
37-
restore-keys: |
38-
${{ runner.os }}-gradle-jdk${{ matrix.java-version }}-
39-
${{ runner.os }}-gradle-
40-
41-
- name: Run tests
42-
run: ./gradlew test
43-
44-
- name: Build with Gradle
45-
run: ./gradlew build
46-
47-
- name: Test JitPack publish
48-
run: ./gradlew publishToMavenLocal
49-
50-
- name: Upload build artifacts
51-
uses: actions/upload-artifact@v4
52-
if: matrix.java-version == 8
53-
with:
54-
name: jar-artifacts
55-
path: |
56-
*/build/libs/*.jar
57-
!*/build/libs/*-sources.jar
58-
!*/build/libs/*-javadoc.jar
59-
60-
jitpack-compatibility:
61-
runs-on: ubuntu-latest
62-
needs: test
63-
16+
6417
steps:
65-
- uses: actions/checkout@v4
66-
67-
- name: Set up JDK 8
68-
uses: actions/setup-java@v4
69-
with:
70-
java-version: 8
71-
distribution: 'temurin'
72-
73-
- name: Cache Gradle packages
74-
uses: actions/cache@v4
75-
with:
76-
path: |
77-
~/.gradle/caches
78-
~/.gradle/wrapper
79-
key: ${{ runner.os }}-gradle-build-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
80-
restore-keys: |
81-
${{ runner.os }}-gradle-
82-
83-
- name: Test JitPack build simulation
84-
run: |
85-
chmod +x gradlew
86-
./gradlew clean
87-
./gradlew publishToMavenLocal
88-
echo "JitPack compatibility verified"
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up JDK ${{ matrix.java-version }}
21+
uses: actions/setup-java@v4
22+
with:
23+
java-version: ${{ matrix.java-version }}
24+
distribution: 'temurin'
25+
26+
- name: Grant execute permission for gradlew
27+
run: chmod +x gradlew
28+
29+
- name: Cache Gradle packages
30+
uses: actions/cache@v4
31+
with:
32+
path: |
33+
~/.gradle/caches
34+
~/.gradle/wrapper
35+
key: ${{ runner.os }}-gradle-jdk${{ matrix.java-version }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
36+
restore-keys: |
37+
${{ runner.os }}-gradle-jdk${{ matrix.java-version }}-
38+
${{ runner.os }}-gradle-
39+
40+
- name: Run tests on JDK ${{ matrix.java-version }}
41+
run: ./gradlew test
8942

9043
release:
9144
runs-on: ubuntu-latest
92-
needs: [test, jitpack-compatibility]
45+
needs: [test]
9346
if: startsWith(github.ref, 'refs/tags/v')
94-
47+
9548
steps:
96-
- name: Check deploy token
97-
run: |
98-
if [ -z "${{ secrets.DEPLOY_TOKEN }}" ]; then
99-
echo "DEPLOY_TOKEN is not set. Skipping release."
100-
exit 1
101-
fi
102-
echo "DEPLOY_TOKEN is available. Proceeding with release."
10349
- name: Checkout repository
10450
uses: actions/checkout@v4
105-
with:
106-
fetch-depth: 0
10751

108-
- name: Set up JDK 8
52+
- name: Set up JDK 8 (for Java 8-24 compatibility)
10953
uses: actions/setup-java@v4
11054
with:
11155
java-version: '8'
@@ -142,29 +86,29 @@ jobs:
14286
name: "Release ${{ steps.version.outputs.tag }}"
14387
body: |
14488
🚀 릴리스: ${{ steps.version.outputs.tag }}
145-
89+
14690
## JitPack 사용법
147-
91+
14892
### Gradle
14993
```gradle
15094
repositories {
151-
maven { url 'https://jitpack.io' }
95+
maven { url '[https://jitpack.io](https://jitpack.io)' }
15296
}
153-
97+
15498
dependencies {
15599
implementation 'com.github.hj4645:commit-chronicle:${{ steps.version.outputs.version }}'
156100
}
157101
```
158-
102+
159103
### Maven
160104
```xml
161105
<repositories>
162106
<repository>
163107
<id>jitpack.io</id>
164-
<url>https://jitpack.io</url>
108+
<url>[https://jitpack.io](https://jitpack.io)</url>
165109
</repository>
166110
</repositories>
167-
111+
168112
<dependencies>
169113
<dependency>
170114
<groupId>com.github.hj4645</groupId>
@@ -173,18 +117,7 @@ jobs:
173117
</dependency>
174118
</dependencies>
175119
```
176-
177-
## CLI 사용법
178-
```bash
179-
# alias 설정
180-
alias cch="java -jar ~/.gradle/caches/modules-2/files-2.1/com.github.hj4645/commit-chronicle/${{ steps.version.outputs.version }}/*/commitchronicle-${{ steps.version.outputs.version }}.jar"
181-
182-
# 사용
183-
cch summarize
184-
cch pr
185-
cch settings
186-
```
187120
draft: false
188121
prerelease: false
189122
env:
190-
GITHUB_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
123+
GITHUB_TOKEN: ${{ secrets.DEPLOY_TOKEN }}

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,15 @@ dependencies {
7777

7878
라이브러리를 dependency로 추가한 후, alias를 설정하여 CLI로 사용할 수 있습니다.
7979

80-
#### 🚀 간편한 alias 설정 방법
80+
#### 🚀 간편한 alias 설정 방법 (자동 최신 버전 탐지)
8181

8282
**macOS/Linux:**
8383
```bash
84-
# 한 번에 alias 설정하기
85-
echo "alias cch='java -jar \$(find ~/.gradle/caches -name \"*commit-chronicle*\" -type f | grep \"\\.jar\$\" | head -1)'" >> ~/.zshrc && source ~/.zshrc
84+
# 자동 최신 버전 탐지 alias (권장) - 새 버전이 다운로드되면 자동으로 최신 버전 사용
85+
echo "alias cch='java -jar \$(find ~/.gradle/caches -path \"*commit-chronicle*\" -name \"*.jar\" -type f -print0 | xargs -0 ls -t | head -1)'" >> ~/.zshrc && source ~/.zshrc
8686

8787
# 또는 단계별로 설정
88-
JAR_PATH=$(find ~/.gradle/caches -name "*commit-chronicle*" -type f | grep "\.jar$" | head -1)
89-
echo "alias cch='java -jar $JAR_PATH'" >> ~/.zshrc
88+
echo 'alias cch="java -jar \$(find ~/.gradle/caches -path \"*commit-chronicle*\" -name \"*.jar\" -type f -print0 | xargs -0 ls -t | head -1)"' >> ~/.zshrc
9089
source ~/.zshrc
9190
```
9291

cli/build.gradle.kts

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,12 @@ tasks {
2525
manifest {
2626
attributes["Main-Class"] = "com.commitchronicle.cli.MainKt"
2727
}
28-
29-
// JAR 최적화 설정
30-
minimize() // 사용하지 않는 클래스 제거
31-
mergeServiceFiles() // 서비스 파일 병합
32-
33-
// 중복 의존성 제거
28+
29+
// 기본 JAR 최적화 설정만 유지
30+
mergeServiceFiles()
3431
exclude("META-INF/*.SF", "META-INF/*.DSA", "META-INF/*.RSA")
35-
36-
// 프로퍼티 파일 통합
37-
relocate("META-INF/services", "services")
38-
relocate("META-INF/spring.*", "spring")
39-
40-
// 트랜지티브 의존성 최적화
41-
dependencies {
42-
exclude(dependency("org.jetbrains.kotlin:kotlin-stdlib"))
43-
exclude(dependency("org.jetbrains.kotlin:kotlin-stdlib-common"))
44-
}
4532
}
46-
33+
4734
// 버전 정보 자동 업데이트 태스크
4835
register("updateVersion") {
4936
doLast {
@@ -52,7 +39,7 @@ tasks {
5239
versionFile.writeText(project.version.toString())
5340
}
5441
}
55-
42+
5643
// 빌드 시 버전 정보 자동 업데이트
5744
build {
5845
dependsOn("updateVersion")

core/impl/build.gradle.kts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@ dependencies {
99
// Git
1010
implementation("org.eclipse.jgit:org.eclipse.jgit:6.7.0.202309050840-r")
1111

12-
// Ktor
12+
// Ktor - 최소 의존성만 사용
1313
implementation("io.ktor:ktor-client-core:2.3.8")
14-
implementation("io.ktor:ktor-client-cio:2.3.8")
14+
implementation("io.ktor:ktor-client-cio:2.3.8") {
15+
exclude(group = "io.ktor", module = "ktor-websockets")
16+
exclude(group = "io.ktor", module = "ktor-network-tls")
17+
}
1518
implementation("io.ktor:ktor-client-content-negotiation:2.3.8")
1619
implementation("io.ktor:ktor-serialization-kotlinx-json:2.3.8")
1720

jitpack.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
jdk:
22
- openjdk8
3-
- openjdk11
4-
- openjdk17
5-
- openjdk21
6-
- openjdk24
73

84
before_install:
9-
- echo "Setting up build environment"
5+
- echo "Setting up build environment for Java 8-24 compatibility"
106
- ./gradlew clean
117

128
install:

0 commit comments

Comments
 (0)