-
Notifications
You must be signed in to change notification settings - Fork 0
140 lines (125 loc) · 5.97 KB
/
build.yml
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
137
138
139
140
name: Build & Test
on:
push:
branches:
- main
paths-ignore:
- 'website/**'
- 'fastlane/**'
- 'assets/**'
- '**/*.md'
pull_request:
branches:
- main
jobs:
build:
# run on macOS to use Skiko mac for credits checks
runs-on: macos-latest
permissions:
contents: read
checks: write
id-token: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: ☕ Setup JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
- name: 🐘 Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
add-job-summary-as-pr-comment: on-failure
- name: 🔓 Decrypt secrets
env:
PLAYSTORE_SECRET_PASSPHRASE: ${{ secrets.PLAYSTORE_SECRET_PASSPHRASE }}
run: ./_ci/decrypt_secrets.sh
- name: ©️ Generate credits for ':tasks-app-desktop'
id: check_desktop_app_credits
run: |
./gradlew --no-daemon :tasks-app-desktop:exportLibraryDefinitions -PaboutLibraries.exportPath=src/main/resources
stale_credits=$(git diff tasks-app-desktop/src/main/resources/licenses_desktop.json)
if [ -n "${stale_credits}" ]; then
{
echo "## Stale credits for \`:tasks-app-desktop\`"
echo "\`\`\`diff"
echo "${stale_credits}"
echo "\`\`\`"
} >> "${GITHUB_STEP_SUMMARY}"
echo "::warning file=tasks-app-desktop/src/main/resources/licenses_desktop.json,title=Stale credits::Some licenses information are not up to date for ':tasks-app-desktop'"
# ::set-output is deprecated, but nothing works with multiline strings and GITHUB_OUTPUT :(
# see https://lab.amalitsky.com/posts/2022/github-actions-set-output-migration/
echo ::set-output name=credits_diff_comment::$(./_ci/generate_github_comment_stale_credits.sh ":tasks-app-desktop")
fi
- name: 🛎️ Notify stale credits for ':tasks-app-desktop'
if: github.event_name == 'pull_request' && steps.check_desktop_app_credits.outputs.credits_diff_comment != ''
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '${{ steps.check_desktop_app_credits.outputs.credits_diff_comment }}'
})
- name: 🔨 Build Desktop App 🖥️
run: ./gradlew --no-daemon :tasks-app-desktop:assemble
- name: ©️ Generate credits for ':tasks-app-android'
id: check_android_app_credits
run: |
./gradlew --no-daemon :tasks-app-android:exportLibraryDefinitions -PaboutLibraries.exportPath=src/main/assets
stale_credits=$(git diff tasks-app-android/src/main/assets/licenses_android.json)
if [ -n "${stale_credits}" ]; then
{
echo "## Stale credits for \`:tasks-app-android\`"
echo "\`\`\`diff"
echo "${stale_credits}"
echo "\`\`\`"
} >> "${GITHUB_STEP_SUMMARY}"
echo "::warning file=tasks-app-android/src/main/assets/licenses_android.json,title=Stale credits::Some licenses information are not up to date for ':tasks-app-android'"
# ::set-output is deprecated, but nothing works with multiline strings and GITHUB_OUTPUT :(
# see https://lab.amalitsky.com/posts/2022/github-actions-set-output-migration/
echo ::set-output name=credits_diff_comment::$(./_ci/generate_github_comment_stale_credits.sh ":tasks-app-android")
fi
- name: 🛎️ Notify stale credits for ':tasks-app-android'
if: github.event_name == 'pull_request' && steps.check_android_app_credits.outputs.credits_diff_comment != ''
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '${{ steps.check_android_app_credits.outputs.credits_diff_comment }}'
})
- name: 🔨 Build Android App 📱
env:
PLAYSTORE_SECRET_PASSPHRASE: ${{ secrets.PLAYSTORE_SECRET_PASSPHRASE }}
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEYSTORE_KEY_PASSWORD: ${{ secrets.KEYSTORE_KEY_PASSWORD }}
run: |
./gradlew --no-daemon :tasks-app-android:assembleStoreRelease \
-Pci=true \
-Pplaystore.keystore.file="${PWD}/_ci/tasksApp.keystore" \
-Pplaystore.keystore.password="${KEYSTORE_PASSWORD}" \
-Pplaystore.keystore.key_password="${KEYSTORE_KEY_PASSWORD}"
# `test` to trigger as much Jvm tests as possible
# `:tasks-app-android:testStoreReleaseUnitTest` to restrict to only specific flavor(store)+variant(release) for `:tasks-app-android` module.
# `jvmTest` to execute Compose UI tests on Jvm
# `-x :tasks-app-android:test` to remove all tests from `:tasks-app-android` module not being covered by `:tasks-app-android:testStoreReleaseUnitTest`.
# `-x testDebugUnitTest` to avoid triggering tests both in debug & release build.
# `-x :tasks-app-android:build` to avoid triggering useless build tasks (typically for unused flavors).
# Only rely on dependencies of `:tasks-app-android:testStoreReleaseUnitTest`.
- name: ✅ Test
run: |
./gradlew --no-daemon test :tasks-app-android:testStoreReleaseUnitTest jvmTest \
-x :tasks-app-android:test -x testDebugUnitTest -x :tasks-app-android:build
- name: 🗒️ Publish Test Reports
uses: mikepenz/action-junit-report@v4
if: success() || failure()
with:
detailed_summary: true
require_passed_tests: true
require_tests: true
report_paths: '**/build/test-results/**/TEST-*.xml'