File: build.yml

package info (click to toggle)
taglib 2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 6,192 kB
  • sloc: cpp: 44,736; ansic: 137; makefile: 28
file content (88 lines) | stat: -rw-r--r-- 3,636 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Build

on: [push, pull_request, workflow_dispatch]

env:
  BUILD_TYPE: Release

jobs:
  build:
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest, windows-2025]
        include:
          - os: windows-latest
            cmake_extra_args: '-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"'
          - os: windows-2025
            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"'
    # The windows-2025 runner is used for MinGW.
    name: ${{ matrix.os == 'windows-2025' && 'mingw' || matrix.os }}
    runs-on: ${{ matrix.os }}
    steps:
    - name: Checkout
      uses: actions/checkout@v6

    - name: Set up Ubuntu
      run: sudo apt install -y libcppunit-dev libutfcpp-dev zlib1g-dev
      if: matrix.os == 'ubuntu-latest'

    - name: Set up macOS
      run: |
        brew update
        brew install cppunit utf8cpp
      if: matrix.os == 'macos-latest'

    - name: Set up Windows
      run: vcpkg install cppunit utfcpp zlib --triplet x64-windows
      if: matrix.os == 'windows-latest'

    - name: Set up MinGW
      shell: bash
      run: |
        # Fetch utf8cpp, build cppunit
        git submodule update --init
        # Fails with fatal error: cppunit/config-auto.h: No such file or directory
        # vcpkg install cppunit utfcpp zlib --triplet x64-mingw-dynamic
        # Probably not working with CMake and MinGW, so we have to build it ourselves.
        curl -sL "https://dev-www.libreoffice.org/src/cppunit-1.15.1.tar.gz" | tar xz
        mkdir -p build_cppunit
        (cd build_cppunit && MAKE=mingw32-make ../cppunit-1.15.1/configure \
         --enable-shared=yes --enable-static=no \
         --disable-dependency-tracking --disable-doxygen)
        find build_cppunit -name Makefile -exec sed -i 's/\($[({]SHELL[)}]\)/"\1"/' {} \;
        sed -i 's/^\(SUBDIRS.*\) examples\(.*\)$/\1\2/' build_cppunit/Makefile
        (cd build_cppunit && mingw32-make -j$(nproc) install DESTDIR=$(cd .. && pwd)/pkg)
      if: matrix.os == 'windows-2025'

    - name: Configure
      run: >
        cmake -B${{github.workspace}}/build
        -DBUILD_SHARED_LIBS=ON -DVISIBILITY_HIDDEN=ON
        -DBUILD_TESTING=ON -DBUILD_EXAMPLES=ON -DBUILD_BINDINGS=ON
        -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
        ${{ matrix.cmake_extra_args }}

    - name: Build
      run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel

    - name: Test
      working-directory: ${{github.workspace}}/build
      run: ctest -C ${{env.BUILD_TYPE}} -V --no-tests=error
      if: matrix.os != 'windows-latest' && matrix.os != 'windows-2025'

    - name: Test Windows
      working-directory: ${{github.workspace}}/build
      run: |
        $env:Path += ";$PWD\taglib\Release;$PWD\bindings\c\Release"
        $env:Path += ";$env:VCPKG_INSTALLATION_ROOT\packages\cppunit_x64-windows\bin"
        $env:Path += ";$env:VCPKG_INSTALLATION_ROOT\packages\utfcpp_x64-windows\bin"
        $env:Path += ";$env:VCPKG_INSTALLATION_ROOT\packages\zlib_x64-windows\bin"
        ctest -C ${{env.BUILD_TYPE}} -V --no-tests=error
      if: matrix.os == 'windows-latest'

    - name: Test MinGW
      working-directory: ${{github.workspace}}/build
      run: |
        $env:Path += ";$PWD/taglib;$PWD/bindings/c;${{github.workspace}}/pkg/usr/local/bin"
        ctest -C ${{env.BUILD_TYPE}} -V --no-tests=error
      if: matrix.os == 'windows-2025'