-
Notifications
You must be signed in to change notification settings - Fork 60
216 lines (200 loc) · 7.35 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
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
name: build
on: [push, pull_request]
jobs:
upload-src:
name: Upload the source
runs-on: ubuntu-latest
steps:
- name: prep ubuntu
run: |
sudo apt-get update
DEBIAN_FRONTEND=noninteractive sudo apt-get install -yq \
${{ matrix.pkgs }} cmake git golang libbrotli-dev \
libgtest-dev liblz4-dev libpcre2-dev libprotobuf-dev libunwind-dev \
libzstd-dev make pandoc pkg-config
- name: checkout
uses: actions/checkout@v4
with:
submodules: true
- name: git config
run: |
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
- name: get vendor modules
run: |
cd vendor/boringssl
go mod vendor
- name: generate man page
run: |
cd vendor/adb/docs/user
pandoc -s -t man adb.1.md -o adb.1
- name: build & install
run: |
mkdir build && cd build
cmake \
-DANDROID_TOOLS_USE_BUNDLED_FMT=ON \
-DANDROID_TOOLS_USE_BUNDLED_LIBUSB=ON \
..
make package_source
for x in sha1sum sha256sum sha512sum b2sum; do
printf "$x " && $x ${{ github.workspace }}/build/android-tools-*.tar.xz | cut -d " " -f 1
done
- name: upload package_source
uses: actions/upload-artifact@v4
with:
name: package_source
path: ${{ github.workspace }}/build/android-tools-*.tar.xz
linux:
runs-on: ubuntu-latest
needs: [upload-src]
strategy:
fail-fast: false
matrix:
include:
- os: "opensuse/leap:latest"
pkgs: "clang gcc11-c++"
env1: "CC=clang CXX=clang++"
- os: "opensuse/tumbleweed"
pkgs: "gcc gcc-c++"
- os: "opensuse/tumbleweed"
pkgs: clang
env1: "CC=clang CXX=clang++"
- os: "archlinux:base"
pkgs: gcc
- os: "archlinux:base"
pkgs: clang
env1: "CC=clang CXX=clang++"
- os: "ubuntu:20.04"
pkgs: "gcc-10 g++-10"
env1: "CC=gcc-10 CXX=g++-10"
- os: "ubuntu:20.04"
pkgs: "clang-11 libstdc++-10-dev"
env1: "CC=clang-11 CXX=clang++-11"
- os: "alpine"
pkgs: "gcc"
env1: "CC=gcc CXX=g++"
- os: "fedora:latest"
pkgs: "gcc gcc-g++"
- os: "fedora:rawhide"
pkgs: "gcc gcc-g++"
container:
image: ${{ matrix.os }}
# New versions of glibc use the new clone3() syscall which has not
# yet been whitelisted in GitHub's secomp profile. To prevent jobs
# using these distros from failing (e.g. openSUSE) change the
# secomp policy.
#
# See https://github.com/nmeum/android-tools/pull/48#issuecomment-944893176
options: --security-opt seccomp=unconfined
steps:
- name: prep opensuse
if: startsWith(matrix.os, 'opensuse')
run: |
zypper -n ref
zypper -n in ${{ matrix.pkgs }} cmake git go gtest pcre2-devel pkgconfig \
'pkgconfig(libbrotlicommon)' 'pkgconfig(liblz4)' \
'pkgconfig(libunwind-generic)' \
'pkgconfig(libzstd)' 'pkgconfig(protobuf)' ninja tar xz
- name: prep archlinux
if: startsWith(matrix.os, 'archlinux')
run: |
pacman -Syu --needed --noconfirm \
${{ matrix.pkgs }} brotli cmake git go gtest libunwind \
lz4 pcre2 pkgconfig protobuf zstd ninja
- name: prep ubuntu
if: startsWith(matrix.os, 'ubuntu')
run: |
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -yq \
${{ matrix.pkgs }} cmake git golang libbrotli-dev \
libgtest-dev liblz4-dev libpcre2-dev libprotobuf-dev libunwind-dev \
libzstd-dev pkg-config protobuf-compiler ninja-build
- name: prep alpine
if: startsWith(matrix.os, 'alpine')
run: |
apk add build-base pcre2-dev linux-headers gtest-dev samurai \
go git perl cmake protobuf-dev brotli-dev zstd-dev lz4-dev
- name: prep fedora
if: startsWith(matrix.os, 'fedora')
run: |
dnf install -y ${{ matrix.pkgs }} cmake ninja-build perl git golang \
brotli-devel gtest-devel lz4-devel pcre2-devel protobuf-devel \
libzstd-devel tar xz
- name: download source
uses: actions/download-artifact@v4
with:
name: package_source
- name: build & install
run: |
export GOFLAGS="-mod=vendor"
tar -xf android-tools-*.tar.xz
cd android-tools-*/
test -n "${{ matrix.env1 }}" && export ${{ matrix.env1 }}
test -n "${{ matrix.env2 }}" && export ${{ matrix.env2 }}
mkdir build && cd build
cmake \
-DCMAKE_C_FLAGS="$CFLAGS" \
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
-DCMAKE_BUILD_TYPE=Release \
-DANDROID_TOOLS_USE_BUNDLED_FMT=ON \
-DANDROID_TOOLS_USE_BUNDLED_LIBUSB=ON \
-GNinja \
..
ninja --verbose
echo -e "\n### make install ###\n"
cmake --install . --prefix /usr/local
echo -e "\n### all done ###\n"
- name: check
run: |
/usr/local/bin/adb --version
/usr/local/bin/fastboot --version
/usr/local/bin/make_f2fs -V
/usr/local/bin/sload_f2fs -V
macos:
strategy:
fail-fast: false
matrix:
os: [macos-12, macos-13, macos-14]
runs-on: ${{ matrix.os }}
needs: [upload-src]
steps:
# github actions overwrites brew's python. Force it to reassert itself, by running in a separate step.
# Borrowed from https://github.com/mesonbuild/meson/blob/master/.github/workflows/macos.yml#L87-L92
- name: unbreak python in github actions
run: |
find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete
sudo rm -rf /Library/Frameworks/Python.framework/
brew install --force python3 && brew unlink python3 && brew unlink python3 && brew link --overwrite python3
- name: prep macos
run: |
rm -rf /opt/homebrew/include/openssl /usr/local/opt/openssl /usr/local/include/openssl
brew install --overwrite --quiet brotli cmake go googletest lz4 \
ninja pcre2 protobuf zstd
- name: download source
uses: actions/download-artifact@v4
with:
name: package_source
- name: build & install
run: |
tar -xf android-tools-*.tar.xz
cd android-tools-*/
mkdir build && cd build
cmake \
-DCMAKE_C_FLAGS="$CFLAGS" \
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$HOME/android-tools \
-DANDROID_TOOLS_USE_BUNDLED_FMT=ON \
-DANDROID_TOOLS_USE_BUNDLED_LIBUSB=ON \
-GNinja \
..
ninja --verbose
echo -e "\n### make install ###\n"
cmake --install .
echo -e "\n### all done ###\n"
- name: check
run: |
$HOME/android-tools/bin/adb --version
$HOME/android-tools/bin/fastboot --version
$HOME/android-tools/bin/make_f2fs -V
$HOME/android-tools/bin/sload_f2fs -V