-
Notifications
You must be signed in to change notification settings - Fork 6
141 lines (135 loc) · 5.67 KB
/
deploy-android.yml
File metadata and controls
141 lines (135 loc) · 5.67 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
137
138
139
140
141
name: deploy-android
on:
workflow_call:
inputs:
project-name:
description: 'Name of the application to build (e.g. qTox)'
required: false
type: string
cmake-args:
description: 'Arguments to pass to CMake'
required: false
type: string
production:
description: |
Whether to upload the release to the GitHub release page, i.e.
the Android build is of production quality. If false, the build
will be uploaded to the nightly release page only.
required: false
type: boolean
default: false
jobs:
build:
name: Build
runs-on: ubuntu-24.04
permissions:
contents: write
strategy:
matrix:
arch: [armeabi-v7a, arm64-v8a]
build-type: [Debug, Release]
version: [6.2.4, 6.8.1]
exclude:
- arch: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'packaging') && 'armeabi-v7a' }}
- build-type: ${{ (github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'packaging') || contains(github.ref, 'refs/tags/v')) && 'Debug' }}
- version: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'packaging') && '6.8.1' }}
steps:
- name: Install prerequisites
run: sudo apt-get install -y --no-install-recommends pcregrep
- uses: actions/checkout@v6
with:
fetch-depth: 0
submodules: true
- name: Checkout ci-tools
if: github.repository != 'TokTok/ci-tools'
uses: actions/checkout@v6
with:
repository: TokTok/ci-tools
path: third_party/ci-tools
submodules: true
- name: Link ci-tools
if: github.repository == 'TokTok/ci-tools'
run: ln -s .. third_party/ci-tools
- name: Checkout dockerfiles
uses: actions/checkout@v6
with:
repository: TokTok/dockerfiles
path: third_party/dockerfiles
submodules: true
- name: Copy docker-compose.yml
run: cp third_party/dockerfiles/docker-compose.yml .
- name: Determine artifact file name
id: artifact
run: |
PROJECT_NAME="${{ inputs.project-name }}"
if [ -z "$PROJECT_NAME" ]; then
PROJECT_NAME="$(pcregrep -M -o1 'project\(\s*(\S+)' CMakeLists.txt)"
fi
echo "project-name=$PROJECT_NAME" >>$GITHUB_OUTPUT
ARTIFACT_TYPE="$(echo '${{ matrix.build-type }}' | tr '[:upper:]' '[:lower:]')"
ARTIFACT="$PROJECT_NAME.apk"
echo "artifact-source=$ARTIFACT" >>$GITHUB_OUTPUT
echo "artifact-versioned=$PROJECT_NAME-\$VERSION-${{ matrix.arch }}-$ARTIFACT_TYPE-${{ matrix.version }}.apk" >>$GITHUB_OUTPUT
echo "docker_image=android_builder.${{ matrix.arch }}.${ARTIFACT_TYPE}_${{ matrix.version }}" >>$GITHUB_OUTPUT
- name: Cache compiler output
uses: actions/cache@v5
with:
path: .cache/ccache
key: ${{ github.job }}-android-${{ matrix.arch }}-${{ matrix.build-type }}-${{ matrix.version }}-ccache
- name: Download Docker image
run: docker compose run --rm ${{ steps.artifact.outputs.docker_image }} uname -a
- name: Run build
run: docker compose run
--rm
${{ steps.artifact.outputs.docker_image }}
third_party/ci-tools/platform/android/cross-compile/build.sh
--project-name ${{ steps.artifact.outputs.project-name }}
--qt-version ${{ matrix.version }}
--arch ${{ matrix.arch }}
--build-type ${{ matrix.build-type }}
--
${{ inputs.cmake-args }}
- name: Generate sha256 checksum
id: sha256
run: third_party/ci-tools/tools/artifact_sha256.py
"${{ steps.artifact.outputs.project-name }}"
${{ steps.artifact.outputs.artifact-source }}
- name: Upload artifact
uses: actions/upload-artifact@v6
with:
name: ${{ steps.sha256.outputs.project-name }}-${{ github.sha }}-android-${{ matrix.arch }}-${{ matrix.build-type }}-${{ matrix.version }}
path: ${{ steps.sha256.outputs.artifacts }}
if-no-files-found: error
- name: Rename artifact for release upload
id: release-version
if: contains(github.ref, 'refs/tags/v')
run: VERSION="$(echo "$GITHUB_REF" | cut -d / -f 3)";
third_party/ci-tools/tools/artifact_rename.py
"${{ steps.artifact.outputs.artifact-source }}"
"${{ steps.artifact.outputs.artifact-versioned }}"
${{ steps.artifact.outputs.artifact-source }}
- name: Upload to versioned release
if: inputs.production && contains(github.ref, 'refs/tags/v')
uses: ncipollo/release-action@v1
with:
allowUpdates: true
draft: true
artifacts: ${{ steps.release-version.outputs.artifacts }}
- name: Rename artifact for nightly upload
id: nightly-version
run: VERSION="nightly";
third_party/ci-tools/tools/artifact_rename.py
"${{ steps.artifact.outputs.artifact-source }}"
"${{ steps.artifact.outputs.artifact-versioned }}"
${{ steps.artifact.outputs.artifact-source }}
- name: Upload to nightly release
uses: ncipollo/release-action@v1
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
with:
allowUpdates: true
tag: nightly
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
prerelease: true
replacesArtifacts: true
artifacts: ${{ steps.nightly-version.outputs.artifacts }}