Skip to content
This repository has been archived by the owner on Oct 6, 2024. It is now read-only.

Commit

Permalink
add CI
Browse files Browse the repository at this point in the history
  • Loading branch information
matsumo0922 committed Dec 10, 2023
1 parent af717e0 commit 3957447
Show file tree
Hide file tree
Showing 3 changed files with 145 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/call-build.yml
Original file line number Diff line number Diff line change
@@ -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
69 changes: 69 additions & 0 deletions .github/workflows/call-lint.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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:
23 changes: 23 additions & 0 deletions .github/workflows/pull-request-ci.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 3957447

Please sign in to comment.