Repository navigation
136 lines (133 loc) · 6.06 KB
/
Copy pathpr.yml
File metadata and controls
136 lines (133 loc) · 6.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: PR
# Pushes to develop run the same jobs, on the free runner, so each job leaves a Gradle cache entry
# behind that the next PR's job of the same name restores. PR runs only read the cache.
#
# The jobs build against the committed GraphQL schema and strings, so a PR passes or fails on its
# own content. The graphql-schema and strings workflows keep those files current, and the staging
# and Play Store workflows download the latest of both before building.
on:
pull_request:
push:
branches:
- develop
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
unit_test:
runs-on: ${{ github.event_name == 'push' && 'ubuntu-latest' || 'ubuntu-latest-8-vcpu' }}
steps:
- uses: actions/checkout@v7
- name: Setup CI
uses: ./.github/actions/common-setup
with:
gradle-cache-read-only: ${{ github.event_name == 'pull_request' }}
download-schema: 'false'
download-strings: 'false'
datadog-api-key: ${{ secrets.DATADOG_API_KEY }}
lokalise-id: ${{ secrets.LOKALISE_ID }}
lokalise-token: ${{ secrets.LOKALISE_TOKEN }}
- name: Unit tests
# `test` runs every module's unit tests; in KMP modules it depends on `jvmTest` and the Android
# host tests. Naming `jvmTest` as well adds nothing but is harmless. `test`/`jvmTest` (not
# `allTests`/`check`) keeps this off the iOS targets that can't run on the Linux runner.
run: ./gradlew test jvmTest
lint:
runs-on: ${{ github.event_name == 'push' && 'ubuntu-latest' || 'ubuntu-latest-8-vcpu' }}
steps:
- uses: actions/checkout@v7
- name: Setup CI
uses: ./.github/actions/common-setup
with:
gradle-cache-read-only: ${{ github.event_name == 'pull_request' }}
download-schema: 'false'
download-strings: 'false'
datadog-api-key: ${{ secrets.DATADOG_API_KEY }}
lokalise-id: ${{ secrets.LOKALISE_ID }}
lokalise-token: ${{ secrets.LOKALISE_TOKEN }}
- name: Lint
# `--continue` keeps Gradle going past a failing module, so every module writes its report
# before the annotate step reads them.
run: ./gradlew lint --continue
- name: Annotate lint findings in the PR
# Runs after a failed Lint step too: that is when there are findings to annotate. The Lint
# step is what fails the job, so this step's own exit code is ignored.
if: ${{ !cancelled() }}
uses: yutailang0119/action-android-lint@v6.0.0
with:
# Every module's lint report. The file name depends on the lint pass that wrote it:
# `lint-results-debug.xml` for `:app`, `lint-results-release.xml` for Android library modules,
# `lint-results-androidMain.xml` for the Android pass of a KMP module, and `lint-results.xml`
# for the JVM pass of a KMP module and for JVM modules.
report-path: "**/build/reports/lint-results*.xml"
continue-on-error: true
ktlint:
runs-on: ${{ github.event_name == 'push' && 'ubuntu-latest' || 'ubuntu-latest-8-vcpu' }}
steps:
- uses: actions/checkout@v7
- name: Setup CI
uses: ./.github/actions/common-setup
with:
gradle-cache-read-only: ${{ github.event_name == 'pull_request' }}
download-schema: 'false'
download-strings: 'false'
datadog-api-key: ${{ secrets.DATADOG_API_KEY }}
lokalise-id: ${{ secrets.LOKALISE_ID }}
lokalise-token: ${{ secrets.LOKALISE_TOKEN }}
- name: run ktlint from gradle
continue-on-error: true
run: ./gradlew ktlintCheck
- name: Annotate ktlint errors in the PR
continue-on-error: false
uses: yutailang0119/action-ktlint@v6
with:
report-path: "**/build/reports/ktlint/*.xml"
- name: check commonMain imports
if: ${{ !cancelled() }}
run: ./gradlew checkCommonMainImports
build:
runs-on: ${{ github.event_name == 'push' && 'ubuntu-latest' || 'ubuntu-latest-8-vcpu' }}
steps:
- uses: actions/checkout@v7
- name: Setup CI
uses: ./.github/actions/common-setup
with:
gradle-cache-read-only: ${{ github.event_name == 'pull_request' }}
download-schema: 'false'
download-strings: 'false'
datadog-api-key: ${{ secrets.DATADOG_API_KEY }}
lokalise-id: ${{ secrets.LOKALISE_ID }}
lokalise-token: ${{ secrets.LOKALISE_TOKEN }}
- name: Build
run: "./gradlew :app:bundleDebug"
- name: Compile the desktop app
run: "./gradlew :app-desktop:compileKotlinJvm"
# Uncomment these steps together to sign the debug AAB and attach it to each run as an
# artifact. The version code step stays off otherwise: it rewrites app/app/build.gradle.kts,
# which gives the app module new cache keys on every run.
# - run: echo VERSION_CODE=$(expr 4700 + ${{ github.run_number }} + ${{ github.run_attempt }} - 1) >> $GITHUB_ENV
# - uses: chkfung/android-version-actions@v1.2
# with:
# gradlePath: app/app/build.gradle.kts
# versionCode: ${{ env.VERSION_CODE }}
# - name: Setup build tool version variable
# shell: bash
# run: |
# BUILD_TOOL_VERSION=$(ls /usr/local/lib/android/sdk/build-tools/ | tail -n 1)
# echo "BUILD_TOOL_VERSION=$BUILD_TOOL_VERSION" >> $GITHUB_ENV
# echo Last build tool version is: $BUILD_TOOL_VERSION
# - uses: r0adkll/sign-android-release@v1
# name: Sign app AAB
# id: sign_app
# with:
# releaseDirectory: app/app/build/outputs/bundle/debug
# signingKeyBase64: ${{ secrets.SIGNING_KEY }}
# alias: ${{ secrets.ALIAS }}
# keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
# keyPassword: ${{ secrets.KEY_PASSWORD }}
# env:
# BUILD_TOOLS_VERSION: ${{ env.BUILD_TOOL_VERSION }}
# - uses: actions/upload-artifact@v7
# with:
# name: Pull Request-Build
# path: ${{ steps.sign_app.outputs.signedReleaseFile }}