Skip to content

Commit

Permalink
Init with template
Browse files Browse the repository at this point in the history
  • Loading branch information
takahirom committed Apr 1, 2023
0 parents commit 5e98d33
Show file tree
Hide file tree
Showing 71 changed files with 2,203 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/ci-gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# From now in android
# https://github.com/android/nowinandroid

org.gradle.daemon=false
org.gradle.parallel=true
org.gradle.jvmargs=-Xmx5120m
org.gradle.workers.max=2

kotlin.incremental=false
kotlin.compiler.execution.strategy=in-process

# Controls KotlinOptions.allWarningsAsErrors. This is used in CI and can be set in local properties.
warningsAsErrors=true
100 changes: 100 additions & 0 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Build
# From now in android
# https://github.com/android/nowinandroid

on:
push:
branches:
- main
pull_request:
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 60

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1

- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Check spotless
run: ./gradlew spotlessCheck --stacktrace

- name: Check lint
run: ./gradlew lintDebug --stacktrace

- name: Build all build type and flavor permutations
run: ./gradlew assemble --stacktrace

- name: Run local tests
run: ./gradlew testDebug --stacktrace

- name: Upload build outputs (APKs)
uses: actions/upload-artifact@v3
with:
name: build-outputs
path: app/build/outputs

- name: Upload build reports
if: always()
uses: actions/upload-artifact@v3
with:
name: build-reports
path: app/build/reports

androidTest:
needs: build
runs-on: macOS-latest # enables hardware acceleration in the virtual machine
timeout-minutes: 45
strategy:
matrix:
api-level: [ 23, 26, 30 ]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Run instrumentation tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: x86_64
disable-animations: true
disk-size: 1500M
heap-size: 512M
script: ./gradlew connectedDebugAndroidTest

- name: Upload test reports
if: always()
uses: actions/upload-artifact@v3
with:
name: test-reports
path: '*/build/reports/androidTests'
46 changes: 46 additions & 0 deletions .github/workflows/DependencyDiff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: DependencyDiff
on:
pull_request:
paths:
- 'gradle/libs.versions.toml'
- '**/build.gradle.kts'
jobs:
dependency_diff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: set up JDK 11
uses: actions/setup-java@v1
with:
java-version: '11'
- id: dependency-diff
name: Generate dependency diff
run: |
BRANCH_NAME="${GITHUB_HEAD_REF}"
DIFF=$(scripts/dependency_diff.sh $BASE_BRANCH $BRANCH_NAME app releaseRuntimeClasspath)
DIFF="${DIFF//'%'/'%25'}"
DIFF="${DIFF//$'\n'/'%0A'}"
DIFF="${DIFF//$'\r'/'%0D'}"
echo "::set-output name=text-diff::${DIFF}"
env:
BASE_BRANCH: ${{ github.base_ref }}
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: peter-evans/find-comment@1769778a0c5bd330272d749d12c036d65e70d39d
id: find_comment
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: Dependency diff
- uses: peter-evans/create-or-update-comment@b95e16d2859ad843a14218d1028da5b2c4cbc4b4
if: ${{ steps.dependency-diff.outputs.text-diff != null || steps.find_comment.outputs.comment-id != null }}
with:
body: |
Dependency diff:
```diff
${{ steps.dependency-diff.outputs.text-diff }}
```
edit-mode: replace
comment-id: ${{ steps.find_comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
token: ${{ secrets.GITHUB_TOKEN }}
19 changes: 19 additions & 0 deletions .github/workflows/Format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Format
on: [pull_request]
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true

jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v1
with:
java-version: '11'
- run: ./gradlew spotlessKotlinApply
- uses: reviewdog/action-suggester@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tool_name: spotless
46 changes: 46 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# built application files
*.apk
*.ap_

# files for the dex VM
*.dex

# Java class files
*.class

# generated files
bin/
gen/
out/
build/

# Local configuration file (sdk path, etc)
local.properties

# Eclipse project files
.classpath
.project

# Windows thumbnail db
.DS_Store

# IDEA/Android Studio project files, because
# the project can be imported from settings.gradle.kts
*.iml
.idea/*
!.idea/copyright
# Keep the code styles.
!/.idea/codeStyles
/.idea/codeStyles/*
!/.idea/codeStyles/Project.xml
!/.idea/codeStyles/codeStyleConfig.xml

# Gradle cache
.gradle

# Sandbox stuff
_sandbox

# Android Studio captures folder
captures/
Footer
Loading

0 comments on commit 5e98d33

Please sign in to comment.