Skip to content

fix build

fix build #2080

Workflow file for this run

name: build_test
on: push
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
CCACHE_DIR: ${{ github.workspace }}/ccache
CCACHE_MAXSIZE: 500M
CCACHE_KEY_SUFFIX: r22
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-24.04, build_profile: ubuntu-24.04-clang-18, host_profile: ubuntu-24.04-clang-18 }
- { os: ubuntu-24.04, build_profile: ubuntu-24.04-gcc-14, host_profile: ubuntu-24.04-gcc-14 }
- { os: macos-15, build_profile: macos-15-armv8-clang-14, host_profile: macos-15-armv8-clang-14 }
- { os: macos-26, build_profile: macos-26-armv8-clang-14, host_profile: macos-26-armv8-clang-14 }
- { os: windows-2022, build_profile: windows-2022-msvc-1940, host_profile: windows-2022-msvc-1940 }
- { os: ubuntu-24.04, build_profile: ubuntu-24.04-clang-18, host_profile: android-35-x86_64, ndk_version: 28.1.13356709 }
steps:
- name: checkout
uses: actions/checkout@v4
- name: ubuntu install ccache
if: runner.os == 'Linux'
run: |
sudo apt install ccache
ccache -V
- name: macos install ccache
if: runner.os == 'macOS'
run: |
brew install ccache
ccache -V
- name: setup python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: install python dependencies
run: pip install conan
- name: install NDK
if: startsWith(matrix.host_profile, 'android')
run: yes | ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install 'ndk;${{ matrix.ndk_version }}'
- name: conan remote
run: |
conan remote remove "*"
conan remote add conancenter https://center2.conan.io
conan remote add odr https://artifactory.opendocument.app/artifactory/api/conan/conan
- name: conan config
run: conan config install .github/config/conan
- name: conan install
run: >
conan install .
--lockfile conan.lock
--profile:host '${{ matrix.host_profile }}'
--profile:build '${{ matrix.build_profile }}'
--build=missing
- name: cache
uses: actions/cache@v4
with:
path: |
~/.ccache
/Users/runner/Library/Caches/ccache
key: ${{ matrix.host_profile }}-${{ env.CCACHE_KEY_SUFFIX }}
restore-keys: |
${{ matrix.host_profile }}-
- name: cmake
if: runner.os != 'Windows'
run: >
cmake -B build -S .
-DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake"
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_CXX_FLAGS="-Werror"
-DCMAKE_INSTALL_PREFIX=install
-DODR_TEST=ON
-DWITH_PDF2HTMLEX=ON
-DWITH_WVWARE=ON
- name: cmake
if: runner.os == 'Windows'
run: >
cmake -B build -S .
-DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake"
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=install
-DODR_TEST=ON
-DWITH_PDF2HTMLEX=OFF
-DWITH_WVWARE=OFF
- name: build
run: cmake --build build --config Release
- name: install
run: cmake --build build --target install --config Release
- name: upload binaries to github
uses: actions/upload-artifact@v4
with:
name: bin-${{ matrix.host_profile }}
path: |
install
build/test/odr_test
build/test/Release/odr_test.exe
build/_deps/odr.js-src
- name: Artifact .conan2/p dir
uses: actions/upload-artifact@v4
with:
name: conan2-${{ matrix.host_profile }}
path: ~/.conan2/p
if-no-files-found: error
compression-level: 0
docker:
needs: build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-24.04, host_profile: ubuntu-24.04-clang-18 }
steps:
- name: checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/${{ github.repository_owner }}/odr_core_cli
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable={{is_default_branch}}
type=sha
- name: download binaries
uses: actions/download-artifact@v4
with:
name: bin-${{ matrix.host_profile }}
path: cli
- name: Build and push
uses: docker/build-push-action@v5
with:
context: cli
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/odr_core_cli:buildcache
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/odr_core_cli:buildcache,mode=max
# TODO try to run it
test:
needs: build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# fails at the moment because of pdf2htmlex
#- { os: ubuntu-24.04, host_profile: ubuntu-24.04-clang-18 }
#- { os: ubuntu-24.04, host_profile: ubuntu-24.04-gcc-14 }
- { os: macos-26, host_profile: macos-26-armv8-clang-14 }
# Windows test disabled because:
# Running main() from C:\Users\runneradmin\.conan2\p\b\gtestdd9407d368b89\b\src\googletest\src\gtest_main.cc
# [ 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
#- { os: windows-2022, host_profile: windows-2022-msvc-1940 }
steps:
- name: checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT_ANDIWAND }}
submodules: true
- name: ubuntu install tidy
if: runner.os == 'Linux'
run: sudo apt install tidy
- name: macos install tidy
if: runner.os == 'macOS'
run: brew install tidy-html5
- name: set up python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: install python dependencies
run: pip install htmlcmp==1.0.12
- name: download binaries
uses: actions/download-artifact@v4
with:
name: bin-${{ matrix.host_profile }}
path: .
- name: Download .conan2/p dir
uses: actions/download-artifact@v4
with:
name: conan2-${{ matrix.host_profile }}
path: ~/.conan2/p
- name: fix artifact permissions
if: runner.os != 'Windows'
run: chmod +x build/test/odr_test
- name: test
if: runner.os != 'Windows'
working-directory: build/test
run: ./odr_test
- name: windows fix artifact permissions
if: runner.os == 'Windows'
run: chmod +x build/test/Release/odr_test.exe
- name: windows test
if: runner.os == 'Windows'
working-directory: build/test
run: ./Release/odr_test.exe
- name: tidy public test outputs
run: html-tidy --html-tidy-config test/scripts/html-tidy-config build/test/output/odr-public/output
- name: compare public test outputs
shell: bash
run: |
compare-html \
--driver firefox \
--max-workers 1 \
test/data/reference-output/odr-public/output \
build/test/output/odr-public/output
- name: tidy private test outputs
run: html-tidy --html-tidy-config test/scripts/html-tidy-config build/test/output/odr-private/output
- name: compare private test outputs
shell: bash
run: |
compare-html \
--driver firefox \
--max-workers 1 \
test/data/reference-output/odr-private/output \
build/test/output/odr-private/output
build-test-downstream:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-24.04, build_profile: ubuntu-24.04-clang-18, host_profile: ubuntu-24.04-clang-18 }
- { os: ubuntu-24.04, build_profile: ubuntu-24.04-gcc-14, host_profile: ubuntu-24.04-gcc-14 }
- { os: macos-15, build_profile: macos-15-armv8-clang-14, host_profile: macos-15-armv8-clang-14 }
- { os: macos-26, build_profile: macos-26-armv8-clang-14, host_profile: macos-26-armv8-clang-14 }
- { os: windows-2022, build_profile: windows-2022-msvc-1940, host_profile: windows-2022-msvc-1940 }
- { os: ubuntu-24.04, build_profile: ubuntu-24.04-clang-18, host_profile: android-35-x86_64, ndk_version: 28.1.13356709 }
steps:
- name: checkout
uses: actions/checkout@v4
- name: ubuntu install ccache
if: runner.os == 'Linux'
run: |
sudo apt install ccache
ccache -V
- name: macos install ccache
if: runner.os == 'macOS'
run: |
brew install ccache
ccache -V
- name: set up python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: install python dependencies
run: pip install conan
- name: install NDK
if: startsWith(matrix.host_profile, 'android')
run: yes | ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install 'ndk;${{ matrix.ndk_version }}'
- name: conan remote
run: conan remote add odr https://artifactory.opendocument.app/artifactory/api/conan/conan
- name: conan config
run: conan config install .github/config/conan
- name: conan odrcore
run: conan export . --name odrcore --version 0.0.0
- name: conan install
run: >
conan install .
--lockfile conan.lock
--profile:host '${{ matrix.host_profile }}'
--profile:build '${{ matrix.build_profile }}'
--output-folder=build
--build=missing
- name: conan downstream
run: >
conan install test/downstream
--profile:host '${{ matrix.host_profile }}'
--profile:build '${{ matrix.build_profile }}'
--output-folder=test/downstream/build
--build=missing
- name: cmake
run: >
cmake -S test/downstream -B test/downstream/build
-DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake"
-DCMAKE_BUILD_TYPE=Release
- name: build
run: cmake --build test/downstream/build --config Release
- name: run
if: matrix.build_profile == matrix.host_profile && (runner.os == 'Linux' || runner.os == 'macOS')
run: test/downstream/build/odr-test-downstream
- name: run
if: matrix.build_profile == matrix.host_profile && runner.os == 'Windows'
run: test/downstream/build/Release/odr-test-downstream.exe