• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: C/C++ CI
2
3on: [push, pull_request]
4
5jobs:
6  build:
7    strategy:
8      fail-fast: false
9      matrix:
10        name: [
11          ubuntu-gcc-autotools,
12          ubuntu-clang-autotools,
13          ubuntu-gcc-ossfuzz,
14          macos-autotools,
15          ubuntu-gcc-cmake,
16          ubuntu-gcc-cmake-shared,
17          ubuntu-clang-cmake,
18          ubuntu-clang-cmake-shared,
19          macos-cmake,
20          macos-cmake-shared,
21          windows-vs2019-x64,
22          windows-vs2019-x64-shared,
23          windows-vs2019-Win32,
24          windows-vs2019-Win32-shared
25        ]
26        include:
27          - name: ubuntu-gcc-autotools
28            os: ubuntu-latest
29            cc: gcc
30            cxx: g++
31            build-system: autotools
32
33          - name: ubuntu-clang-autotools
34            os: ubuntu-latest
35            cc: clang
36            cxx: clang++
37            build-system: autotools
38
39          - name: ubuntu-gcc-ossfuzz
40            os: ubuntu-latest
41            cc: gcc
42            cxx: g++
43            build-system: ossfuzz
44
45          - name: macos-autotools
46            os: macos-latest
47            cc: clang
48            cxx: clang++
49            build-system: autotools
50
51          - name: ubuntu-gcc-cmake
52            os: ubuntu-latest
53            cc: gcc
54            cxx: g++
55            build-system: cmake
56            cmake-generator: 'Ninja'
57            cmake-options: >-
58              -DCMAKE_BUILD_TYPE=Release
59              -DCMAKE_C_FLAGS="-Wall -Wextra"
60              -DCMAKE_VERBOSE_MAKEFILE=ON
61
62          - name: ubuntu-gcc-cmake-shared
63            os: ubuntu-latest
64            cc: gcc
65            cxx: g++
66            build-system: cmake
67            cmake-generator: 'Ninja'
68            cmake-options: >-
69              -DCMAKE_BUILD_TYPE=Release
70              -DBUILD_SHARED_LIBS=ON
71              -DCMAKE_C_FLAGS="-Wall -Wextra"
72              -DCMAKE_VERBOSE_MAKEFILE=ON
73
74          - name: ubuntu-clang-cmake
75            os: ubuntu-latest
76            cc: clang
77            cxx: clang++
78            build-system: cmake
79            cmake-generator: 'Ninja'
80            cmake-options: >-
81              -DCMAKE_BUILD_TYPE=Release
82              -DCMAKE_C_FLAGS="-Wall -Wextra"
83              -DCMAKE_VERBOSE_MAKEFILE=ON
84
85          - name: ubuntu-clang-cmake-shared
86            os: ubuntu-latest
87            cc: clang
88            cxx: clang++
89            build-system: cmake
90            cmake-generator: 'Ninja'
91            cmake-options: >-
92              -DCMAKE_BUILD_TYPE=Release
93              -DBUILD_SHARED_LIBS=ON
94              -DCMAKE_C_FLAGS="-Wall -Wextra"
95              -DCMAKE_VERBOSE_MAKEFILE=ON
96
97          - name: macos-cmake
98            os: macos-latest
99            cc: clang
100            cxx: clang++
101            build-system: cmake
102            cmake-generator: 'Unix Makefiles'
103            cmake-options: >-
104              -DCMAKE_BUILD_TYPE=Release
105              -DCMAKE_C_FLAGS="-Wall -Wextra"
106              -DCMAKE_VERBOSE_MAKEFILE=ON
107
108          - name: macos-cmake-shared
109            os: macos-latest
110            cc: clang
111            cxx: clang++
112            build-system: cmake
113            cmake-generator: 'Unix Makefiles'
114            cmake-options: >-
115              -DCMAKE_BUILD_TYPE=Release
116              -DBUILD_SHARED_LIBS=ON
117              -DCMAKE_C_FLAGS="-Wall -Wextra"
118              -DCMAKE_VERBOSE_MAKEFILE=ON
119
120          - name: windows-vs2019-x64
121            os: windows-latest
122            triplet: 'x64-windows-static'
123            build-system: cmake
124            cmake-generator: 'Visual Studio 16 2019'
125            cmake-options: >-
126              -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$<CONFIG:Debug>:Debug>
127              -DCMAKE_BUILD_TYPE=Release
128              -DVCPKG_TARGET_TRIPLET=x64-windows-static
129              -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake
130
131          - name: windows-vs2019-x64-shared
132            os: windows-latest
133            triplet: 'x64-windows-static'
134            build-system: cmake
135            cmake-generator: 'Visual Studio 16 2019'
136            cmake-options: >-
137              -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$<CONFIG:Debug>:Debug>
138              -DBUILD_SHARED_LIBS=ON
139              -DBUILD_REGTEST=OFF
140              -DBUILD_EXAMPLES=OFF
141              -DINSTALL_PKGCONFIG_MODULE=OFF
142              -DCMAKE_BUILD_TYPE=Release
143              -DVCPKG_TARGET_TRIPLET=x64-windows-static
144              -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake
145
146          - name: windows-vs2019-Win32
147            os: windows-latest
148            triplet: 'x86-windows-static'
149            build-system: cmake
150            cmake-generator: 'Visual Studio 16 2019'
151            cmake-options: >-
152              -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$<CONFIG:Debug>:Debug>
153              -DCMAKE_GENERATOR_PLATFORM=Win32
154              -DCMAKE_BUILD_TYPE=Release
155              -DVCPKG_TARGET_TRIPLET=x86-windows-static
156              -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake
157
158          - name: windows-vs2019-Win32-shared
159            os: windows-latest
160            triplet: 'x86-windows-static'
161            build-system: cmake
162            cmake-generator: 'Visual Studio 16 2019'
163            cmake-options: >-
164              -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$<CONFIG:Debug>:Debug>
165              -DCMAKE_GENERATOR_PLATFORM=Win32
166              -DBUILD_SHARED_LIBS=ON
167              -DBUILD_REGTEST=OFF
168              -DBUILD_EXAMPLES=OFF
169              -DINSTALL_PKGCONFIG_MODULE=OFF
170              -DCPACK_PACKAGE_NAME=libsndfile
171              -DCMAKE_BUILD_TYPE=Release
172              -DVCPKG_TARGET_TRIPLET=x86-windows-static
173              -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake
174
175    runs-on: ${{ matrix.os }}
176    steps:
177      - uses: actions/checkout@v2
178
179      - name: Install MacOS dependencies
180        if: startsWith(matrix.os,'macos')
181        run: |
182          brew install automake autogen speex
183
184      - name: Install Lunux dependencies
185        if: startsWith(matrix.os,'ubuntu')
186        run: sudo apt-get install -y autogen ninja-build libogg-dev libvorbis-dev libflac-dev libopus-dev libasound2-dev libsqlite3-dev libspeex-dev
187
188      - name: Install Windows dependencies
189        if: startsWith(matrix.os,'windows')
190        run: |
191          vcpkg install libvorbis libflac opus sqlite3 speex --triplet ${{matrix.triplet}}
192
193      - name: Configure, build and test with Autotools
194        env:
195          CC: ${{ matrix.cc }}
196          CXX: ${{ matrix.cxx }}
197        if: startsWith(matrix.build-system,'autotools')
198        run: |
199          ./autogen.sh
200          if [[ "${CC}" == "clang" ]]; then
201            ./configure --enable-werror && make clean all check && make distcheck
202          else
203            Scripts/asan-configure.sh --enable-werror && make clean all check && make distcheck
204          fi
205
206      - name: Configure, build and test with CMake
207        env:
208          CC: ${{ matrix.cc }}
209          CXX: ${{ matrix.cxx }}
210        if: startsWith(matrix.build-system,'cmake')
211        run: |
212          mkdir build
213          cd build
214          cmake .. -G "${{matrix.cmake-generator}}" ${{matrix.cmake-options}}
215          cmake --build . --config Release
216          ctest
217
218      - name: Configure, build and test with OSSFuzz
219        env:
220          CC: ${{ matrix.cc }}
221          CXX: ${{ matrix.cxx }}
222        if: startsWith(matrix.build-system,'ossfuzz')
223        run: |
224          ./ossfuzz/ci_oss.sh
225