diff --git a/.github/workflows/android.yaml b/.github/workflows/android.yaml new file mode 100644 index 00000000..a93ffa93 --- /dev/null +++ b/.github/workflows/android.yaml @@ -0,0 +1,113 @@ +name: Android CI + +on: + push: + branches: [ "develop" ] + pull_request: + types: [opened, synchronize, ready_for_review, edited] + branches: [ "develop", "refactor**", "fix**", "feat**", "feature**", "chore**", "test**" ] + +jobs: + spotless_check: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'temurin' + cache: gradle + - name: add local.properties + run: | + echo api.key=\"${{secrets.API_KEY}}\" > local.properties + - name: Cache Gradle Packages + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/buildSrc/**/*.kt') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Spotless Check + run: ./gradlew spotlessCheck + + spotless_apply: + needs: spotless_check + if: failure() + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'temurin' + cache: gradle + - name: add local.properties + run: | + echo api.key=\"${{secrets.API_KEY}}\" > local.properties + - name: Cache Gradle Packages + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/buildSrc/**/*.kt') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: set git config + if: success() + run: | + git config --global user.email "you@example.com" + git config --global user.name "$GITHUB_ACTOR" + git remote update + git fetch + git checkout origin/$GITHUB_HEAD_REF + - name: Spotless Apply + run: ./gradlew spotlessApply + - name: git commit and push + if: ${{ success() }} + run: | + git add . + git commit -m "Apply Spotless formatting" + git push origin HEAD:$GITHUB_HEAD_REF + + build: + runs-on: ubuntu-latest + needs: spotless_check + if: success() + + steps: + - uses: actions/checkout@v3 + - name: set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'temurin' + cache: gradle + - name: add local.properties + run: | + echo api.key=\"${{secrets.API_KEY}}\" > local.properties + - name: Cache Gradle Packages + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/buildSrc/**/*.kt') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build with Gradle + run: ./gradlew app:assembleDebug diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml deleted file mode 100644 index 9b347f57..00000000 --- a/.github/workflows/android.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Android CI - -on: - push: - branches: [ "develop" ] - pull_request: - types: [opened, synchronize, ready_for_review, edited] - branches: [ "develop", "refactor**", "fix**", "feat**", "feature**", "chore**", "test**" ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: set up JDK 11 - uses: actions/setup-java@v3 - with: - java-version: '11' - distribution: 'temurin' - cache: gradle - - name: add local.properties - run: | - echo api.key=\"${{secrets.API_KEY}}\" > local.properties - - name: Cache Gradle Packages - uses: actions/cache@v3 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/buildSrc/**/*.kt') }} - restore-keys: | - ${{ runner.os }}-gradle- - - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Build with Gradle - run: ./gradlew app:assembleDebug - diff --git a/.github/workflows/lint_check.yml b/.github/workflows/lint_check.yml deleted file mode 100644 index cc257100..00000000 --- a/.github/workflows/lint_check.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Lint Check - -on: - push: - branches: [ "develop" ] - pull_request: - branches: [ "develop", "refactor**", "fix**", "feat**", "feature**", "chore**", "test**" ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: set up JDK 11 - uses: actions/setup-java@v3 - with: - java-version: '11' - distribution: 'temurin' - cache: gradle - - - name: add local.properties - run: | - echo api.key=\"${{secrets.API_KEY}}\" > local.properties - - name: Cache Gradle Packages - uses: actions/cache@v3 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/buildSrc/**/*.kt') }} - restore-keys: | - ${{ runner.os }}-gradle- - - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Lint Check - run: ./gradlew spotlessCheck