Skip to content

Commit 8cc5db6

Browse files
authored
Merge pull request #337 from opendocument-app/fix-ci-conan-core
Fix CI build with core
2 parents b192766 + 9891604 commit 8cc5db6

8 files changed

Lines changed: 101 additions & 42 deletions

File tree

.github/workflows/android_main.yml

Lines changed: 54 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,23 @@ name: OpenDocument-Reader-Android
22

33
on:
44
workflow_dispatch:
5-
pull_request:
5+
push:
66
paths-ignore:
77
- '**.md'
8-
push:
8+
- '.github/**'
9+
- '!.github/workflows/android_main.yml'
10+
branches:
11+
- main
12+
pull_request:
913
paths-ignore:
1014
- '**.md'
1115
- '.github/**'
1216
- '!.github/workflows/android_main.yml'
1317

18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
20+
cancel-in-progress: true
21+
1422
jobs:
1523
build:
1624
runs-on: ubuntu-20.04
@@ -19,49 +27,59 @@ jobs:
1927
- name: checkout
2028
uses: actions/checkout@v3
2129

22-
- name: ninja
30+
- name: install ninja
2331
run: sudo apt-get install -y ninja-build
24-
- name: java
32+
- name: setup java
2533
uses: actions/setup-java@v3
2634
with:
2735
distribution: 'zulu'
28-
java-version: 11
36+
java-version: 17
2937

30-
- name: set up python 3.8
38+
- name: setup python 3.8
3139
uses: actions/setup-python@v4
3240
with:
3341
python-version: 3.8
3442

3543
- name: install pip and conan
36-
run: python -m pip install --upgrade pip conan
37-
- name: conan revisions
44+
run: python -m pip install --upgrade pip conan==1.*
45+
46+
- name: conan config
3847
run: conan config set general.revisions_enabled=1
3948
- name: conan repo
40-
run: conan remote add odr https://odr.jfrog.io/artifactory/api/conan/odr-conan
49+
run: conan remote add odr https://artifactory.opendocument.app/artifactory/api/conan/conan
50+
51+
- name: tweak conan profile for build machine
52+
run: |
53+
echo "" >> conanprofile_build.txt
54+
echo "[settings]" >> conanprofile_build.txt
55+
echo "compiler=clang" >> conanprofile_build.txt
56+
echo "compiler.libcxx=libstdc++11" >> conanprofile_build.txt
57+
echo "" >> conanprofile_build.txt
4158
42-
- run: ./gradlew assembleDebug lintProDebug lintLiteDebug --stacktrace
59+
- name: gradle
60+
run: ./gradlew assembleDebug lintProDebug lintLiteDebug --stacktrace
4361

44-
- uses: actions/upload-artifact@v3
62+
- name: upload apks
63+
uses: actions/upload-artifact@v3
4564
with:
4665
name: APKs
4766
path: app/build/outputs/apk/**/*.apk
4867
if-no-files-found: error
4968

50-
- uses: actions/upload-artifact@v3
69+
- name: upload lint results
70+
uses: actions/upload-artifact@v3
5171
with:
5272
name: lint-report
5373
path: app/build/reports/lint-results-*.html
5474
if-no-files-found: error
75+
5576
test:
5677
runs-on: macos-11
5778
strategy:
5879
fail-fast: false
5980
# Make sure the matrix here and in cache_AVD_images.yml is the same
6081
matrix:
6182
include:
62-
# Oldest version we support
63-
- arch: x86
64-
api-level: 19
6583
# Oldest x86_64
6684
- arch: x86_64
6785
api-level: 21
@@ -81,28 +99,37 @@ jobs:
8199
uses: actions/setup-java@v3
82100
with:
83101
distribution: 'zulu'
84-
java-version: 11
102+
java-version: 17
85103

86-
- name: brew
104+
- name: install brew
87105
run: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
88106
- name: fix ninja install
89107
run: rm '/usr/local/bin/2to3'
90-
- name: ninja
108+
- name: install ninja
91109
run: brew install ninja
92110
# https://stackoverflow.com/a/57758679/198996
93-
- name: bundler
111+
- name: install bundler
94112
run: gem install bundler:1.17.3
95-
- name: fastlane
113+
- name: install fastlane
96114
run: bundle install
97115

98-
- name: pip
116+
- name: install pip
99117
run: python3 -m ensurepip
100-
- name: conan
101-
run: pip3 install conan
102-
- name: conan revisions
118+
- name: install conan
119+
run: pip3 install --upgrade conan==1.*
120+
121+
- name: conan config
103122
run: conan config set general.revisions_enabled=1
104123
- name: conan repo
105-
run: conan remote add odr https://odr.jfrog.io/artifactory/api/conan/odr-conan
124+
run: conan remote add odr https://artifactory.opendocument.app/artifactory/api/conan/conan
125+
126+
- name: tweak conan profile for build machine
127+
run: |
128+
echo "" >> conanprofile_build.txt
129+
echo "[settings]" >> conanprofile_build.txt
130+
echo "compiler=clang" >> conanprofile_build.txt
131+
echo "compiler.libcxx=libc++" >> conanprofile_build.txt
132+
echo "" >> conanprofile_build.txt
106133
107134
- name: Android Virtual Device (AVD) cache
108135
uses: actions/cache@v3
@@ -152,7 +179,8 @@ jobs:
152179
153180
test ! -f sorry_but_tests_are_failing
154181
155-
- uses: actions/upload-artifact@v3
182+
- name: upload test results
183+
uses: actions/upload-artifact@v3
156184
if: always()
157185
with:
158186
name: testResults-${{ matrix.api-level }}-${{ matrix.arch }}

CMakeLists.txt

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ set(CMAKE_CXX_STANDARD 17)
55
set(CMAKE_CXX_STANDARD_REQUIRED ON)
66
set(CMAKE_CXX_EXTENSIONS OFF)
77

8-
# make sure "which conan" points to a version of 1.x
8+
# create virtual environment in project root and "pip install conan==1.*"
9+
set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_LIST_DIR}/bin")
10+
# or make sure "which conan" points to a version of 1.x
11+
912
# TODO: call FIND_PROGRAM(conan) here manually so the location is cached for later
1013
# TODO: use proper virtual environment
1114

@@ -23,14 +26,17 @@ string(REPLACE "armeabi-v7a" "armv7" ARCH "${ARCH}")
2326
string(REPLACE "arm64-v8a" "armv8" ARCH "${ARCH}")
2427

2528
include(${CMAKE_CURRENT_LIST_DIR}/app/conan.cmake)
26-
conan_cmake_autodetect(settings ARCH ${ARCH})
29+
conan_cmake_autodetect(settings_host ARCH ${ARCH})
2730
# inspired from here https://docs.conan.io/en/latest/integrations/cross_platform/android.html
2831
configure_file(app/toolchain.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/toolchain.cmake @ONLY)
2932
conan_cmake_install(PATH_OR_REFERENCE ${CMAKE_CURRENT_LIST_DIR}
3033
BUILD missing
31-
SETTINGS ${settings}
32-
PROFILE ${CMAKE_CURRENT_LIST_DIR}/conanprofile.txt
33-
ENV CONAN_CMAKE_TOOLCHAIN_FILE=${CMAKE_CURRENT_BINARY_DIR}/toolchain.cmake)
34+
SETTINGS_HOST ${settings_host} compiler.libcxx=c++_shared
35+
PROFILE_BUILD ${CMAKE_CURRENT_LIST_DIR}/conanprofile_build.txt
36+
PROFILE_HOST ${CMAKE_CURRENT_LIST_DIR}/conanprofile_host.txt
37+
ENV_HOST
38+
CONAN_CMAKE_TOOLCHAIN_FILE=${CMAKE_CURRENT_BINARY_DIR}/toolchain.cmake
39+
ANDROID_NDK_ROOT=${CMAKE_ANDROID_NDK})
3440
include(${CMAKE_CURRENT_BINARY_DIR}/conan_paths.cmake)
3541

3642
find_package(odr REQUIRED)

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ Feel free to use it in your own project too, but please don't forget to tell us
1111
height="80">](https://play.google.com/store/apps/details?id=at.tomtasche.reader)
1212

1313
More information at http://reader.tomtasche.at/ and in the app itself.
14+
15+
## Setup
16+
17+
- `conan remote add odr https://artifactory.opendocument.app/artifactory/api/conan/conan`

app/src/main/cpp/CoreWrapper.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
#include "CoreWrapper.h"
2-
#include <string>
3-
#include <optional>
2+
43
#include <odr/document.hpp>
5-
#include <odr/document_cursor.hpp>
6-
#include <odr/document_element.hpp>
74
#include <odr/file.hpp>
85
#include <odr/html.hpp>
96
#include <odr/open_document_reader.hpp>
107
#include <odr/exceptions.hpp>
8+
119
#include <android/log.h>
1210

11+
#include <string>
12+
#include <optional>
13+
1314
std::optional<odr::Html> html;
1415

1516
JNIEXPORT jobject JNICALL

conanfile.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ odrcore/3.0.0@
55
cmake
66
cmake_paths
77
cmake_find_package
8-

conanprofile.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

conanprofile_build.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
include(default)
2+
3+
[settings]
4+
build_type=Release
5+
6+
[env]
7+
CONAN_RUN_TESTS=False
8+
CONAN_CMAKE_GENERATOR=Ninja
9+
10+
[conf]
11+
tools.build:skip_test=True

conanprofile_host.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
include(default)
2+
3+
[settings]
4+
os=Android
5+
os.api_level=19
6+
compiler=clang
7+
compiler.libcxx=c++_shared
8+
build_type=Release
9+
10+
[env]
11+
CONAN_RUN_TESTS=False
12+
CONAN_CMAKE_GENERATOR=Ninja
13+
14+
[conf]
15+
tools.android:ndk_path=$ENV{ANDROID_NDK_ROOT}
16+
tools.build:skip_test=True

0 commit comments

Comments
 (0)