Skip to content
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

[NB-109] CI 구축 #15

Merged
merged 3 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
73 changes: 73 additions & 0 deletions .github/workflows/dev_PR_BuildAndTest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Pull Request Test
run-name: "Build and Test: Trigger by ${{ github.actor }}"

on:
pull_request:
branches:
- dev
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest

permissions:
contents: read

services:
postgres:
image: postgres:16.3
ports:
- 5432:5432
env:
POSTGRES_DB: ${{ secrets.LOCAL_DB_NAME }}
POSTGRES_USER: ${{ secrets.LOCAL_DB_USERNAME }}
POSTGRES_PASSWORD: ${{ secrets.LOCAL_DB_PASSWORD }}
options: >-
--health-cmd "pg_isready"
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
# Display PR info
- name: Display PR information
run: |
echo "Pull Request from: ${{ github.event.pull_request.head.ref }}"
echo "Pull Request to: ${{ github.event.pull_request.base.ref }}"
echo "Pull Request author: ${{ github.event.pull_request.user.login }}"

# Checkout the code
- name: Checkout code
uses: actions/checkout@v4

# Set up JDK 17
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

# Cache Gradle dependencies
- name: Cache Gradle dependencies
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-


# Run build and test
- name: Run tests and build
run: ./gradlew build
env:
LOCAL_DB_HOST: ${{ secrets.LOCAL_DB_HOST }}
LOCAL_DB_NAME: ${{ secrets.LOCAL_DB_NAME }}
LOCAL_DB_USERNAME: ${{ secrets.LOCAL_DB_USERNAME }}
LOCAL_DB_PASSWORD: ${{ secrets.LOCAL_DB_PASSWORD }}
LOCAL_AWS_S3_NAME: ${{ secrets.LOCAL_AWS_S3_NAME }}
LOCAL_AWS_USER_ACCESS_KEY: ${{ secrets.LOCAL_AWS_USER_ACCESS_KEY }}
LOCAL_AWS_USER_SECRET_KEY: ${{ secrets.LOCAL_AWS_USER_SECRET_KEY }}
2 changes: 2 additions & 0 deletions src/test/java/com/soyeon/nubim/NubimApplicationTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;

@SpringBootTest
@ActiveProfiles("local")
class NubimApplicationTests {

@Test
Expand Down