diff --git a/.bettercodehub.yml b/.bettercodehub.yml index 349f7675a..d7be51695 100644 --- a/.bettercodehub.yml +++ b/.bettercodehub.yml @@ -1,3 +1,3 @@ -component_depth: 8 +component_depth: 10 languages: - kotlin diff --git a/.circleci/config.yml b/.circleci/config.yml index cad321125..ce2922ba3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -98,7 +98,7 @@ jobs: command: yes | sdkmanager --licenses && yes | sdkmanager --update - run: name: Setup emulator - command: sdkmanager "system-images;android-19;default;armeabi-v7a" && echo "no" | avdmanager create avd -n test -k "system-images;android-19;default;armeabi-v7a" + command: sdkmanager "system-images;android-22;default;armeabi-v7a" && echo "no" | avdmanager create avd -n test -k "system-images;android-22;default;armeabi-v7a" - run: name: Launch emulator command: export LD_LIBRARY_PATH=${ANDROID_HOME}/emulator/lib64:${ANDROID_HOME}/emulator/lib64/qt/lib && emulator64-arm -avd test -noaudio -no-boot-anim -no-window -accel on @@ -116,7 +116,7 @@ jobs: adb shell input keyevent 82 - run: name: Run instrumented tests - command: ./gradlew clean createPlayDebugCoverageReport jacocoTestReport --no-daemon --stacktrace --console=plain -PdisablePreDex + command: ./gradlew clean createFdroidDebugCoverageReport jacocoTestReport --no-daemon --stacktrace --console=plain -PdisablePreDex - run: name: Collect logs from emulator command: adb logcat -d > ./app/build/reports/logcat_emulator.txt diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..a81b333f3 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,202 @@ +name: Test and deploy + +on: + push: + branches: [ develop ] + tags: [ '*' ] + pull_request: + branches: [ develop ] + + workflow_dispatch: + +jobs: + unit-tests: + name: Unit tests + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: fkirc/skip-duplicate-actions@master + - uses: actions/checkout@v2 + - uses: gradle/wrapper-validation-action@v1 + - uses: actions/setup-java@v1 + with: + java-version: 11 + - uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }} + - name: Unit tests + run: | + ./gradlew --build-cache -Pcoverage testFdroidDebugUnitTest --stacktrace + ./gradlew --build-cache -Pcoverage jacocoTestReport --stacktrace + - uses: codecov/codecov-action@v1 + with: + flags: unit + + deploy-google-play: + name: Deploy to google play + runs-on: ubuntu-latest + timeout-minutes: 10 + environment: google-play + needs: [ unit-tests ] + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: 11 + - uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }} + - name: Decrypt keys + env: + ENCRYPT_KEY: ${{ secrets.ENCRYPT_KEY }} + SERVICES_ENCRYPT_KEY: ${{ secrets.SERVICES_ENCRYPT_KEY }} + run: | + gpg --yes --batch --passphrase=$SERVICES_ENCRYPT_KEY ./app/src/release/google-services.json.gpg + gpg --yes --batch --passphrase=$ENCRYPT_KEY ./app/key.p12.gpg + gpg --yes --batch --passphrase=$ENCRYPT_KEY ./app/upload-key.jks.gpg + - name: Upload apk to google play + env: + PLAY_KEY_ALIAS: ${{ secrets.PLAY_KEY_ALIAS }} + PLAY_KEY_PASSWORD: ${{ secrets.PLAY_KEY_PASSWORD }} + PLAY_SERVICE_ACCOUNT_EMAIL: ${{ secrets.PLAY_SERVICE_ACCOUNT_EMAIL }} + PLAY_STORE_PASSWORD: ${{ secrets.PLAY_STORE_PASSWORD }} + run: ./gradlew publishPlayRelease -PenableFirebase --stacktrace; + + deploy-appcenter: + name: Deploy to App Center + runs-on: ubuntu-latest + timeout-minutes: 10 + environment: app-center + if: github.ref != 'refs/heads/develop' + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: 11 + - uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }} + - name: Set run number with offset + env: + BUILD_NUMBER_OFFSET: ${{ secrets.BUILD_NUMBER_OFFSET }} + run: echo "RUN_NUMBER=$((GITHUB_RUN_NUMBER+BUILD_NUMBER_OFFSET))" >> $GITHUB_ENV + - name: Prepare build configuration + run: | + sed -i -e "s#applicationIdSuffix \".dev\"#applicationIdSuffix \".${GITHUB_HEAD_REF//[-.\/]/_}\"#" app/build.gradle + sed -i -e "s#.dev\"#.${GITHUB_HEAD_REF//[-.\/]/_}\"#" app/src/debug/google-services.json + sed -i -e "s#.dev\"#.${GITHUB_HEAD_REF//[-.\/]/_}\"#" app/src/debug/agconnect-services.json + sed -i -e '/versionNameSuffix/d' app/build.gradle + - name: Add signing config + run: | + cat >> app/build.gradle <> $GITHUB_ENV + - name: Add signing config + run: | + cat >> app/build.gradle < +