Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .github/workflows/cicd.yaml → .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: pinit-auth CI/CD
name: pinit-auth CD

on:
push:
Expand All @@ -10,7 +10,7 @@ permissions:

jobs:
build-test-push-deploy:
runs-on: [ arc-runner-set ] # ARC 러너 라벨에 맞게 조정
runs-on: [ arc-runner-set ]

env:
IMAGE_REPO: ghcr.io/pinit-scheduler/pinit-auth/app
Expand All @@ -27,7 +27,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "21" # 사용 버전에 맞게 조정
java-version: "21"
cache: gradle

- name: Build & Test
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
- name: Install kubectl (if needed)
uses: azure/setup-kubectl@v4
with:
version: v1.33.6 # 클러스터 버전에 맞게 조정
version: v1.33.6

- name: Create kubeconfig from in-cluster ServiceAccount
shell: bash
Expand Down Expand Up @@ -89,7 +89,6 @@ jobs:
- name: Deploy (apply manifest with GITHUB_SHA substitution)
shell: bash
run: |
# envsubst가 없으면 설치 필요(러너 이미지에 포함시키는 방식을 권장)
command -v envsubst >/dev/null 2>&1 || (echo "envsubst not found" && exit 1)

export GITHUB_SHA="${{ github.sha }}"
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: pinit-auth CI

on:
pull_request:

permissions:
contents: read

jobs:
build-test:
runs-on: [ arc-runner-set ]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "21"
cache: gradle

- name: Build & Test
run: ./gradlew clean test build
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The command runs tests twice: once explicitly with 'test' and again as part of 'build' (since build depends on test in Gradle). Consider using either './gradlew clean build' (which includes test) or './gradlew clean test' if you only want to run tests without creating the final JAR. The current approach wastes CI resources and time.

Suggested change
run: ./gradlew clean test build
run: ./gradlew clean build

Copilot uses AI. Check for mistakes.
17 changes: 17 additions & 0 deletions src/test/java/me/gg/pinit/PinitAuthApplicationTests.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
package me.gg.pinit;

import me.gg.pinit.infrastructure.jwt.JwtTokenProvider;
import me.gg.pinit.utils.TestKeys;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.test.context.ActiveProfiles;

import java.time.Duration;

@ActiveProfiles("test")
@SpringBootTest
class PinitAuthApplicationTests {

@Test
void contextLoads() {
}

@TestConfiguration
static class TestBeans {
@Bean
@Primary
JwtTokenProvider testJwtTokenProvider() {
return new JwtTokenProvider(TestKeys.privateKey(), TestKeys.publicKey(), "https://pinit.go-gradually.me", Duration.ofMinutes(5), Duration.ofDays(14));
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardcoded issuer URL "https://pinit.go-gradually.me" duplicates the value from the production SecurityConfig. Consider extracting this to a configuration property or constant to maintain consistency and make it easier to update across the codebase.

Copilot uses AI. Check for mistakes.
}
}
}
31 changes: 31 additions & 0 deletions src/test/java/me/gg/pinit/utils/TestKeys.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package me.gg.pinit.utils;

import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.PrivateKey;
import java.security.PublicKey;

public final class TestKeys {
private static final KeyPair KEY_PAIR = generate();

private TestKeys() {
}

private static KeyPair generate() {
try {
KeyPairGenerator gen = KeyPairGenerator.getInstance("RSA");
gen.initialize(2048);
return gen.generateKeyPair();
} catch (Exception e) {
throw new IllegalStateException(e);
}
}

public static PublicKey publicKey() {
return KEY_PAIR.getPublic();
}

public static PrivateKey privateKey() {
return KEY_PAIR.getPrivate();
}
}
Loading