home-assistant-android/.github/workflows/pr.yml
googlvalenzuela 8a322c624f
Android Automotive Module (#3423)
* Creation of Automotive Module and Fix OnboardingActivity parent Activity.

* Adding Manifest Dependencies.

* Fixing ktlint

* Remove unused import.

* Copy Google Services to android automotive

Github actions for PR require this to be set up in order for the build to pass.

* Missing two entries to copy the google-services.json file

* Fixing Build Process.

* Version code +2

We add 2 because the app, wear (+1) and automotive versions need to have different version codes.

* Update +3 per recomendation.

* Code to support transition from Full app to Car App Library.

* Fixing linter.

* More ktlin

/home/runner/work/android/android/app/src/main/java/io/homeassistant/companion/android/BaseActivity.kt:19:1 Needless blank line(s)
/home/runner/work/android/android/app/src/main/java/io/homeassistant/companion/android/BaseActivity.kt:31:95 Unnecessary semicolon
/home/runner/work/android/android/app/src/main/java/io/homeassistant/companion/android/BaseActivity.kt:39:1 Unexpected blank line(s) before "}"
/home/runner/work/android/android/app/src/main/java/io/homeassistant/companion/android/BaseActivity.kt:44:1 First line in a method block should not be empty

* Changes to allow navigate back from / native and feedback from PR.

* Indentation fixes.
2023-03-31 17:54:33 -04:00

121 lines
3.5 KiB
YAML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

name: Pull Request
on:
pull_request:
branches: [ master ]
jobs:
ktlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3.11.0
with:
distribution: 'temurin'
java-version: '11'
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Mock google-services.json
run: |
cp .github/mock-google-services.json app/google-services.json
cp .github/mock-google-services.json wear/google-services.json
cp .github/mock-google-services.json automotive/google-services.json
- name: Validate ktlint
run: ./gradlew ktlintCheck
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3.11.0
with:
distribution: 'adopt'
java-version: '11'
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Mock google-services.json
run: |
cp .github/mock-google-services.json app/google-services.json
cp .github/mock-google-services.json wear/google-services.json
cp .github/mock-google-services.json automotive/google-services.json
- name: Validate Lint
run: ./gradlew lint
pr_build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check for modified DB schemas on branch
run: |
if git diff --name-only --diff-filter=DMR origin/master... | grep "^common/schemas"; then
echo -e "\n❌ Existing database schema modified, please increase the database version instead"
exit 1
else
echo -e "\n✔ No changed database schemas on branch"
fi
- name: Set up JDK 11
uses: actions/setup-java@v3.11.0
with:
distribution: 'adopt'
java-version: '11'
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Mock google-services.json
run: |
cp .github/mock-google-services.json app/google-services.json
cp .github/mock-google-services.json wear/google-services.json
cp .github/mock-google-services.json automotive/google-services.json
- uses: ./.github/actions/create-release-notes
name: Create Release Notes
- name: Build Debug APK
run: ./gradlew assembleDebug
- name: Check for missing/modified DB schemas after build
run: |
if [[ $(git status common/schemas --porcelain) ]]; then
echo $(git status common/schemas --porcelain)
echo -e "\n❌ Found uncommitted changes in database schema directory, please make sure to include all changes in your commit(s)"
exit 1;
else
echo -e "\n✔ No changes in database schema directory after build"
fi
- name: Archive Debug Build
uses: actions/upload-artifact@v3
with:
path: ./**/*.apk