Skip to content

Commit

Permalink
Deploy: PR 생성시 테스트코드 수행 로직 구현 (#94)
Browse files Browse the repository at this point in the history
* deploy: PR 생성시 테스트코드 수행 로직 추가

* feat: jwt.secret키를 깃허브 시크릿에 저장 및 환경변수 설정

* feat: 환경변수 읽어오도록 수정

* feat: 도커를 사용하여 레디스 환경 구축
  • Loading branch information
GitJIHO authored Oct 20, 2024
1 parent 5009cc8 commit bb0a4d6
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/testcode.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Run Tests on Pull Request

on:
pull_request:
branches:
- Weekly

jobs:
test:
runs-on: ubuntu-latest

services:
redis:
image: redis:alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: '21'
distribution: 'temurin'

- name: Run Tests
env:
JWT_SECRET: ${{ secrets.JWT_SECRET }}
run: ./gradlew test
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
package com.example.sinitto;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;

import static org.hibernate.validator.internal.util.Contracts.assertNotNull;

@SpringBootTest
class SinittoApplicationTests {

@Value("${jwt.secret}")
private String jwtSecret;

@Test
void contextLoads() {
assertNotNull(jwtSecret);
}

}

0 comments on commit bb0a4d6

Please sign in to comment.