Debian Codegraph @

.github/workflows/build.yml

raw symbols SCIP
1 name: Build
2
3 on: [push, pull_request, workflow_dispatch]
4
5 env:
6 BUILD_TYPE: Release
7
8 jobs:
9 build:
10 strategy:
11 matrix:
12 os: [ubuntu-latest, macos-latest, windows-latest, windows-2025]
13 include:
14 - os: windows-latest
15 cmake_extra_args: '-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"'
16 - os: windows-2025
17 cmake_extra_args: '-G "MinGW Makefiles" -DCPPUNIT_INCLUDE_DIR="$env:GITHUB_WORKSPACE/pkg/usr/local/include" -DCPPUNIT_LIBRARIES="$($env:GITHUB_WORKSPACE -replace "\\", "/")/pkg/usr/local/lib/libcppunit.dll.a" -DCPPUNIT_INSTALLED_VERSION="1.15.1"'
18 # The windows-2025 runner is used for MinGW.
19 name: ${{ matrix.os == 'windows-2025' && 'mingw' || matrix.os }}
20 runs-on: ${{ matrix.os }}
21 steps:
22 - name: Checkout
23 uses: actions/checkout@v6
24
25 - name: Set up Ubuntu
26 run: sudo apt install -y libcppunit-dev libutfcpp-dev zlib1g-dev
27 if: matrix.os == 'ubuntu-latest'
28
29 - name: Set up macOS
30 run: |
31 brew update
32 brew install cppunit utf8cpp
33 if: matrix.os == 'macos-latest'
34
35 - name: Set up Windows
36 run: vcpkg install cppunit utfcpp zlib --triplet x64-windows
37 if: matrix.os == 'windows-latest'
38
39 - name: Set up MinGW
40 shell: bash
41 run: |
42 # Fetch utf8cpp, build cppunit
43 git submodule update --init
44 # Fails with fatal error: cppunit/config-auto.h: No such file or directory
45 # vcpkg install cppunit utfcpp zlib --triplet x64-mingw-dynamic
46 # Probably not working with CMake and MinGW, so we have to build it ourselves.
47 curl -sL "https://dev-www.libreoffice.org/src/cppunit-1.15.1.tar.gz" | tar xz
48 mkdir -p build_cppunit
49 (cd build_cppunit && MAKE=mingw32-make ../cppunit-1.15.1/configure \
50 --enable-shared=yes --enable-static=no \
51 --disable-dependency-tracking --disable-doxygen)
52 find build_cppunit -name Makefile -exec sed -i 's/\($[({]SHELL[)}]\)/"\1"/' {} \;
53 sed -i 's/^\(SUBDIRS.*\) examples\(.*\)$/\1\2/' build_cppunit/Makefile
54 (cd build_cppunit && mingw32-make -j$(nproc) install DESTDIR=$(cd .. && pwd)/pkg)
55 if: matrix.os == 'windows-2025'
56
57 - name: Configure
58 run: >
59 cmake -B${{github.workspace}}/build
60 -DBUILD_SHARED_LIBS=ON -DVISIBILITY_HIDDEN=ON
61 -DBUILD_TESTING=ON -DBUILD_EXAMPLES=ON -DBUILD_BINDINGS=ON
62 -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
63 ${{ matrix.cmake_extra_args }}
64
65 - name: Build
66 run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel
67
68 - name: Test
69 working-directory: ${{github.workspace}}/build
70 run: ctest -C ${{env.BUILD_TYPE}} -V --no-tests=error
71 if: matrix.os != 'windows-latest' && matrix.os != 'windows-2025'
72
73 - name: Test Windows
74 working-directory: ${{github.workspace}}/build
75 run: |
76 $env:Path += ";$PWD\taglib\Release;$PWD\bindings\c\Release"
77 $env:Path += ";$env:VCPKG_INSTALLATION_ROOT\packages\cppunit_x64-windows\bin"
78 $env:Path += ";$env:VCPKG_INSTALLATION_ROOT\packages\utfcpp_x64-windows\bin"
79 $env:Path += ";$env:VCPKG_INSTALLATION_ROOT\packages\zlib_x64-windows\bin"
80 ctest -C ${{env.BUILD_TYPE}} -V --no-tests=error
81 if: matrix.os == 'windows-latest'
82
83 - name: Test MinGW
84 working-directory: ${{github.workspace}}/build
85 run: |
86 $env:Path += ";$PWD/taglib;$PWD/bindings/c;${{github.workspace}}/pkg/usr/local/bin"
87 ctest -C ${{env.BUILD_TYPE}} -V --no-tests=error
88 if: matrix.os == 'windows-2025'