1- name : CI & Deploy Pipeline
1+ name : PR CI and develop push CI
22
33# 1. 이벤트 설정
44on :
1919
2020# 2. 빌드 및 테스트 잡
2121jobs :
22- build-and-test :
22+ CI-start :
2323 runs-on : ubuntu-latest
2424 env :
2525 EMAIL_USERNAME : ${{ secrets.EMAIL_USERNAME }}
4444
4545
4646 steps :
47+ # Node.js 설치
48+ - name : Install Node.js
49+ uses : actions/setup-node@v3
50+ with :
51+ node-version : ' 18'
4752 # 코드 체크아웃
4853 - name : Check out code
4954 uses : actions/checkout@v4
5560 java-version : ' 17'
5661 distribution : ' temurin'
5762
63+ # Gradle Wrapper 권한 부여
64+ - name : Grant execute permission for gradlew
65+ run : chmod +x gradlew
5866
59- # Gradle 의존성 캐시 설정
67+ # gradlew 파일 실행권한 설정
68+ - name : Grant execute permission for gradlew
69+ run : chmod +x ./gradlew
70+ shell : bash
71+ # Gradle 의존성 캐시 설정
6072 - name : Cache Gradle dependencies
6173 uses : actions/cache@v4
6274 with :
@@ -65,26 +77,35 @@ jobs:
6577 restore-keys : |
6678 ${{ runner.os }}-gradle-
6779
68- # Gradle Wrapper 권한 부여
69- - name : Grant execute permission for gradlew
70- run : chmod +x gradlew
71-
72- # gradlew 파일 실행권한 설정
73- - name : Grant execute permission for gradlew
74- run : chmod +x ./gradlew
75- shell : bash
80+ # Json 파일 업로드
7681 - name : Create JSON Config File
7782 env :
78- TTS_JSON_CONTENT : ${{ secrets.TTS_JSON }}
83+ TTS_JSON_CONTENT : ${{ secrets.TTS_JSON_CONTENT }}
7984 run : |
80- echo "${TTS_JSON_CONTENT}" > src/main/resources/tts.json
85+ echo "${TTS_JSON_CONTENT}" | base64 -d > src/main/resources/tts.json
8186 echo $TTS_JSON_CONTENT
82-
8387
84- # 빌드 및 테스트 실행
88+ - name : Set Cache Directory Permissions
89+ run : |
90+ if [ -d "~/.sonar/cache" ]; then chmod -R 777 ~/.sonar/cache; fi
91+ if [ -d "~/.gradle/caches" ]; then chmod -R 777 ~/.gradle/caches; fi
92+
93+ # build and Test
8594 - name : Build and Test
8695 run : ./gradlew build
8796
97+ # 소나큐브 실행
98+ - name : Sonarqube Scan
99+ run : ./gradlew sonar -Dsonar.host.url=${{ secrets.SONAR_HOST_URL }} -Dsonar.token=${{ secrets.SONAR_TOKEN }}
100+
101+ # 3-1. 소나큐브 패키지 캐싱 설정
102+ - name : Cache SonarQube packages
103+ uses : actions/cache@v4
104+ with :
105+ path : ~/.sonar/cache
106+ key : ${{ runner.os }}-sonar
107+ restore-keys : ${{ runner.os }}-sonar
108+
88109 # Gradle Test를 실행한다
89110 - name : Test with Gradle
90111 run : ./gradlew --info test
@@ -97,36 +118,4 @@ jobs:
97118 junit_files : ' **/build/test-results/test/TEST-*.xml'
98119
99120 - name : Lint Checks
100- run : ./gradlew check
101- # # 3. develop에서 main으로 자동 배포 작업
102- # deploy-to-main:
103- # # develop 브랜치에 push될 때만 실행
104- # if: github.event_name == 'push' && github.ref == 'refs/heads/develop'
105-
106- # runs-on: ubuntu-latest
107- # needs: build-and-test # 빌드와 테스트가 완료된 후에 실행
108-
109- # steps:
110- # # 코드 체크아웃
111- # - name: Check out code
112- # uses: actions/checkout@v3
113-
114- # - name: Configure git
115- # run: |
116- # git config --global user.name "${{ github.actor }}"
117- # git config --global user.email "${{ github.actor }}@users.noreply.github.com"
118-
119- # # main 브랜치로 병합
120- # - name: Merge develop to main
121- # run: |
122- # git remote update
123- # git checkout main
124- # git config pull.rebase true
125- # git pull origin main # 최신 상태로 동기화
126- # git pull origin develop --allow-unrelated-histories
127- # git rebase --skip
128-
129- # # 병합 결과를 main 브랜치에 푸시
130- # - name: Push to main
131- # run: |
132- # git push origin main
121+ run : ./gradlew check
0 commit comments