Skip to content

Commit

Permalink
ci: unit test action 재사용
Browse files Browse the repository at this point in the history
  • Loading branch information
murjune committed Oct 23, 2024
1 parent 6c28cd9 commit 379e8a1
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 46 deletions.
14 changes: 13 additions & 1 deletion .github/actions/unit_test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ inputs:
GOOGLE_SERVICES:
description: 'Google Services JSON for release'
required: true
BUILD_VARIANT:
description: 'Build variant to run unit tests'
required: true


runs:
using: 'composite'
Expand Down Expand Up @@ -65,7 +69,15 @@ runs:
run: chmod +x gradlew
working-directory: ./android

- name: Convert Build Variant to Proper Case
shell: bash
run: |
BUILD_VARIANT=${{ inputs.BUILD_VARIANT }}
CAPITALIZED_BUILD_VARIANT="$(echo "${BUILD_VARIANT^}")"
echo "TEST_TASK=test${CAPITALIZED_BUILD_VARIANT}UnitTest" >> $GITHUB_ENV
- name: Run Alpha Unit Tests
shell: bash
run: ./gradlew testAlphaUnitTest
run: ./gradlew ${{ env.TEST_TASK }}
working-directory: ./android
99 changes: 54 additions & 45 deletions .github/workflows/Android_Develop_PR_CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,49 +25,58 @@ jobs:
runs-on: ubuntu-latest
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
with:
distribution: 'temurin'
java-version: 17

- name: Create Google-Services.json
env:
GOOGLE_SERVICES_ALPHA: ${{ secrets.GOOGLE_SERVICES_ALPHA }}
GOOGLE_SERVICES_BETA: ${{ secrets.GOOGLE_SERVICES_BETA }}
GOOGLE_SERVICES: ${{ secrets.GOOGLE_SERVICES }}
run: |
touch ./app/src/debug/google-services.json
touch ./app/src/alpha/google-services.json
touch ./app/src/beta/google-services.json
mkdir ./app/src/release
touch ./app/src/release/google-services.json
echo $GOOGLE_SERVICES_ALPHA >> ./app/src/debug/google-services.json
echo $GOOGLE_SERVICES_ALPHA >> ./app/src/alpha/google-services.json
echo $GOOGLE_SERVICES_BETA >> ./app/src/beta/google-services.json
echo $GOOGLE_SERVICES >> ./app/src/release/google-services.json
- 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: run alpha unit test
run: ./gradlew testAlphaUnitTest
uses: ./.github/actions/unit_test
with:
POKE_BASE_URL: ${{ secrets.POKE_BASE_URL }}
GOOGLE_SERVICES_ALPHA: ${{ secrets.GOOGLE_SERVICES_ALPHA }}
GOOGLE_SERVICES_BETA: ${{ secrets.GOOGLE_SERVICES_BETA }}
GOOGLE_SERVICES: ${{ secrets.GOOGLE_SERVICES }}
BUILD_VARIANT: 'alpha'

# - 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
# env:
# GOOGLE_SERVICES_ALPHA: ${{ secrets.GOOGLE_SERVICES_ALPHA }}
# GOOGLE_SERVICES_BETA: ${{ secrets.GOOGLE_SERVICES_BETA }}
# GOOGLE_SERVICES: ${{ secrets.GOOGLE_SERVICES }}
# run: |
# touch ./app/src/debug/google-services.json
# touch ./app/src/alpha/google-services.json
# touch ./app/src/beta/google-services.json
# mkdir ./app/src/release
# touch ./app/src/release/google-services.json
# echo $GOOGLE_SERVICES_ALPHA >> ./app/src/debug/google-services.json
# echo $GOOGLE_SERVICES_ALPHA >> ./app/src/alpha/google-services.json
# echo $GOOGLE_SERVICES_BETA >> ./app/src/beta/google-services.json
# echo $GOOGLE_SERVICES >> ./app/src/release/google-services.json
#
# - 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: run alpha unit test
# run: ./gradlew testAlphaUnitTest

0 comments on commit 379e8a1

Please sign in to comment.