-
Notifications
You must be signed in to change notification settings - Fork 0
Build/ci cd 분리 #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The head ref may contain hidden characters: "build/ci-cd-\uBD84\uB9AC"
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 | ||
| 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)); | ||
|
||
| } | ||
| } | ||
| } | ||
| 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(); | ||
| } | ||
| } |
There was a problem hiding this comment.
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.