-
Notifications
You must be signed in to change notification settings - Fork 1
[FEAT] #178: CI 추가 #180
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
Merged
Merged
[FEAT] #178: CI 추가 #180
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
5901c80
feat(#178/test): test 환경 추가
kaswhy 2585c45
fix(#178/config): test에서 env 로드 하지 않도록 변경
kaswhy 7dcca89
fix(#178/user): User 도메인에서 UserRole STRING 으로 인식하도록 변경 및 DB 마이그레이션 코드 추가
kaswhy 8f17102
fix(#178/build.gradle): 테스트 시 테스트 환경에서 도는 설정 추가
kaswhy 26aa16b
fix(#178/*): prod, local 환경에서 flyway 설정 추가
kaswhy 880b60b
feat(#178/*): ci workflow 추가
kaswhy 706abe5
feat(#178/*): flyway 관련 설정 추가 및 CI 워크플로 결과 화면, 댓글 추가
kaswhy e7ad8e8
feat(#178/.github): CI 워크플로에 댓글 추가
kaswhy eeac732
fix(#178/resources): migration 파일 위치 변경
kaswhy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [ "develop", "main" ] | ||
| types: [ opened, synchronize, reopened, ready_for_review ] | ||
| workflow_dispatch: {} | ||
|
|
||
| permissions: | ||
| contents: read | ||
| checks: write | ||
| pull-requests: write | ||
| issues: write | ||
|
|
||
| concurrency: | ||
| group: pr-ci-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-java@v4 | ||
| with: { distribution: temurin, java-version: 17 } | ||
| - uses: gradle/actions/setup-gradle@v3 | ||
| if: ${{ !env.ACT }} | ||
| with: | ||
| cache-read-only: ${{ github.event_name == 'pull_request' }} | ||
| gradle-home-cache-cleanup: true | ||
|
|
||
| - name: Create dummy .env for CI | ||
| working-directory: gdgoc | ||
| run: echo "# ci dummy" > .env | ||
|
|
||
| - name: Gradle build (skip tests) | ||
| id: assemble | ||
| working-directory: gdgoc | ||
| env: { GRADLE_OPTS: "-Dorg.gradle.vfs.watch=false" } | ||
| run: | | ||
| chmod +x ./gradlew | ||
| ./gradlew build -x test --no-daemon --stacktrace --info --no-watch-fs | tee ../build.log | ||
| - name: Gradle test (H2 in-memory) | ||
| id: test | ||
| working-directory: gdgoc | ||
| continue-on-error: true | ||
| env: | ||
| GRADLE_OPTS: "-Dorg.gradle.vfs.watch=false" | ||
| SPRING_PROFILES_ACTIVE: test | ||
| SPRING_DATASOURCE_URL: jdbc:h2:mem:ci;MODE=PostgreSQL;DB_CLOSE_DELAY=-1;DATABASE_TO_LOWER=TRUE | ||
| SPRING_DATASOURCE_USERNAME: sa | ||
| SPRING_DATASOURCE_PASSWORD: "" | ||
| SPRING_DATASOURCE_DRIVER_CLASS_NAME: org.h2.Driver | ||
| SPRING_JPA_DATABASE_PLATFORM: org.hibernate.dialect.H2Dialect | ||
| SPRING_JPA_HIBERNATE_DDL_AUTO: create-drop | ||
| run: ./gradlew test --no-daemon --stacktrace --info --no-watch-fs | tee ../test.log | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
gdgoc/src/main/db/migration/V20250823__user_role_ordinal_to_string.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| DO $$ | ||
| DECLARE r record; | ||
| BEGIN | ||
| FOR r IN | ||
| SELECT conname | ||
| FROM pg_constraint c | ||
| JOIN pg_class t ON t.oid = c.conrelid | ||
| JOIN pg_namespace n ON n.oid = t.relnamespace | ||
| WHERE t.relname = 'users' | ||
| AND n.nspname = 'public' | ||
| AND c.contype = 'c' | ||
| AND pg_get_constraintdef(c.oid) ILIKE '%user_role%' -- user_role 관련 CHECK | ||
| LOOP | ||
| EXECUTE format('ALTER TABLE public.users DROP CONSTRAINT %I', r.conname); | ||
| END LOOP; | ||
| END $$; | ||
|
|
||
| ALTER TABLE public.users ALTER COLUMN user_role DROP DEFAULT; | ||
|
|
||
| ALTER TABLE public.users | ||
| ALTER COLUMN user_role TYPE varchar(32) | ||
| USING user_role::text; | ||
|
|
||
|
|
||
| UPDATE public.users | ||
| SET user_role = CASE user_role | ||
| WHEN '0' THEN 'GUEST' | ||
| WHEN '1' THEN 'MEMBER' | ||
| WHEN '2' THEN 'ADMIN' | ||
| ELSE user_role | ||
| END; | ||
|
|
||
kaswhy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| -- 5) 새 디폴트/체크 제약조건 설정 | ||
| ALTER TABLE public.users ALTER COLUMN user_role SET DEFAULT 'GUEST'; | ||
|
|
||
| ALTER TABLE public.users | ||
| ADD CONSTRAINT users_user_role_check | ||
| CHECK (user_role IN ('GUEST','MEMBER','ADMIN')); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| server: | ||
| forward-headers-strategy: none | ||
|
|
||
| spring: | ||
| jackson: | ||
| time-zone: Asia/Seoul | ||
|
|
||
| datasource: | ||
| driver-class-name: org.h2.Driver | ||
| url: jdbc:h2:mem:gdgoc-test;MODE=PostgreSQL;DB_CLOSE_DELAY=-1;DATABASE_TO_LOWER=TRUE | ||
| username: sa | ||
| password: | ||
|
|
||
| servlet: | ||
| multipart: | ||
| max-file-size: 10MB | ||
| max-request-size: 12MB | ||
|
|
||
| jpa: | ||
| database: h2 | ||
| hibernate: | ||
| ddl-auto: create-drop | ||
| properties: | ||
| hibernate: | ||
| default_batch_fetch_size: 100 | ||
| format_sql: true | ||
| show_sql: false | ||
| time_zone: Asia/Seoul | ||
| database-platform: org.hibernate.dialect.H2Dialect | ||
| show-sql: false | ||
|
|
||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| mail: | ||
| host: localhost | ||
| port: 2525 | ||
| username: test | ||
| password: test | ||
| properties: | ||
| mail: | ||
| smtp: | ||
| auth: false | ||
| starttls: | ||
| enable: false | ||
| main: | ||
| allow-bean-definition-overriding: true | ||
|
|
||
| logging: | ||
| level: | ||
| org.hibernate.SQL: warn | ||
| org.hibernate.type: warn | ||
|
|
||
| google: | ||
| client-id: test-client-id | ||
| client-secret: test-client-secret | ||
| redirect-uri: http://localhost/redirect | ||
|
|
||
| jwt: | ||
| googleIssuer: test-google-issuer | ||
| selfIssuer: test-self-issuer | ||
| secretKey: MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY= | ||
|
|
||
| cloud: | ||
| aws: | ||
| credentials: | ||
| access-key: test | ||
| secret-key: test | ||
| region: | ||
| static: ap-northeast-2 | ||
| s3: | ||
| bucket: test-bucket | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.