feat: Decoder engines (#387) #1631
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, compiler: clang-18 } | |
- { os: ubuntu-24.04, compiler: gcc-14 } | |
- { os: macos-13, compiler: clang-14 } | |
- { os: macos-14, compiler: armv8-clang-14 } | |
- { os: windows-2022, compiler: msvc-1940 } | |
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: conan remote | |
run: conan remote add odr https://artifactory.opendocument.app/artifactory/api/conan/conan | |
- name: conan config | |
run: conan config install .github/config/${{ matrix.os }}-${{ matrix.compiler }}/conan | |
- name: conan install | |
run: conan install . --output-folder=build --build=never | |
- name: cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.ccache | |
/Users/runner/Library/Caches/ccache | |
key: ${{ matrix.os }}-${{ matrix.compiler }}-${{ env.CCACHE_KEY_SUFFIX }} | |
restore-keys: | | |
${{ matrix.os }}-${{ matrix.compiler }}- | |
- 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.os }}-${{ matrix.compiler }} | |
path: | | |
install | |
build/test/odr_test | |
build/test/Release/odr_test.exe | |
- name: Artifact .conan2/p dir | |
uses: actions/upload-artifact@v4 | |
with: | |
name: conan2-${{ matrix.os }}-${{ matrix.compiler }} | |
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, compiler: 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.os }}-${{ matrix.compiler }} | |
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: | |
- { os: ubuntu-24.04, compiler: clang-18 } | |
- { os: ubuntu-24.04, compiler: gcc-14 } | |
- { os: macos-13, compiler: clang-14 } | |
- { os: macos-14, compiler: 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, compiler: 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 -r test/scripts/requirements.txt | |
- name: download binaries | |
uses: actions/download-artifact@v4 | |
with: | |
name: bin-${{ matrix.os }}-${{ matrix.compiler }} | |
path: . | |
- name: Download .conan2/p dir | |
uses: actions/download-artifact@v4 | |
with: | |
name: conan2-${{ matrix.os }}-${{ matrix.compiler }} | |
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: fix artifact permissions | |
if: runner.os == 'Windows' | |
run: chmod +x build/test/Release/odr_test.exe | |
- name: test | |
if: runner.os == 'Windows' | |
working-directory: build/test | |
run: ./Release/odr_test.exe | |
- name: tidy public test outputs | |
run: python3 -u test/scripts/tidy_output.py build/test/output/odr-public/output | |
- name: compare public test outputs | |
run: | | |
python3 -u test/scripts/compare_output.py \ | |
--driver firefox \ | |
--max-workers 1 \ | |
test/data/reference-output/odr-public/output \ | |
build/test/output/odr-public/output | |
- name: tidy private test outputs | |
run: python3 -u test/scripts/tidy_output.py build/test/output/odr-private/output | |
- name: compare private test outputs | |
run: | | |
python3 -u test/scripts/compare_output.py \ | |
--driver firefox \ | |
--max-workers 1 \ | |
test/data/reference-output/odr-private/output \ | |
build/test/output/odr-private/output | |
- name: tidy pdf2htmlEX test outputs | |
if: runner.os == 'Linux' | |
run: | | |
python3 -u test/scripts/tidy_output.py build/test/output/odr-public/output-pdf2htmlEX | |
python3 -u test/scripts/tidy_output.py build/test/output/odr-private/output-pdf2htmlEX | |
- name: Compare pdf2htmlEX public test results | |
if: runner.os == 'Linux' | |
run: | | |
python3 -u test/scripts/compare_output.py \ | |
--driver firefox \ | |
--max-workers 1 \ | |
test/data/reference-output/odr-public/output-pdf2htmlEX \ | |
build/test/output/odr-public/output-pdf2htmlEX | |
- name: Compare pdf2htmlEX private test results | |
if: runner.os == 'Linux' | |
run: | | |
python3 -u test/scripts/compare_output.py \ | |
--driver firefox \ | |
--max-workers 1 \ | |
test/data/reference-output/odr-public/output-pdf2htmlEX \ | |
build/test/output/odr-public/output-pdf2htmlEX | |
# wvWare has no private test data | |
- name: tidy wvWare test outputs | |
if: runner.os == 'Linux' | |
run: | | |
python3 -u test/scripts/tidy_output.py build/test/output/odr-public/output-wvWare | |
- name: Compare wvWare public test results | |
if: runner.os == 'Linux' | |
run: | | |
python3 -u test/scripts/compare_output.py \ | |
--driver firefox \ | |
--max-workers 1 \ | |
test/data/reference-output/odr-public/output-wvWare \ | |
build/test/output/odr-public/output-wvWare | |
build-test-downstream: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- { os: ubuntu-24.04, compiler: clang-18 } | |
- { os: ubuntu-24.04, compiler: gcc-14 } | |
- { os: macos-13, compiler: clang-14 } | |
- { os: macos-14, compiler: armv8-clang-14 } | |
- { os: windows-2022, compiler: msvc-1940 } | |
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: conan remote | |
run: conan remote add odr https://artifactory.opendocument.app/artifactory/api/conan/conan | |
- name: conan config | |
run: conan config install .github/config/${{ matrix.os }}-${{ matrix.compiler }}/conan | |
- name: conan odrcore | |
run: conan export . --name odrcore --version 0.0.0 | |
- name: conan install | |
run: conan install . --output-folder=build --build=never | |
# odrcore/0.0.0 will be missing, can't build=never | |
- name: conan downstream | |
run: conan install test/downstream --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: runner.os != 'Windows' | |
run: test/downstream/build/odr-test-downstream | |
- name: run | |
if: runner.os == 'Windows' | |
run: test/downstream/build/Release/odr-test-downstream.exe |