forked from marlboro-advance/mpvlibAndroid
-
Notifications
You must be signed in to change notification settings - Fork 4
192 lines (159 loc) · 5.1 KB
/
build.yml
File metadata and controls
192 lines (159 loc) · 5.1 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
name: build
on:
push:
branches:
- "**"
pull_request:
branches:
- "**"
workflow_dispatch:
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build Android AAR
runs-on: ubuntu-24.04
permissions:
contents: read
env:
CACHE_MODE: folder
CACHE_FOLDER: ${{ github.workspace }}/gh-cache
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_MAXSIZE: 5G
CCACHE_COMPRESS: "true"
CCACHE_NOHASHDIR: "true"
CCACHE_DISABLE: "true"
GRADLE_OPTS: >-
-Xmx4G
-Dorg.gradle.daemon=false
-Dorg.gradle.caching=true
-Dorg.gradle.parallel=true
-Dorg.gradle.configureondemand=true
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Java 17
uses: actions/setup-java@v4
with:
java-version: "17"
distribution: temurin
cache: gradle
- name: Setup Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Export CI environment variables
run: |
buildscripts/include/ci.sh export >> "$GITHUB_ENV"
- name: Restore Android SDK cache
id: android-sdk-cache
uses: actions/cache/restore@v4
with:
path: buildscripts/sdk/
key: android-sdk-${{ runner.os }}-${{ hashFiles('buildscripts/include/depinfo.sh', 'buildscripts/include/download-sdk.sh') }}
restore-keys: |
android-sdk-${{ runner.os }}-
- name: Restore native prefix cache
id: native-prefix-cache
uses: actions/cache/restore@v4
with:
path: gh-cache/
key: native-prefix-${{ runner.os }}-${{ env.CACHE_IDENTIFIER }}
restore-keys: |
native-prefix-${{ runner.os }}-
- name: Restore ccache
id: ccache-cache
uses: actions/cache/restore@v4
with:
path: .ccache/
key: ccache-${{ runner.os }}-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
ccache-${{ runner.os }}-${{ github.ref_name }}-
ccache-${{ runner.os }}-
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
autoconf \
automake \
build-essential \
ccache \
gcc g++ \
cmake \
gettext \
gperf \
libtool \
nasm \
ninja-build \
pkg-config \
python3 \
python3-pip \
unzip \
wget
- name: Install Python build dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade meson jinja2 jsonschema
- name: Download and extract source dependencies
run: |
set -euxo pipefail
cd buildscripts
./download.sh
- name: Save Android SDK cache
if: steps.android-sdk-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: buildscripts/sdk/
key: android-sdk-${{ runner.os }}-${{ hashFiles('buildscripts/include/depinfo.sh', 'buildscripts/include/download-sdk.sh') }}
- name: Save native prefix cache
if: steps.native-prefix-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: gh-cache/
key: native-prefix-${{ runner.os }}-${{ env.CACHE_IDENTIFIER }}
- name: Show ccache stats before build
run: |
ccache --zero-stats || true
ccache --show-stats || true
- name: Build AAR for all Android architectures
run: |
set -euxo pipefail
unset ANDROID_SDK_ROOT
cd buildscripts
source include/build_config.sh
arches=(arm64)
[ "$ENABLE_ARM_V9A" = "true" ] && arches+=(arm64-v9a)
[ "$ENABLE_X86_ARCH" = "true" ] && arches+=(x86 x86_64)
for arch in "${arches[@]}"; do
./buildall.sh --arch "$arch" mpv
done
./buildall.sh --clean mpv-android
- name: Show ccache stats after build
if: always()
run: |
ccache --show-stats || true
- name: Save ccache
if: always() && steps.ccache-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: .ccache/
key: ccache-${{ runner.os }}-${{ github.ref_name }}-${{ github.sha }}
- name: Stage AAR artifact
run: |
set -euxo pipefail
mkdir -p dist
AAR_PATH="app/build/outputs/aar/app-release.aar"
if [ ! -f "$AAR_PATH" ]; then
echo "AAR file not found at: $AAR_PATH"
find app/build/outputs -type f || true
exit 1
fi
cp "$AAR_PATH" dist/mpvlib.aar
- name: Upload AAR artifact
uses: actions/upload-artifact@v4
with:
name: mpvlib
path: dist/mpvlib.aar
if-no-files-found: error