2020-07-05 21:48:00 +00:00
|
|
|
|
name: Pull Request
|
|
|
|
|
|
|
|
|
|
on:
|
|
|
|
|
pull_request:
|
|
|
|
|
branches: [ master ]
|
|
|
|
|
|
|
|
|
|
jobs:
|
2020-08-29 18:26:36 +00:00
|
|
|
|
ktlint:
|
2020-07-05 21:48:00 +00:00
|
|
|
|
runs-on: ubuntu-latest
|
2020-08-29 18:26:36 +00:00
|
|
|
|
steps:
|
2023-09-06 12:33:14 +00:00
|
|
|
|
- uses: actions/checkout@v4
|
2023-04-25 01:05:20 +00:00
|
|
|
|
- name: Set up JDK 17
|
2023-09-23 14:59:50 +00:00
|
|
|
|
uses: actions/setup-java@v3.13.0
|
2020-08-29 18:26:36 +00:00
|
|
|
|
with:
|
2022-12-31 00:52:44 +00:00
|
|
|
|
distribution: 'temurin'
|
2023-04-25 01:05:20 +00:00
|
|
|
|
java-version: '17'
|
2020-08-29 18:26:36 +00:00
|
|
|
|
|
2022-03-23 00:18:21 +00:00
|
|
|
|
- uses: actions/cache@v3
|
2020-09-02 04:34:19 +00:00
|
|
|
|
with:
|
|
|
|
|
path: |
|
|
|
|
|
~/.gradle/caches
|
|
|
|
|
~/.gradle/wrapper
|
|
|
|
|
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
|
|
|
|
|
restore-keys: |
|
|
|
|
|
${{ runner.os }}-gradle-
|
|
|
|
|
|
2020-08-29 18:26:36 +00:00
|
|
|
|
- name: Mock google-services.json
|
2020-12-28 03:04:37 +00:00
|
|
|
|
run: |
|
|
|
|
|
cp .github/mock-google-services.json app/google-services.json
|
|
|
|
|
cp .github/mock-google-services.json wear/google-services.json
|
2023-03-31 21:54:33 +00:00
|
|
|
|
cp .github/mock-google-services.json automotive/google-services.json
|
2020-07-05 21:48:00 +00:00
|
|
|
|
|
2023-11-22 17:53:39 +00:00
|
|
|
|
- uses: gradle/wrapper-validation-action@v1
|
|
|
|
|
name: Validate Gradle Wrapper
|
|
|
|
|
|
2020-08-29 18:26:36 +00:00
|
|
|
|
- name: Validate ktlint
|
|
|
|
|
run: ./gradlew ktlintCheck
|
|
|
|
|
|
|
|
|
|
lint:
|
|
|
|
|
runs-on: ubuntu-latest
|
2020-07-05 21:48:00 +00:00
|
|
|
|
steps:
|
2023-09-06 12:33:14 +00:00
|
|
|
|
- uses: actions/checkout@v4
|
2023-04-25 01:05:20 +00:00
|
|
|
|
- name: Set up JDK 17
|
2023-09-23 14:59:50 +00:00
|
|
|
|
uses: actions/setup-java@v3.13.0
|
2020-08-29 18:26:36 +00:00
|
|
|
|
with:
|
2021-07-25 20:54:51 +00:00
|
|
|
|
distribution: 'adopt'
|
2023-04-25 01:05:20 +00:00
|
|
|
|
java-version: '17'
|
2020-08-29 18:26:36 +00:00
|
|
|
|
|
2022-03-23 00:18:21 +00:00
|
|
|
|
- uses: actions/cache@v3
|
2020-09-02 04:34:19 +00:00
|
|
|
|
with:
|
|
|
|
|
path: |
|
|
|
|
|
~/.gradle/caches
|
|
|
|
|
~/.gradle/wrapper
|
|
|
|
|
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
|
|
|
|
|
restore-keys: |
|
|
|
|
|
${{ runner.os }}-gradle-
|
|
|
|
|
|
2020-08-29 18:26:36 +00:00
|
|
|
|
- name: Mock google-services.json
|
2020-12-28 03:04:37 +00:00
|
|
|
|
run: |
|
|
|
|
|
cp .github/mock-google-services.json app/google-services.json
|
|
|
|
|
cp .github/mock-google-services.json wear/google-services.json
|
2023-03-31 21:54:33 +00:00
|
|
|
|
cp .github/mock-google-services.json automotive/google-services.json
|
2020-08-29 18:26:36 +00:00
|
|
|
|
|
2023-11-22 17:53:39 +00:00
|
|
|
|
- uses: gradle/wrapper-validation-action@v1
|
|
|
|
|
name: Validate Gradle Wrapper
|
|
|
|
|
|
2020-08-29 18:26:36 +00:00
|
|
|
|
- name: Validate Lint
|
|
|
|
|
run: ./gradlew lint
|
|
|
|
|
|
|
|
|
|
pr_build:
|
|
|
|
|
runs-on: ubuntu-latest
|
2023-08-01 19:51:58 +00:00
|
|
|
|
permissions:
|
|
|
|
|
contents: write
|
2020-08-29 18:26:36 +00:00
|
|
|
|
steps:
|
2023-09-06 12:33:14 +00:00
|
|
|
|
- uses: actions/checkout@v4
|
2021-02-22 03:03:16 +00:00
|
|
|
|
with:
|
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
2022-10-28 17:18:29 +00:00
|
|
|
|
- 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
|
|
|
|
|
|
2023-04-25 01:05:20 +00:00
|
|
|
|
- name: Set up JDK 17
|
2023-09-23 14:59:50 +00:00
|
|
|
|
uses: actions/setup-java@v3.13.0
|
2020-07-05 21:48:00 +00:00
|
|
|
|
with:
|
2021-07-25 20:54:51 +00:00
|
|
|
|
distribution: 'adopt'
|
2023-04-25 01:05:20 +00:00
|
|
|
|
java-version: '17'
|
2020-09-02 04:34:19 +00:00
|
|
|
|
|
2022-03-23 00:18:21 +00:00
|
|
|
|
- uses: actions/cache@v3
|
2020-09-02 04:34:19 +00:00
|
|
|
|
with:
|
|
|
|
|
path: |
|
|
|
|
|
~/.gradle/caches
|
|
|
|
|
~/.gradle/wrapper
|
|
|
|
|
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
|
|
|
|
|
restore-keys: |
|
|
|
|
|
${{ runner.os }}-gradle-
|
|
|
|
|
|
2020-07-05 21:48:00 +00:00
|
|
|
|
- name: Mock google-services.json
|
2020-12-28 03:04:37 +00:00
|
|
|
|
run: |
|
|
|
|
|
cp .github/mock-google-services.json app/google-services.json
|
|
|
|
|
cp .github/mock-google-services.json wear/google-services.json
|
2023-03-31 21:54:33 +00:00
|
|
|
|
cp .github/mock-google-services.json automotive/google-services.json
|
2021-02-22 03:03:16 +00:00
|
|
|
|
|
2023-11-22 17:53:39 +00:00
|
|
|
|
- uses: gradle/wrapper-validation-action@v1
|
|
|
|
|
name: Validate Gradle Wrapper
|
|
|
|
|
|
2020-07-05 21:48:00 +00:00
|
|
|
|
- name: Build Debug APK
|
|
|
|
|
run: ./gradlew assembleDebug
|
2022-10-28 17:18:29 +00:00
|
|
|
|
|
|
|
|
|
- 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
|
2023-06-26 13:05:17 +00:00
|
|
|
|
|
2020-07-05 21:48:00 +00:00
|
|
|
|
- name: Archive Debug Build
|
2022-11-22 20:25:42 +00:00
|
|
|
|
uses: actions/upload-artifact@v3
|
2020-07-05 21:48:00 +00:00
|
|
|
|
with:
|
2020-12-28 03:04:37 +00:00
|
|
|
|
path: ./**/*.apk
|