-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (93 loc) · 4.2 KB
/
Copy pathbuild.yml
File metadata and controls
97 lines (93 loc) · 4.2 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
name: Build APKs
on:
workflow_dispatch:
merge_group:
push:
branches: [ master ]
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
env:
GRADLE_OPTS: -Dorg.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=1024m -Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemoryError -XX:+UseG1GC -Dkotlin.daemon.jvm.options=-Xmx4096m
CI_GRADLE_ARG_PROPERTIES: "--stacktrace"
permissions: {}
jobs:
build:
name: Build APKs
runs-on: ubuntu-latest
strategy:
matrix:
variant: [ debug, release ]
fail-fast: false
concurrency:
group: ${{ github.ref == 'refs/heads/master' && format('build-master-{0}-{1}', matrix.variant, github.sha) || format('build-{0}-{1}', matrix.variant, github.ref) }}
cancel-in-progress: true
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be
with:
# This might remove tools that are actually needed, if set to "true" but frees about 6 GB
tool-cache: true
# All of these default to true, but we should only need the 'android' one (and maybe swap-storage?)
android: false
dotnet: true
haskell: true
# This takes way too long to run (~2 minutes) and it saves only ~5.5GB
large-packages: false
docker-images: true
swap-storage: false
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Configure JDK
uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5.5.0
with:
distribution: 'temurin'
java-version: '21'
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0
- name: Restore Cache
uses: ./.github/actions/restore-cache
- name: Export AboutLibraries library definitions
# Used to run only once
if: matrix.variant == 'debug'
run: ./gradlew :android-app:exportLibraryDefinitions --dependency-verification lenient --continue $CI_GRADLE_ARG_PROPERTIES
- name: Assemble debug APKs
id: projectkafka-build
if: matrix.variant == 'debug'
run: ./gradlew :android-app:assembleDebug $CI_GRADLE_ARG_PROPERTIES
- name: Upload debug APKs
id: projectkafka-upload
if: matrix.variant == 'debug'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: projectkafka-debug
path: |
app/build/outputs/apk/debug/*-debug.apk
- name: Create app token for PR comments
if: matrix.variant == 'debug' && github.event_name == 'pull_request' && steps.projectkafka-upload.conclusion == 'success' && github.repository == github.event.pull_request.head.repo.full_name
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
id: app-token
with:
client-id: ${{ vars.HANEKOKORO_BOT_CLIENT_ID }}
private-key: ${{ secrets.HANEKOKORO_BOT_PRIVATE_KEY }}
- name: Comment on PR for artifacts link
if: matrix.variant == 'debug' && github.event_name == 'pull_request' && steps.projectkafka-upload.conclusion == 'success' && github.repository == github.event.pull_request.head.repo.full_name
uses: NejcZdovc/comment-pr@a423635d183a8259308e80593c96fecf31539c26 # v2.1.0
with:
message: |
**Download Debug Artifacts**: [projectkafka-debug.zip](https://nightly.link/ShadowRZ/ProjectKafka/actions/artifacts/${{ steps.projectkafka-upload.outputs.artifact-id }}.zip)
# Enables to identify and update existing Ad-hoc release message on new commit in the PR
identifier: "PROJECTKAFKA_COMMENT_ARTIFACTS"
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Compile release sources
if: ${{ matrix.variant == 'release' }}
run: ./gradlew :android-app:assembleRelease $CI_GRADLE_ARG_PROPERTIES
- name: Save Cache
uses: ./.github/actions/save-cache
if: github.event_name != 'pull_request'