Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CI build with core #337

Merged
merged 35 commits into from
Apr 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
91412c4
fix ci build with core
andiwand Apr 20, 2024
a1771a1
fix checkout; rm afterwards
andiwand Apr 20, 2024
4b3511c
bump java version
andiwand Apr 20, 2024
da64946
fix build and test
andiwand Apr 20, 2024
0589a30
fixfix
andiwand Apr 20, 2024
4b35a3a
fix build
andiwand Apr 20, 2024
1217a6a
fix build?
andiwand Apr 20, 2024
e7ecd2c
runs locally
andiwand Apr 21, 2024
26ca5c6
fix linux build?
andiwand Apr 21, 2024
adb6c58
fix build; try disable package test build
andiwand Apr 21, 2024
62f7730
try disable package test build
andiwand Apr 21, 2024
87be0dd
use core version 4
andiwand Apr 21, 2024
508adf3
revert to v3
andiwand Apr 21, 2024
65e0a74
fix CoreWrapper
andiwand Apr 21, 2024
5f6eb3c
try force build machine libcxx
andiwand Apr 21, 2024
3b86a1c
try again
andiwand Apr 21, 2024
74f7d3f
try again
andiwand Apr 21, 2024
cf7ec09
try again
andiwand Apr 21, 2024
0956504
try again
andiwand Apr 21, 2024
87fb654
try again
andiwand Apr 21, 2024
74b3b1a
try again
andiwand Apr 21, 2024
56fa0b3
try again
andiwand Apr 21, 2024
2a00300
build missing
andiwand Apr 21, 2024
a181720
try again
andiwand Apr 21, 2024
a223ce6
try again
andiwand Apr 21, 2024
b070abe
try again
andiwand Apr 21, 2024
1bbea67
try again
andiwand Apr 21, 2024
f920cc4
try again
andiwand Apr 21, 2024
f183eda
try again
andiwand Apr 21, 2024
2b5542a
try again
andiwand Apr 21, 2024
e7ebeda
drop 19
andiwand Apr 21, 2024
77a191d
improve conan setup documentation
TomTasche Apr 26, 2024
3795a27
Merge branch 'master' into fix-ci-conan-core
andiwand Apr 27, 2024
deddc05
use new shiny artifactory instance
andiwand Apr 27, 2024
9891604
Merge branch 'fix-ci-conan-core' of github.com:opendocument-app/OpenD…
andiwand Apr 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 54 additions & 26 deletions .github/workflows/android_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,23 @@ name: OpenDocument-Reader-Android

on:
workflow_dispatch:
pull_request:
push:
paths-ignore:
- '**.md'
push:
- '.github/**'
- '!.github/workflows/android_main.yml'
branches:
- main
pull_request:
paths-ignore:
- '**.md'
- '.github/**'
- '!.github/workflows/android_main.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-20.04
Expand All @@ -19,49 +27,59 @@ jobs:
- name: checkout
uses: actions/checkout@v3

- name: ninja
- name: install ninja
run: sudo apt-get install -y ninja-build
- name: java
- name: setup java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
java-version: 17

- name: set up python 3.8
- name: setup python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8

- name: install pip and conan
run: python -m pip install --upgrade pip conan
- name: conan revisions
run: python -m pip install --upgrade pip conan==1.*

- name: conan config
run: conan config set general.revisions_enabled=1
- name: conan repo
run: conan remote add odr https://odr.jfrog.io/artifactory/api/conan/odr-conan
run: conan remote add odr https://artifactory.opendocument.app/artifactory/api/conan/conan

- name: tweak conan profile for build machine
run: |
echo "" >> conanprofile_build.txt
echo "[settings]" >> conanprofile_build.txt
echo "compiler=clang" >> conanprofile_build.txt
echo "compiler.libcxx=libstdc++11" >> conanprofile_build.txt
echo "" >> conanprofile_build.txt

- run: ./gradlew assembleDebug lintProDebug lintLiteDebug --stacktrace
- name: gradle
run: ./gradlew assembleDebug lintProDebug lintLiteDebug --stacktrace

- uses: actions/upload-artifact@v3
- name: upload apks
uses: actions/upload-artifact@v3
with:
name: APKs
path: app/build/outputs/apk/**/*.apk
if-no-files-found: error

- uses: actions/upload-artifact@v3
- name: upload lint results
uses: actions/upload-artifact@v3
with:
name: lint-report
path: app/build/reports/lint-results-*.html
if-no-files-found: error

test:
runs-on: macos-11
strategy:
fail-fast: false
# Make sure the matrix here and in cache_AVD_images.yml is the same
matrix:
include:
# Oldest version we support
- arch: x86
api-level: 19
# Oldest x86_64
- arch: x86_64
api-level: 21
Expand All @@ -81,28 +99,37 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
java-version: 17

- name: brew
- name: install brew
run: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
- name: fix ninja install
run: rm '/usr/local/bin/2to3'
- name: ninja
- name: install ninja
run: brew install ninja
# https://stackoverflow.com/a/57758679/198996
- name: bundler
- name: install bundler
run: gem install bundler:1.17.3
- name: fastlane
- name: install fastlane
run: bundle install

- name: pip
- name: install pip
run: python3 -m ensurepip
- name: conan
run: pip3 install conan
- name: conan revisions
- name: install conan
run: pip3 install --upgrade conan==1.*

- name: conan config
run: conan config set general.revisions_enabled=1
- name: conan repo
run: conan remote add odr https://odr.jfrog.io/artifactory/api/conan/odr-conan
run: conan remote add odr https://artifactory.opendocument.app/artifactory/api/conan/conan

- name: tweak conan profile for build machine
run: |
echo "" >> conanprofile_build.txt
echo "[settings]" >> conanprofile_build.txt
echo "compiler=clang" >> conanprofile_build.txt
echo "compiler.libcxx=libc++" >> conanprofile_build.txt
echo "" >> conanprofile_build.txt

- name: Android Virtual Device (AVD) cache
uses: actions/cache@v3
Expand Down Expand Up @@ -152,7 +179,8 @@ jobs:

test ! -f sorry_but_tests_are_failing

- uses: actions/upload-artifact@v3
- name: upload test results
uses: actions/upload-artifact@v3
if: always()
with:
name: testResults-${{ matrix.api-level }}-${{ matrix.arch }}
Expand Down
16 changes: 11 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# make sure "which conan" points to a version of 1.x
# create virtual environment in project root and "pip install conan==1.*"
set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_LIST_DIR}/bin")
# or make sure "which conan" points to a version of 1.x

# TODO: call FIND_PROGRAM(conan) here manually so the location is cached for later
# TODO: use proper virtual environment

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

include(${CMAKE_CURRENT_LIST_DIR}/app/conan.cmake)
conan_cmake_autodetect(settings ARCH ${ARCH})
conan_cmake_autodetect(settings_host ARCH ${ARCH})
# inspired from here https://docs.conan.io/en/latest/integrations/cross_platform/android.html
configure_file(app/toolchain.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/toolchain.cmake @ONLY)
conan_cmake_install(PATH_OR_REFERENCE ${CMAKE_CURRENT_LIST_DIR}
BUILD missing
SETTINGS ${settings}
PROFILE ${CMAKE_CURRENT_LIST_DIR}/conanprofile.txt
ENV CONAN_CMAKE_TOOLCHAIN_FILE=${CMAKE_CURRENT_BINARY_DIR}/toolchain.cmake)
SETTINGS_HOST ${settings_host} compiler.libcxx=c++_shared
PROFILE_BUILD ${CMAKE_CURRENT_LIST_DIR}/conanprofile_build.txt
PROFILE_HOST ${CMAKE_CURRENT_LIST_DIR}/conanprofile_host.txt
ENV_HOST
CONAN_CMAKE_TOOLCHAIN_FILE=${CMAKE_CURRENT_BINARY_DIR}/toolchain.cmake
ANDROID_NDK_ROOT=${CMAKE_ANDROID_NDK})
include(${CMAKE_CURRENT_BINARY_DIR}/conan_paths.cmake)

find_package(odr REQUIRED)
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ Feel free to use it in your own project too, but please don't forget to tell us
height="80">](https://play.google.com/store/apps/details?id=at.tomtasche.reader)

More information at http://reader.tomtasche.at/ and in the app itself.

## Setup

- `conan remote add odr https://artifactory.opendocument.app/artifactory/api/conan/conan`
9 changes: 5 additions & 4 deletions app/src/main/cpp/CoreWrapper.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#include "CoreWrapper.h"
#include <string>
#include <optional>

#include <odr/document.hpp>
#include <odr/document_cursor.hpp>
#include <odr/document_element.hpp>
#include <odr/file.hpp>
#include <odr/html.hpp>
#include <odr/open_document_reader.hpp>
#include <odr/exceptions.hpp>

#include <android/log.h>

#include <string>
#include <optional>

std::optional<odr::Html> html;

JNIEXPORT jobject JNICALL
Expand Down
1 change: 0 additions & 1 deletion conanfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ odrcore/3.0.0@
cmake
cmake_paths
cmake_find_package

6 changes: 0 additions & 6 deletions conanprofile.txt

This file was deleted.

11 changes: 11 additions & 0 deletions conanprofile_build.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
include(default)

[settings]
build_type=Release

[env]
CONAN_RUN_TESTS=False
CONAN_CMAKE_GENERATOR=Ninja

[conf]
tools.build:skip_test=True
16 changes: 16 additions & 0 deletions conanprofile_host.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
include(default)

[settings]
os=Android
os.api_level=19
compiler=clang
compiler.libcxx=c++_shared
build_type=Release

[env]
CONAN_RUN_TESTS=False
CONAN_CMAKE_GENERATOR=Ninja

[conf]
tools.android:ndk_path=$ENV{ANDROID_NDK_ROOT}
tools.build:skip_test=True
Loading