# Copyright (C) The c-ares project and its contributors # SPDX-License-Identifier: MIT name: MSYS2 (Windows) on: push: pull_request: concurrency: group: ${{ github.ref }} cancel-in-progress: true jobs: build: runs-on: windows-latest strategy: fail-fast: true max-parallel: 2 matrix: include: - { msystem: CLANG64, env: clang-x86_64, extra_packages: "mingw-w64-clang-x86_64-clang mingw-w64-clang-x86_64-clang-analyzer" } - { msystem: MINGW64, env: x86_64, extra_packages: "mingw-w64-x86_64-gcc" } - { msystem: MINGW32, env: i686, extra_packages: "mingw-w64-i686-gcc" } # No need to test UCRT64 since clang64 uses UCRT # - { msystem: UCRT64, env: ucrt-x86_64 } defaults: run: shell: msys2 {0} name: ${{ matrix.msystem }} steps: - name: Install MSYS2 and base packages uses: msys2/setup-msys2@v2 with: msystem: ${{ matrix.msystem }} update: true install: >- autoconf autoconf-archive automake libtool make mingw-w64-${{ matrix.env }}-cmake mingw-w64-${{ matrix.env }}-ninja mingw-w64-${{ matrix.env }}-gtest ${{ matrix.extra_packages }} - name: Checkout c-ares uses: actions/checkout@v4 - name: "CMake: build and test c-ares" run: | cmake -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_INSTALL_PREFIX=C:/projects/build-cares/test_install -DCARES_STATIC=ON -DCARES_STATIC_PIC=ON -DCARES_BUILD_TESTS=ON -Bbuild_cmake -G Ninja . cmake --build build_cmake ./build_cmake/bin/adig.exe www.google.com ./build_cmake/bin/ahost.exe www.google.com ./build_cmake/bin/arestest.exe -4 -v --gtest_filter=-*LiveSearchTXT*:*LiveSearchANY*:*LiveGetLocalhostByAddr* - name: "Autotools: build and test c-ares" run: | autoreconf -fi mkdir build_autotools cd build_autotools ../configure --enable-static --disable-shared --enable-tests make -j3 ./src/tools/adig.exe www.google.com ./src/tools/ahost.exe www.google.com ./test/arestest.exe -4 -v --gtest_filter=-*LiveSearchTXT*:*LiveSearchANY*:*LiveGetLocalhostByAddr* - name: "CMake: UBSAN: build and test c-ares" if: ${{ matrix.env == 'clang-x86_64' || matrix.env == 'clang-i686' }} env: CMAKE_OPTS: "-DCMAKE_CXX_FLAGS=-fsanitize=undefined -DCMAKE_C_FLAGS=-fsanitize=undefined -DCMAKE_SHARED_LINKER_FLAGS=-fsanitize=undefined -DCMAKE_EXE_LINKER_FLAGS=-fsanitize=undefined" run: | cmake -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_INSTALL_PREFIX=C:/projects/build-cares/test_install -DCARES_STATIC=ON -DCARES_STATIC_PIC=ON -DCARES_BUILD_TESTS=ON ${{ env.CMAKE_OPTS }} -Bbuild_ubsan -G Ninja . cmake --build build_ubsan ./build_ubsan/bin/adig.exe www.google.com ./build_ubsan/bin/ahost.exe www.google.com ./build_ubsan/bin/arestest.exe -4 -v --gtest_filter=-*LiveSearchTXT*:*LiveSearchANY*:*LiveGetLocalhostByAddr* - name: "CMake: ASAN: build and test c-ares" if: ${{ matrix.env == 'clang-x86_64' || matrix.env == 'clang-i686' }} env: CMAKE_OPTS: "-DCMAKE_CXX_FLAGS=-fsanitize=address -DCMAKE_C_FLAGS=-fsanitize=address -DCMAKE_SHARED_LINKER_FLAGS=-fsanitize=address -DCMAKE_EXE_LINKER_FLAGS=-fsanitize=address" run: | cmake -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_INSTALL_PREFIX=C:/projects/build-cares/test_install -DCARES_STATIC=ON -DCARES_STATIC_PIC=ON -DCARES_BUILD_TESTS=ON ${{ env.CMAKE_OPTS }} -Bbuild_asan -G Ninja . cmake --build build_asan ./build_asan/bin/adig.exe www.google.com ./build_asan/bin/ahost.exe www.google.com ./build_asan/bin/arestest.exe -4 -v --gtest_filter=-*LiveSearchTXT*:*LiveSearchANY*:*LiveGetLocalhostByAddr* - name: "Autotools: Static Analyzer: build c-ares" if: ${{ matrix.env == 'clang-x86_64' || matrix.env == 'clang-i686' }} # Cmake won't work because it somehow mangles linker args and it can't find core windows libraries # Must build static only with autotools otherwise libtool creates a wrapper with reportable issues run: | autoreconf -fi mkdir build_analyze cd build_analyze scan-build --use-cc=clang --use-c++=clang++ -v ../configure --enable-static --disable-shared --disable-tests scan-build --use-cc=clang --use-c++=clang++ -v make -j3 ./src/tools/adig.exe www.google.com ./src/tools/ahost.exe www.google.com