Skip to content

Commit c30ba74

Browse files
authored
build android in ci (#444)
1 parent c55d641 commit c30ba74

8 files changed

Lines changed: 98 additions & 34 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{% set android_home = os.getenv("ANDROID_HOME") %}
2+
{% set ndk_version = "28.1.13356709" %}
3+
{% set api_level = "35" %}
4+
{% set arch = "x86_64" %}
5+
{% set cc = {
6+
"armv7": "armv7a-linux-androideabi" + api_level + "-clang",
7+
"armv8": "aarch64-linux-android" + api_level + "-clang",
8+
"x86": "i686-linux-android" + api_level + "-clang",
9+
"x86_64": "x86_64-linux-android" + api_level + "-clang",
10+
}[arch] %}
11+
12+
[settings]
13+
os=Android
14+
os.api_level={{api_level}}
15+
arch={{arch}}
16+
build_type=Release
17+
compiler=clang
18+
compiler.version=17
19+
compiler.cppstd=20
20+
compiler.libcxx=c++_shared
21+
22+
[conf]
23+
tools.android:ndk_path={{android_home}}/ndk/{{ndk_version}}
24+
25+
[buildenv]
26+
# Cross compile toolchain evn vars are required to build
27+
# libffi, libgettext, libiconv, libxml2 and other autotools packages for Android
28+
# https://github.com/conan-io/conan/issues/16493
29+
AR={{android_home}}/ndk/{{ndk_version}}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar
30+
AS={{android_home}}/ndk/{{ndk_version}}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-as
31+
RANLIB={{android_home}}/ndk/{{ndk_version}}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ranlib
32+
CC={{android_home}}/ndk/{{ndk_version}}/toolchains/llvm/prebuilt/linux-x86_64/bin/{{cc}}
33+
CXX={{android_home}}/ndk/{{ndk_version}}/toolchains/llvm/prebuilt/linux-x86_64/bin/{{cc}}++
34+
LD={{android_home}}/ndk/{{ndk_version}}/toolchains/llvm/prebuilt/linux-x86_64/bin/ld
35+
STRIP={{android_home}}/ndk/{{ndk_version}}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip
File renamed without changes.

.github/config/macos-14-armv8-clang-14/conan/profiles/default renamed to .github/config/conan/profiles/macos-14-armv8-clang-14

File renamed without changes.

.github/config/ubuntu-24.04-clang-18/conan/profiles/default renamed to .github/config/conan/profiles/ubuntu-24.04-clang-18

File renamed without changes.

.github/config/ubuntu-24.04-gcc-14/conan/profiles/default renamed to .github/config/conan/profiles/ubuntu-24.04-gcc-14

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ compiler.libcxx=libstdc++11
88
os=Linux
99

1010
[conf]
11-
tools.build:compiler_executables={'c': 'gcc-14', 'cpp': 'g++-14'}
11+
tools.build:compiler_executables={'c': 'gcc-14', 'cpp': 'g++-14'}

.github/config/windows-2022-msvc-1940/conan/profiles/default renamed to .github/config/conan/profiles/windows-2022-msvc-1940

File renamed without changes.

.github/workflows/build_test.yml

Lines changed: 55 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
include:
21-
- { os: ubuntu-24.04, compiler: clang-18 }
22-
- { os: ubuntu-24.04, compiler: gcc-14 }
23-
- { os: macos-13, compiler: clang-14 }
24-
- { os: macos-14, compiler: armv8-clang-14 }
25-
- { os: windows-2022, compiler: msvc-1940 }
21+
- { os: ubuntu-24.04, build_profile: ubuntu-24.04-clang-18, host_profile: ubuntu-24.04-clang-18 }
22+
- { os: ubuntu-24.04, build_profile: ubuntu-24.04-gcc-14, host_profile: ubuntu-24.04-gcc-14 }
23+
- { os: macos-13, build_profile: macos-13-clang-14, host_profile: macos-13-clang-14 }
24+
- { os: macos-14, build_profile: macos-14-armv8-clang-14, host_profile: macos-14-armv8-clang-14 }
25+
- { os: windows-2022, build_profile: windows-2022-msvc-1940, host_profile: windows-2022-msvc-1940 }
26+
- { os: ubuntu-24.04, build_profile: ubuntu-24.04-clang-18, host_profile: android-35-x86_64, ndk_version: 28.1.13356709 }
2627
steps:
2728
- name: checkout
2829
uses: actions/checkout@v4
@@ -45,25 +46,33 @@ jobs:
4546
- name: install python dependencies
4647
run: pip install conan
4748

49+
- name: install NDK
50+
if: startsWith(matrix.host_profile, 'android')
51+
run: yes | ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install 'ndk;${{ matrix.ndk_version }}'
52+
4853
- name: conan remote
4954
run: |
5055
conan remote remove "*"
5156
conan remote add odr https://artifactory.opendocument.app/artifactory/api/conan/conan
5257
conan remote add conancenter https://center2.conan.io
5358
- name: conan config
54-
run: conan config install .github/config/${{ matrix.os }}-${{ matrix.compiler }}/conan
59+
run: conan config install .github/config/conan
5560
- name: conan install
56-
run: conan install . --output-folder=build --build=missing
61+
run: >
62+
conan install .
63+
--lockfile conan.lock
64+
--profile:host '${{ matrix.host_profile }}'
65+
--profile:build '${{ matrix.build_profile }}'
5766
5867
- name: cache
5968
uses: actions/cache@v4
6069
with:
6170
path: |
6271
~/.ccache
6372
/Users/runner/Library/Caches/ccache
64-
key: ${{ matrix.os }}-${{ matrix.compiler }}-${{ env.CCACHE_KEY_SUFFIX }}
73+
key: ${{ matrix.host_profile }}-${{ env.CCACHE_KEY_SUFFIX }}
6574
restore-keys: |
66-
${{ matrix.os }}-${{ matrix.compiler }}-
75+
${{ matrix.host_profile }}-
6776
6877
- name: cmake
6978
if: runner.os != 'Windows'
@@ -99,7 +108,7 @@ jobs:
99108
- name: upload binaries to github
100109
uses: actions/upload-artifact@v4
101110
with:
102-
name: bin-${{ matrix.os }}-${{ matrix.compiler }}
111+
name: bin-${{ matrix.host_profile }}
103112
path: |
104113
install
105114
build/test/odr_test
@@ -109,7 +118,7 @@ jobs:
109118
- name: Artifact .conan2/p dir
110119
uses: actions/upload-artifact@v4
111120
with:
112-
name: conan2-${{ matrix.os }}-${{ matrix.compiler }}
121+
name: conan2-${{ matrix.host_profile }}
113122
path: ~/.conan2/p
114123
if-no-files-found: error
115124
compression-level: 0
@@ -121,7 +130,7 @@ jobs:
121130
fail-fast: false
122131
matrix:
123132
include:
124-
- { os: ubuntu-24.04, compiler: clang-18 }
133+
- { os: ubuntu-24.04, host_profile: ubuntu-24.04-clang-18 }
125134
steps:
126135
- name: checkout
127136
uses: actions/checkout@v4
@@ -156,7 +165,7 @@ jobs:
156165
- name: download binaries
157166
uses: actions/download-artifact@v4
158167
with:
159-
name: bin-${{ matrix.os }}-${{ matrix.compiler }}
168+
name: bin-${{ matrix.host_profile }}
160169
path: cli
161170

162171
- name: Build and push
@@ -179,14 +188,14 @@ jobs:
179188
matrix:
180189
include:
181190
# fails at the moment because of pdf2htmlex
182-
#- { os: ubuntu-24.04, compiler: clang-18 }
183-
#- { os: ubuntu-24.04, compiler: gcc-14 }
184-
#- { os: macos-13, compiler: clang-14 }
185-
- { os: macos-14, compiler: armv8-clang-14 }
191+
#- { os: ubuntu-24.04, host_profile: ubuntu-24.04-clang-18 }
192+
#- { os: ubuntu-24.04, host_profile: ubuntu-24.04-gcc-14 }
193+
#- { os: macos-13, host_profile: macos-13-clang-14 }
194+
- { os: macos-14, host_profile: macos-14-armv8-clang-14 }
186195
# Windows test disabled because:
187196
# Running main() from C:\Users\runneradmin\.conan2\p\b\gtestdd9407d368b89\b\src\googletest\src\gtest_main.cc
188197
# [ FATAL ] C:/Users/runneradmin/.conan2/p/gtest28fa6787e7f6e/p/include\gtest/internal/gtest-param-util.h(585):: Condition IsValidParamName(param_name) failed. Parameterized test name 'odr_private\docx\03_smpldap_docx' is invalid, in D:\a\OpenDocument.core\OpenDocument.core\test\src\html_output_test.cpp line 129
189-
# - { os: windows-2022, compiler: msvc-1940 }
198+
#- { os: windows-2022, host_profile: windows-2022-msvc-1940 }
190199
steps:
191200
- name: checkout
192201
uses: actions/checkout@v4
@@ -211,13 +220,13 @@ jobs:
211220
- name: download binaries
212221
uses: actions/download-artifact@v4
213222
with:
214-
name: bin-${{ matrix.os }}-${{ matrix.compiler }}
223+
name: bin-${{ matrix.host_profile }}
215224
path: .
216225

217226
- name: Download .conan2/p dir
218227
uses: actions/download-artifact@v4
219228
with:
220-
name: conan2-${{ matrix.os }}-${{ matrix.compiler }}
229+
name: conan2-${{ matrix.host_profile }}
221230
path: ~/.conan2/p
222231

223232
- name: fix artifact permissions
@@ -264,11 +273,12 @@ jobs:
264273
fail-fast: false
265274
matrix:
266275
include:
267-
- { os: ubuntu-24.04, compiler: clang-18 }
268-
- { os: ubuntu-24.04, compiler: gcc-14 }
269-
- { os: macos-13, compiler: clang-14 }
270-
- { os: macos-14, compiler: armv8-clang-14 }
271-
- { os: windows-2022, compiler: msvc-1940 }
276+
- { os: ubuntu-24.04, build_profile: ubuntu-24.04-clang-18, host_profile: ubuntu-24.04-clang-18 }
277+
- { os: ubuntu-24.04, build_profile: ubuntu-24.04-gcc-14, host_profile: ubuntu-24.04-gcc-14 }
278+
- { os: macos-13, build_profile: macos-13-clang-14, host_profile: macos-13-clang-14 }
279+
- { os: macos-14, build_profile: macos-14-armv8-clang-14, host_profile: macos-14-armv8-clang-14 }
280+
- { os: windows-2022, build_profile: windows-2022-msvc-1940, host_profile: windows-2022-msvc-1940 }
281+
- { os: ubuntu-24.04, build_profile: ubuntu-24.04-clang-18, host_profile: android-35-x86_64, ndk_version: 28.1.13356709 }
272282
steps:
273283
- name: checkout
274284
uses: actions/checkout@v4
@@ -291,19 +301,34 @@ jobs:
291301
- name: install python dependencies
292302
run: pip install conan
293303

304+
- name: install NDK
305+
if: startsWith(matrix.host_profile, 'android')
306+
run: yes | ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install 'ndk;${{ matrix.ndk_version }}'
307+
294308
- name: conan remote
295309
run: conan remote add odr https://artifactory.opendocument.app/artifactory/api/conan/conan
296310
- name: conan config
297-
run: conan config install .github/config/${{ matrix.os }}-${{ matrix.compiler }}/conan
311+
run: conan config install .github/config/conan
298312

299313
- name: conan odrcore
300314
run: conan export . --name odrcore --version 0.0.0
301315

302316
- name: conan install
303-
run: conan install . --output-folder=build --build=missing
317+
run: >
318+
conan install .
319+
--lockfile conan.lock
320+
--profile:host '${{ matrix.host_profile }}'
321+
--profile:build '${{ matrix.build_profile }}'
322+
--output-folder=build
323+
--build=missing
304324
305325
- name: conan downstream
306-
run: conan install test/downstream --output-folder=test/downstream/build --build=missing
326+
run: >
327+
conan install test/downstream
328+
--profile:host '${{ matrix.host_profile }}'
329+
--profile:build '${{ matrix.build_profile }}'
330+
--output-folder=test/downstream/build
331+
--build=missing
307332
308333
- name: cmake
309334
run: >
@@ -315,8 +340,8 @@ jobs:
315340
run: cmake --build test/downstream/build --config Release
316341

317342
- name: run
318-
if: runner.os != 'Windows'
343+
if: matrix.build_profile == matrix.host_profile && (runner.os == 'Linux' || runner.os == 'macOS')
319344
run: test/downstream/build/odr-test-downstream
320345
- name: run
321-
if: runner.os == 'Windows'
346+
if: matrix.build_profile == matrix.host_profile && runner.os == 'Windows'
322347
run: test/downstream/build/Release/odr-test-downstream.exe

.github/workflows/tidy.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
include:
16-
- { os: ubuntu-24.04, compiler: clang-18 }
16+
- { os: ubuntu-24.04, build_profile: ubuntu-24.04-clang-18, host_profile: ubuntu-24.04-clang-18 }
1717
steps:
1818
- name: checkout
1919
uses: actions/checkout@v4
@@ -30,9 +30,13 @@ jobs:
3030
- name: conan remote
3131
run: conan remote add odr https://artifactory.opendocument.app/artifactory/api/conan/conan
3232
- name: conan config
33-
run: conan config install .github/config/${{ matrix.os }}-${{ matrix.compiler }}/conan
33+
run: conan config install .github/config/conan
3434
- name: conan install
35-
run: conan install . --output-folder=build --build=missing
35+
run: >
36+
conan install .
37+
--lockfile conan.lock
38+
--profile:host '${{ matrix.host_profile }}'
39+
--profile:build '${{ matrix.build_profile }}'
3640
3741
- name: cmake
3842
run: >

0 commit comments

Comments
 (0)