Skip to content
This repository has been archived by the owner on Jul 25, 2023. It is now read-only.

Build project

Build project #36

Workflow file for this run

name: Build project
on:
pull_request:
push:
branches:
- master
- main
- trunk
- develop
- maine
- mane
schedule:
- cron: '0 3 * * 1,4'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 20
- uses: gradle/wrapper-validation-action@v1
- uses: gradle/gradle-build-action@v2
- run: ./gradlew projectCodestyle
- run: ./gradlew assembleRelease
env:
WYKOP_KEYSTORE_KEY_PASSWORD: ${{ secrets.WYKOP_KEYSTORE_KEY_PASSWORD }}
WYKOP_KEYSTORE_KEY_NAME: ${{ secrets.WYKOP_KEYSTORE_KEY_NAME }}
WYKOP_KEYSTORE_PASSWORD: ${{ secrets.WYKOP_KEYSTORE_PASSWORD }}
WYKOP_APPKEY: ${{ secrets.WYKOP_APPKEY }}
WYKOP_SECRETKEY: ${{ secrets.WYKOP_SECRETKEY }}
WYKOP_GOOGLEKEY: ${{ secrets.WYKOP_GOOGLEKEY }}
WYKOP_YOUTUBEKEY: ${{ secrets.WYKOP_YOUTUBEKEY }}
- run: ./gradlew projectCoverage
- uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
- run: ./gradlew projectLint -x :app:lintRelease -x :app:lintReleaseTest
- run: ./gradlew verifySqlDelightMigration
- uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
name: lint-results
path: '${{ github.workspace }}/**/build/**/reports/lint-results-*.html'
- uses: actions/upload-artifact@v3
with:
name: apk
path: |
app/build/outputs/apk/release/app-release.apk
app/build/outputs/mapping/release/mapping.txt
- uses: actions/cache@v3
name: Upload base (release)
if: github.event_name != 'pull_request'
with:
path: |
diffuse-source-file-release
diffuse-mapping-file-release
key: diffuse-${{ github.sha }}-${{ hashFiles('**/apk/debug/**.apk') }}
- run: cp app/build/outputs/apk/release/app-release.apk diffuse-source-file-release
if: github.event_name != 'pull_request'
shell: bash
- run: cp app/build/outputs/mapping/release/mapping.txt diffuse-mapping-file-release
if: github.event_name != 'pull_request'
shell: bash
ui_test:
runs-on: macos-latest
env:
WYKOP_KEYSTORE_KEY_PASSWORD: ${{ secrets.WYKOP_KEYSTORE_KEY_PASSWORD }}
WYKOP_KEYSTORE_KEY_NAME: ${{ secrets.WYKOP_KEYSTORE_KEY_NAME }}
WYKOP_KEYSTORE_PASSWORD: ${{ secrets.WYKOP_KEYSTORE_PASSWORD }}
WYKOP_APPKEY: ${{ secrets.WYKOP_APPKEY }}
WYKOP_SECRETKEY: ${{ secrets.WYKOP_SECRETKEY }}
WYKOP_GOOGLEKEY: ${{ secrets.WYKOP_GOOGLEKEY }}
WYKOP_YOUTUBEKEY: ${{ secrets.WYKOP_YOUTUBEKEY }}
strategy:
fail-fast: false
matrix:
apiVersion: [ 25, 28, 31, 32 ]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 20
- uses: gradle/gradle-build-action@v2
- run: ./gradlew app:assembleReleaseTestAndroidTest -PtestBuildType=releaseTest
- name: run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.apiVersion }}
profile: pixel_xl
target: google_apis
arch: x86_64
sdcard-path-or-size: 4G
disk-size: 6G
disable-spellchecker: true
script: |
adb logcat -c
touch app/build/emulator.log
chmod 777 app/build/emulator.log
adb logcat >> app/build/emulator.log &
./gradlew app:connectedReleaseTestAndroidTest -PtestBuildType=releaseTest
- name: Upload ui tests result
uses: actions/upload-artifact@v3
if: always()
with:
name: uitests-report${{ matrix.apiVersion }}
path: "${{ github.workspace }}/**/build/**/connected/"
- name: Save logcat output
uses: actions/upload-artifact@v3
if: failure()
with:
name: logcat${{ matrix.apiVersion }}
path: app/build/emulator.log
screenshot_test:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 20
- uses: actions/setup-python@v4
with:
python-version-file: '.python-version'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install 'Pillow==9.1.1'
- uses: gradle/gradle-build-action@v2
- run: ./gradlew assembleDebugAndroidTest
- name: run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 28
profile: pixel_xl
target: google_apis
arch: x86
disable-spellchecker: true
script: |
adb shell settings put global hidden_api_policy_p_apps 1
adb shell settings put global hidden_api_policy_pre_p_apps 1
adb shell settings put global hidden_api_policy 1
./gradlew verifyDebugAndroidTestScreenshotTest -m -q | grep verifyDebugAndroidTestScreenshotTest| awk '{print $1}' | xargs -n 1 -I % ./gradlew -Pandroid.testInstrumentationRunnerArguments.waitForActivitiesToComplete=false %
- name: Upload failed screenshjots
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: screenshots-report
path: "${{ github.workspace }}/**/build/failedScreenshots/"