-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(actions): setup github actions
- Loading branch information
Showing
7 changed files
with
234 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: "setup KVM" | ||
description: "setup KVM group for Android Emulator" | ||
inputs: | ||
prepare-script: | ||
description: "custom script to run before the main script - e.g. `./gradlew assembleDebugAndroidTest`" | ||
required: false | ||
script: | ||
description: "custom script to run - e.g. `./gradlew connectedDebugAndroidTest`" | ||
required: true | ||
default: "" | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: setup KVM | ||
shell: bash | ||
run: | | ||
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | ||
sudo udevadm control --reload-rules | ||
sudo udevadm trigger --name-match=kvm | ||
- name: AVD cache | ||
uses: actions/cache@v4 | ||
id: avd-cache | ||
with: | ||
path: | | ||
~/.android/avd/* | ||
~/.android/adb* | ||
key: 'avd-${{ runner.os }}-${{ inputs.script }}-${{ inputs.prepare-script }}' | ||
|
||
- name: create AVD and generate snapshot for caching | ||
if: steps.avd-cache.outputs.cache-hit != 'true' | ||
uses: reactivecircus/android-emulator-runner@v2 | ||
with: | ||
api-level: 34 | ||
force-avd-creation: false | ||
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | ||
disable-animations: false | ||
script: echo "Generated AVD snapshot for caching." | ||
|
||
- name: prepare script | ||
shell: bash | ||
if: inputs.prepare-script != '' | ||
run: | | ||
${{ inputs.prepare-script }} | ||
- name: run script | ||
uses: reactivecircus/android-emulator-runner@v2 | ||
with: | ||
api-level: 34 | ||
force-avd-creation: false | ||
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | ||
disable-animations: true | ||
script: ${{ inputs.script }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: "setup gradle" | ||
description: "setup gradle" | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: setup gradle | ||
uses: gradle/actions/setup-gradle@v4 | ||
with: | ||
gradle-version: wrapper | ||
cache-cleanup: always | ||
add-job-summary-as-pr-comment: on-failure | ||
artifact-retention-days: 3 | ||
|
||
- name: list toolchain | ||
shell: bash | ||
run: | | ||
./gradlew -q javaToolchains --no-daemon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: "setup JDK" | ||
description: "setup JDK" | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: setup JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: "temurin" | ||
java-version: "17" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "gradle" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
groups: | ||
compose: | ||
patterns: | ||
- "androidx.compose*" | ||
- "androidx.constraintlayout:constraintlayout-compose*" | ||
dagger: | ||
patterns: | ||
- "com.google.dagger*" | ||
- "androidx.hilt*" | ||
# https://docs.github.com/ja/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#open-pull-requests-limit | ||
# default: 5 | ||
open-pull-requests-limit: 15 | ||
|
||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
open-pull-requests-limit: 15 | ||
|
||
# https://github.com/dependabot/dependabot-core/issues/5137 | ||
- package-ecosystem: "github-actions" | ||
directory: ".github/actions/gradle" | ||
schedule: | ||
interval: "daily" | ||
|
||
- package-ecosystem: "github-actions" | ||
directory: ".github/actions/java" | ||
schedule: | ||
interval: "daily" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: auto-merge | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
enable-auto-merge: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
issues: write | ||
checks: write | ||
pull-requests: write | ||
repository-projects: write | ||
if: ${{ github.actor_id == '49699333' }} # "dependabot[bot]" | ||
steps: | ||
- name: enable auto-merge | ||
shell: bash | ||
run: | ||
gh pr merge --auto --squash "${{ github.event.pull_request.html_url }}" | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: check | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
contents: read | ||
checks: write | ||
pull-requests: write | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/java | ||
- uses: ./.github/actions/gradle | ||
- name: run android lint | ||
shell: bash | ||
run: | | ||
./gradlew :app:lintDebug | ||
- name: run detekt | ||
shell: bash | ||
run: | | ||
./gradlew detekt | ||
unit-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/java | ||
- uses: ./.github/actions/gradle | ||
- name: unit test | ||
shell: bash | ||
run: | | ||
./gradlew testDebugUnitTest | ||
- uses: EnricoMi/publish-unit-test-result-action@v2 | ||
if: ${{ !cancelled() }} | ||
with: | ||
check_name: unit-test | ||
files: | | ||
**/test-results/**/*.xml | ||
android-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/java | ||
- uses: ./.github/actions/gradle | ||
- uses: ./.github/actions/avd | ||
with: | ||
prepare-script: ./gradlew assembleDebug | ||
script: ./gradlew connectedDebugAndroidTest | ||
- uses: EnricoMi/publish-unit-test-result-action@v2 | ||
if: ${{ !cancelled() }} | ||
with: | ||
check_name: android-test | ||
files: | | ||
**/outputs/androidTest-results/connected/**/*.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: stability | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
dependency-report: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/java | ||
- uses: gradle/actions/dependency-submission@v4 | ||
with: | ||
gradle-version: wrapper | ||
dependency-resolution-task: 'resolveAllDependencies' | ||
validate-wrappers: true |