Feat : 일기 타입별 분기 처리를 구현합니다. #11
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: Run Tests on Changed Modules | |
on: | |
pull_request: | |
branches: [ prod ] | |
permissions: write-all | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 체크아웃 | |
uses: actions/checkout@v3 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'corretto' | |
java-version: '21' | |
- name: Cache Gradle packages | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Detect changed modules | |
id: changed_modules | |
run: | | |
echo "CHANGED_MODULES=$(git diff --name-only origin/prod | cut -d'/' -f1 | uniq)" >> $GITHUB_ENV | |
- name: Run tests on changed modules | |
run: | | |
for module in $CHANGED_MODULES; do | |
./gradlew --info :$module:test | |
done | |
# 테스트 후 Result를 보기위해 Publish Unit Test Results step 추가 | |
- name: Publish Unit Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v1 | |
if: ${{ always() }} # 테스트가 실패하여도 Report를 보기 위해 `always`로 설정 | |
with: | |
files: build/test-results/**/*.xml |