Skip to content

Commit

Permalink
[1.1.0-AN-CI/CD] WorkFlow PR CI 2번 돌아가는거 수정, CI/CD actions 파일로 분리 (#327)
Browse files Browse the repository at this point in the history
* [CI/CD] ktlint, unit test workFlow 파일 분리

* fix: Input BaseURL 로 수정

* fix: wokring-directory 수정

* fix: working-directory 개별 step 마다 적용

* add debuger

* unitTest파일 분리 되돌리기..
  • Loading branch information
murjune authored Sep 26, 2024
1 parent 59efa72 commit 81f1b66
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 287 deletions.
50 changes: 50 additions & 0 deletions .github/actions/ktlint_check/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: 'ktLint Check'

description: 'Run ktLint Check using Gradle'

inputs:
POKE_BASE_URL:
description: 'Base URL for local.properties'
required: true


runs:
using: 'composite'
steps:

- name: Gradle cache
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17

- name: Create Local Properties
shell: bash
run: touch local.properties
working-directory: ./android

- name: Access Local Properties
shell: bash
run: |
echo POKE_BASE_URL=\"${{ inputs.POKE_BASE_URL }}\" >> local.properties
working-directory: ./android

- name: Grant execute permission for gradlew
shell: bash
run: chmod +x gradlew
working-directory: ./android

- name: Lint Check
shell: bash
run: ./gradlew ktlintCheck
working-directory: ./android
71 changes: 71 additions & 0 deletions .github/actions/unit_test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: 'Test Alpha Unit Test'

description: 'Run Alpha Unit Tests using Gradle'

inputs:
POKE_BASE_URL:
description: 'Base URL for local.properties'
required: true
GOOGLE_SERVICES_ALPHA:
description: 'Google Services JSON for alpha build'
required: true
GOOGLE_SERVICES_BETA:
description: 'Google Services JSON for beta build'
required: true
GOOGLE_SERVICES:
description: 'Google Services JSON for release'
required: true

runs:
using: 'composite'

steps:
- name: Gradle cache
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17

- name: Create Google-Services.json
shell: bash
run: |
touch ./android/app/src/debug/google-services.json
touch ./android/app/src/alpha/google-services.json
touch ./android/app/src/beta/google-services.json
mkdir ./android/app/src/release
touch ./android/app/src/release/google-services.json
echo ${{ inputs.GOOGLE_SERVICES_ALPHA }} >> ./android/app/src/debug/google-services.json
echo ${{ inputs.GOOGLE_SERVICES_ALPHA }} >> ./android/app/src/alpha/google-services.json
echo ${{ inputs.GOOGLE_SERVICES_BETA }} >> ./android/app/src/beta/google-services.json
echo ${{ inputs.GOOGLE_SERVICES }} >> ./android/app/src/release/google-services.json
- name: Create Local Properties
shell: bash
run: touch local.properties
working-directory: ./android

- name: Access Local Properties
shell: bash
run: |
echo POKE_BASE_URL=\"${{ inputs.POKE_BASE_URL }}\" >> local.properties
working-directory: ./android

- name: Grant execute permission for gradlew
shell: bash
run: chmod +x gradlew
working-directory: ./android

- name: Run Alpha Unit Tests
shell: bash
run: ./gradlew testAlphaUnitTest
working-directory: ./android
229 changes: 0 additions & 229 deletions .github/workflows/Android_Develop_PR_Builder.yml

This file was deleted.

31 changes: 2 additions & 29 deletions .github/workflows/Android_Develop_PR_CD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,41 +17,14 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Gradle cache
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: set up JDK 17
uses: actions/setup-java@v3
- name: Run ktLint Check
uses: ./.github/actions/ktlint_check
with:
distribution: 'temurin'
java-version: 17

- name: Create Local Properties
run: touch local.properties

- name: Access Local Properties
env:
POKE_BASE_URL: ${{ secrets.POKE_BASE_URL }}
run: |
echo POKE_BASE_URL=\"${{ secrets.POKE_BASE_URL }}\" >> local.properties
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Lint Check
run: ./gradlew ktlintCheck

testAlphaUnitTest:
name: Test Alpha Unit Test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Gradle cache
Expand Down
Loading

0 comments on commit 81f1b66

Please sign in to comment.