CI pipeline 수정 #23
Workflow file for this run
This file contains 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
name: CI with Gradle | |
on: | |
pull_request: | |
branches: [ dev ] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: write-all | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Formatting with google java | |
uses: axel-op/googlejavaformat-action@v3 | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Execute Gradle build for all modules | |
run: | | |
set -e # 오류 발생 시 스크립트 종료 | |
# 모든 모듈을 찾습니다. (build.gradle 파일이 있는 디렉토리) | |
MODULES=$(find ./service -type f \( -name "build.gradle" \) -exec dirname {} \; | sort -u) | |
echo "Modules to build:" | |
echo "$MODULES" | |
# 각 모듈에 대해 순차적으로 빌드 | |
for folder in $MODULES; do | |
echo "----------------------------" | |
echo "Building in $folder..." | |
if [ -f "$folder/build.gradle" ]; then | |
echo "Building Gradle project in $folder..." | |
./gradlew -p "$folder" build -x test | |
else | |
echo "Skipping $folder: build.gradle not found." | |
fi | |
done |