Merge pull request #628 from alvr/renovate/com.arkivanov.essenty-parc… #1804
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Katana | |
on: | |
pull_request: | |
push: | |
branches: | |
- develop | |
tags: | |
- v* | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
TZ: UTC | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
cancel-stale-jobs: | |
name: Cancel stale jobs | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cancel Stale Jobs | |
uses: styfle/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
validation: | |
name: Validation | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
fetch-depth: 0 | |
- name: Validate Gradle wrapper | |
uses: gradle/[email protected] | |
assemble: | |
name: Assembling | |
runs-on: ubuntu-latest | |
if: github.event_name == 'pull_request' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
fetch-depth: 0 | |
- name: Common Steps | |
uses: ./.github/actions/common-steps | |
- name: Assemble Katana | |
run: ./gradlew assembleDebug --no-daemon --scan --stacktrace | |
- name: Upload compose reports artifact | |
uses: actions/[email protected] | |
if: always() | |
with: | |
name: compose-reports | |
path: | | |
**/build/compose-metrics | |
**/build/compose-reports | |
retention-days: 7 | |
- name: Upload Android APK | |
uses: rnkdsh/[email protected] | |
id: diawi_android | |
with: | |
token: ${{ secrets.DIAWI_TOKEN }} | |
file: androidApp/build/outputs/apk/debug/androidApp-debug.apk | |
- name: Post comment with Diawi link | |
uses: peter-evans/[email protected] | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
body: | | |
| Android | iOS | | |
|:---------------------------------------------:|:--------:| | |
| [Download APK (v${{ github.run_number }})][1] | Not yet. | | |
| ![2] | Not yet. | | |
[1]: ${{ steps.diawi_android.outputs.url }} | |
[2]: https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${{ steps.diawi_android.outputs.url }} | |
static-analysis: | |
name: Static analysis | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
security-events: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
fetch-depth: 0 | |
- name: Common Steps | |
uses: ./.github/actions/common-steps | |
- name: Run detekt | |
run: ./gradlew detektAll lintDebug --no-daemon --stacktrace | |
- name: Upload static reports artifact | |
uses: actions/[email protected] | |
with: | |
name: static-report | |
path: | | |
build/reports/detekt/detekt.xml | |
**/build/reports/lint-results-debug.xml | |
retention-days: 1 | |
- name: Analyze detekt report | |
uses: github/codeql-action/[email protected] | |
with: | |
sarif_file: build/reports/detekt/detekt.sarif | |
checkout_path: ${{ github.workspace }} | |
unit-tests: | |
name: Unit testing | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
fetch-depth: 0 | |
- name: Common Steps | |
uses: ./.github/actions/common-steps | |
- name: Run unit tests | |
run: ./gradlew unitTests koverXmlReport koverVerify --no-daemon --scan --stacktrace | |
- name: Upload tests reports artifact (success) | |
uses: actions/[email protected] | |
if: success() | |
with: | |
name: tests-reports | |
path: build/reports/allTests | |
retention-days: 7 | |
- name: Upload tests reports artifact (failure) | |
uses: actions/[email protected] | |
if: failure() | |
with: | |
name: tests-reports | |
path: | | |
**/build/reports/tests/test | |
**/build/reports/tests/testDebugUnitTest | |
retention-days: 7 | |
- name: Upload coverage reports artifact | |
uses: actions/[email protected] | |
with: | |
name: coverage-reports | |
path: '**/build/reports/kover/report.xml' | |
retention-days: 1 | |
- name: Upload report to Codecov | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: build/reports/kover/report.xml | |
flags: unittests | |
verbose: true | |
sonar: | |
name: Sonar | |
if: false # Don't run action until fixes | |
runs-on: ubuntu-latest | |
needs: [ static-analysis, unit-tests ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
fetch-depth: 0 | |
- name: Common Steps | |
uses: ./.github/actions/common-steps | |
- name: Download static report artifacts | |
uses: actions/[email protected] | |
with: | |
name: static-report | |
path: . | |
- name: Download coverage artifact | |
uses: actions/[email protected] | |
with: | |
name: coverage-reports | |
path: . | |
- name: Run Sonar | |
if: github.event_name != 'pull_request' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: ./gradlew sonar --no-daemon --stacktrace | |
- name: Run Sonar in PR | |
if: github.event_name == 'pull_request' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: ./gradlew sonar -Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }} -Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }} -Dsonar.pullrequest.key=${{ github.event.pull_request.number }} --no-daemon --stacktrace | |
deploy-beta: | |
name: Beta deployment | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/develop' | |
needs: [ static-analysis, unit-tests ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
fetch-depth: 0 | |
- name: Common Steps | |
uses: ./.github/actions/common-steps | |
- name: Decode keystore | |
uses: timheuer/[email protected] | |
with: | |
fileDir: . | |
fileName: ${{ secrets.SIGNING_FILE }} | |
encodedString: ${{ secrets.SIGNING_FILE_BASE64 }} | |
- name: Bump versionCode | |
uses: chkfung/[email protected] | |
with: | |
gradlePath: build-logic/common/src/main/kotlin/dev/alvr/katana/buildlogic/extensions.kt | |
versionCode: ${{ github.run_number }} | |
- name: Build staging APK | |
env: | |
SIGNING_ALIAS: ${{ secrets.SIGNING_ALIAS }} | |
SIGNING_ALIAS_PASS: ${{ secrets.SIGNING_ALIAS_PASS }} | |
SIGNING_FILE: ${{ secrets.SIGNING_FILE }} | |
SIGNING_FILE_PASS: ${{ secrets.SIGNING_FILE_PASS }} | |
SENTRY_PROJECT: ${{ secrets.SENTRY_ANDROID_BETA_PROJECT }} | |
SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
run: ./gradlew assembleBeta -Pkatana.flavor=beta --no-daemon --scan --stacktrace | |
- name: Publish beta APK to TestApp.io | |
uses: testappio/github-action@v5 | |
with: | |
api_token: ${{ secrets.TESTAPPIO_API_TOKEN }} | |
app_id: ${{ secrets.TESTAPPIO_APP_ID }} | |
file: androidApp/build/outputs/apk/beta/androidApp-beta.apk | |
git_release_notes: true | |
include_git_commit_id: true | |
notify: true | |
- name: Publish beta APK to AppCenter | |
uses: wzieba/[email protected] | |
with: | |
appName: KatanaApp/Katana-Android | |
token: ${{ secrets.APPCENTER_TOKEN }} | |
group: Testers | |
file: androidApp/build/outputs/apk/beta/androidApp-beta.apk | |
notifyTesters: true | |
gitReleaseNotes: true | |
debug: false | |
- name: Create Sentry release | |
uses: getsentry/[email protected] | |
env: | |
SENTRY_PROJECT: ${{ secrets.SENTRY_ANDROID_BETA_PROJECT }} | |
SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
with: | |
environment: beta | |
version: ${{ github.run_number }} | |
deploy-production: | |
name: Production deployment | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: [ static-analysis, unit-tests ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
fetch-depth: 0 | |
- name: Common Steps | |
uses: ./.github/actions/common-steps | |
- name: Decode keystore | |
uses: timheuer/[email protected] | |
with: | |
fileDir: . | |
fileName: ${{ secrets.SIGNING_FILE }} | |
encodedString: ${{ secrets.SIGNING_FILE_BASE64 }} | |
- name: Build production AAB | |
env: | |
SIGNING_ALIAS: ${{ secrets.SIGNING_ALIAS }} | |
SIGNING_ALIAS_PASS: ${{ secrets.SIGNING_ALIAS_PASS }} | |
SIGNING_FILE: ${{ secrets.SIGNING_FILE }} | |
SIGNING_FILE_PASS: ${{ secrets.SIGNING_FILE_PASS }} | |
SENTRY_PROJECT: ${{ secrets.SENTRY_ANDROID_RELEASE_PROJECT }} | |
SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
run: ./gradlew assembleRelease bundleRelease -Pkatana.flavor=release --no-daemon --scan --stacktrace | |
- name: Publish production AAB to Google Play | |
uses: r0adkll/[email protected] | |
with: | |
serviceAccountJsonPlainText: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT }} | |
packageName: dev.alvr.katana | |
releaseFiles: androidApp/build/outputs/bundle/release/androidApp-release.aab | |
track: internal | |
status: completed | |
mappingFile: androidApp/build/outputs/mapping/release/mapping.txt | |
- name: Create Sentry release | |
uses: getsentry/[email protected] | |
env: | |
SENTRY_PROJECT: ${{ secrets.SENTRY_ANDROID_RELEASE_PROJECT }} | |
SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
with: | |
environment: production | |
version: ${{ github.ref }} | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref_name }} | |
name: Katana ${{ github.ref_name }} | |
files: | | |
androidApp/build/outputs/apk/release/androidApp-release.apk | |
draft: true | |
prerelease: false |