diff --git a/.github/workflows/call-build.yml b/.github/workflows/call-build.yml new file mode 100644 index 00000000..52968ac8 --- /dev/null +++ b/.github/workflows/call-build.yml @@ -0,0 +1,53 @@ +name: Build + +on: + workflow_call: + +permissions: + pull-requests: write + statuses: write + checks: write + +jobs: + assembleDebug: + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: true + fetch-depth: 0 + ref: "refs/pull/${{ github.event.pull_request.number }}/merge" + + - name: Setup JDK + uses: actions/setup-java@v2 + with: + distribution: 'zulu' + java-version: '17' + + - name: Setup Android SDK + uses: android-actions/setup-android@v2 + + - name: Restore bundle cache + uses: actions/cache@v3 + with: + path: vendor/bundle + key: bundle-${{ hashFiles('**/Gemfile.lock') }} + + - name: Restore gradle cache + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle', '**/*.gradle.kts') }} + + - name: Create release keystore + run: echo "${{ secrets.RELEASE_KEYSTORE }}" | base64 -d > gradle/keystore/release.jks + + - name: Create local.properties + run: echo > local.properties + + - name: Build app + run: ./gradlew :app:assembleDebug diff --git a/.github/workflows/call-lint.yml b/.github/workflows/call-lint.yml new file mode 100644 index 00000000..b5d8f0dd --- /dev/null +++ b/.github/workflows/call-lint.yml @@ -0,0 +1,69 @@ +name: Lint + +on: + workflow_call: + +permissions: + pull-requests: write + statuses: write + checks: write + +jobs: + detekt: + if: github.event.pull_request.draft == false + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: true + fetch-depth: 0 + ref: "refs/pull/${{ github.event.pull_request.number }}/merge" + + - name: Setup JDK + uses: actions/setup-java@v2 + with: + distribution: 'zulu' + java-version: '17' + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.1.3 + + - name: Setup ReviewDog + uses: reviewdog/action-setup@v1.0.3 + with: + reviewdog_version: latest + + - name: Restore gradle cache + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle', '**/*.gradle.kts') }} + + - name: Create local.properties + run: echo > local.properties + + - name: Run detekt and merge reports + continue-on-error: true + run: ./gradlew detekt reportMerge --continue + + - name: Run report with ReviewDog + if: steps.detekt.outcome == 'failure' + env: + REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: cat ./build/reports/detekt/merge.xml | + reviewdog -f=checkstyle -name="detekt" -reporter="github-pr-review" + + - name: Comment lint check success + if: steps.detekt.outcome == 'success' + uses: marocchino/sticky-pull-request-comment@v2 + with: + header: detekt + recreate: true + message: | + :sparkles: :sparkles: **That's perfect, passed the PR lint check perfectly!** :sparkles: :sparkles: diff --git a/.github/workflows/pull-request-ci.yml b/.github/workflows/pull-request-ci.yml new file mode 100644 index 00000000..e551c484 --- /dev/null +++ b/.github/workflows/pull-request-ci.yml @@ -0,0 +1,23 @@ +name: CI + +on: + pull_request_target: + types: [ opened, reopened, synchronize, ready_for_review, converted_to_draft ] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number }} + cancel-in-progress: true + +permissions: + pull-requests: write + statuses: write + checks: write + actions: read + contents: read + +jobs: + Lint: + uses: ./.github/workflows/call-lint.yml + + Build: + uses: ./.github/workflows/call-build.yml