CI: MacOS: move to GitHub Actions instead of Cirrus-CI (#825)

We've been using a lot of time on Cirrus-CI and our credits run out
quickly. MacOS costs 15 compute credits vs 3 compute
 credits for Linux. Move MacOS testing to GitHub Actions.

Fix By: Brad House (@bradh352)
v1.31
Brad House 4 months ago
parent 1e8f056b2c
commit 8bd10c0283
  1. 11
      .cirrus.yml
  2. 74
      .github/workflows/macos.yml
  3. 2
      .github/workflows/msys2.yml
  4. 10
      ci/build.sh
  5. 28
      ci/test.sh

@ -68,17 +68,6 @@ task:
TEST_SYMBOL_VISIBILITY: "yes"
freebsd_instance:
image_family: freebsd-13-3
- name: "MacOS"
env:
DIST: "MACOS"
SCAN_BUILD: "/opt/homebrew/opt/llvm/bin/scan-build-py"
MAKE: "make"
BUILD_ASAN: "yes"
BUILD_UBSAN: "yes"
BUILD_ANALYZE: "yes"
TEST_SYMBOL_VISIBILITY: "yes"
macos_instance:
image: ghcr.io/cirruslabs/macos-sonoma-xcode:latest
- name: "iOS"
env:
DIST: "iOS"

@ -0,0 +1,74 @@
# Copyright (C) The c-ares project and its contributors
# SPDX-License-Identifier: MIT
name: MacOS
on:
push:
pull_request:
concurrency:
group: ${{ github.ref }}-macos
cancel-in-progress: true
env:
TEST_FILTER: "-v --gtest_filter=-*LiveSearchTXT*:*LiveSearchANY*:*LiveGetLocalhostByAddr*"
CMAKE_FLAGS: "-DCMAKE_BUILD_TYPE=DEBUG -DCARES_STATIC=ON -DCARES_STATIC_PIC=ON -G Ninja"
MAKE: make
jobs:
build:
runs-on: macos-latest
name: "MacOS"
steps:
- name: Install packages
run: brew install cmake googletest llvm autoconf automake libtool make ninja
- name: Checkout c-ares
uses: actions/checkout@v4
- name: "CMake: build and test c-ares"
env:
BUILD_TYPE: CMAKE
CMAKE_TEST_FLAGS: "-DCARES_BUILD_TESTS=ON"
TEST_DEBUGGER: lldb
run: |
./ci/build.sh
./ci/test.sh
- name: "Autotools: build and test c-ares"
env:
BUILD_TYPE: autotools
TEST_DEBUGGER: lldb
run: |
./ci/build.sh
./ci/test.sh
- name: "CMake: UBSAN: build and test c-ares"
env:
BUILD_TYPE: "ubsan"
CC: "clang"
CMAKE_TEST_FLAGS: "-DCARES_BUILD_TESTS=ON"
CFLAGS: "-fsanitize=undefined -fno-sanitize-recover"
CXXFLAGS: "-fsanitize=undefined -fno-sanitize-recover"
LDFLAGS: "-fsanitize=undefined"
TEST_DEBUGGER: "none"
run: |
./ci/build.sh
./ci/test.sh
- name: "CMake: ASAN: build and test c-ares"
env:
BUILD_TYPE: "asan"
CC: "clang"
CMAKE_TEST_FLAGS: "-DCARES_BUILD_TESTS=ON"
CFLAGS: "-fsanitize=address"
CXXFLAGS: "-fsanitize=address"
LDFLAGS: "-fsanitize=address"
TEST_DEBUGGER: "none"
run: |
./ci/build.sh
./ci/test.sh
- name: "Cmake: Static Analyzer: build c-ares"
env:
BUILD_TYPE: "analyze"
CC: "clang"
SCAN_WRAP: "/opt/homebrew/opt/llvm/bin/scan-build-py -v --status-bugs"
CMAKE_TEST_FLAGS: "-DCARES_BUILD_TESTS=OFF"
TEST_DEBUGGER: "lldb"
run: |
./ci/build.sh
./ci/test.sh

@ -6,7 +6,7 @@ on:
pull_request:
concurrency:
group: ${{ github.ref }}
group: ${{ github.ref }}-msys2
cancel-in-progress: true
jobs:

@ -1,7 +1,7 @@
#!/bin/sh
# Copyright (C) The c-ares project and its contributors
# SPDX-License-Identifier: MIT
set -e
set -e -x
OS=""
if [ "$TRAVIS_OS_NAME" != "" ]; then
@ -17,6 +17,7 @@ fi
if [ "$BUILD_TYPE" = "autotools" -o "$BUILD_TYPE" = "coverage" ]; then
autoreconf -fi
rm -rf atoolsbld
mkdir atoolsbld
cd atoolsbld
if [ "$DIST" = "iOS" ] ; then
@ -30,9 +31,12 @@ if [ "$BUILD_TYPE" = "autotools" -o "$BUILD_TYPE" = "coverage" ]; then
$SCAN_WRAP make
else
# Use cmake for everything else
rm -rf cmakebld
mkdir cmakebld
cd cmakebld
if [ "$DIST" = "iOS" ] ; then
CMAKE_FLAGS="${CMAKE_FLAGS} -DCMAKE_OSX_SYSROOT=${SYSROOT}"
fi
$SCAN_WRAP cmake ${CMAKE_FLAGS} ${CMAKE_TEST_FLAGS} -Bcmakebld .
$SCAN_WRAP cmake --build cmakebld
$SCAN_WRAP cmake ${CMAKE_FLAGS} ${CMAKE_TEST_FLAGS} ..
$SCAN_WRAP cmake --build .
fi

@ -1,13 +1,13 @@
#!/bin/sh
# Copyright (C) The c-ares project and its contributors
# SPDX-License-Identifier: MIT
set -e
set -e -x -o pipefail
# Travis on MacOS uses CloudFlare's DNS (1.1.1.1/1.0.0.1) which rejects ANY requests.
# Also, LiveSearchTXT is known to fail on Cirrus-CI on some MacOS hosts, we don't get
# a truncated UDP response so we never follow up with TCP.
# Note res_ninit() and /etc/resolv.conf actually have different configs, bad Travis
[ -z "$TEST_FILTER" ] && export TEST_FILTER="--gtest_filter=-*LiveSearchTXT*:*LiveSearchANY*"
[ -z "$TEST_FILTER" ] && export TEST_FILTER="-4 --gtest_filter=-*LiveSearchTXT*:*LiveSearchANY*"
# No tests for ios as it is a cross-compile
if [ "$BUILD_TYPE" = "ios" -o "$BUILD_TYPE" = "ios-cmake" -o "$DIST" = "iOS" ] ; then
@ -23,8 +23,10 @@ PWD=`pwd`
TESTDIR="${PWD}/test"
if [ "$BUILD_TYPE" = "autotools" -o "$BUILD_TYPE" = "coverage" ]; then
TOOLSBIN="${PWD}/atoolsbld/src/tools"
TESTSBIN="${PWD}/atoolsbld/test"
TOOLSBIN="${PWD}/atoolsbld/src/tools/.libs/"
TESTSBIN="${PWD}/atoolsbld/test/.libs/"
export LD_LIBRARY_PATH=${PWD}/atoolsbld/src/lib/.libs:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=${PWD}/atoolsbld/src/lib/.libs:$DYLD_LIBRARY_PATH
else
TOOLSBIN="${PWD}/cmakebld/bin"
TESTSBIN="${PWD}/cmakebld/bin"
@ -33,7 +35,23 @@ fi
$TEST_WRAP "${TOOLSBIN}/adig" www.google.com
$TEST_WRAP "${TOOLSBIN}/ahost" www.google.com
cd "${TESTSBIN}"
$TEST_WRAP ./arestest -4 $TEST_FILTER
if [ "$TEST_WRAP" != "" ] ; then
$TEST_WRAP ./arestest $TEST_FILTER
elif [ "$TEST_DEBUGGER" = "gdb" ] ; then
gdb --batch --batch-silent --return-child-result -ex "handle SIGPIPE nostop noprint pass" -ex "run" -ex "thread apply all bt" -ex "quit" --args ./arestest $TEST_FILTER
elif [ "$TEST_DEBUGGER" = "lldb" ] ; then
# LLDB won't return the exit code of the child process, so we need to extract it from the test output and verify it.
lldb --batch -o "settings set target.process.extra-startup-command 'process handle SIGPIPE -n true -p true -s false'" -o "process launch --shell-expand-args 0" -k "thread backtrace all" -k "quit 1" -- ./arestest $TEST_FILTER 2>&1 | tee test_output.txt
exit_code=`grep "Process [0-9]* exited with status = [0-9]* (.*)" test_output.txt | sed 's/.* = \([0-9]*\).*/\1/'`
echo "Test Exit Code: ${exit_code}"
if [ "${exit_code}" != "0" ] ; then
exit 1
fi
else
./arestest $TEST_FILTER
fi
./aresfuzz ${TESTDIR}/fuzzinput/*
./aresfuzzname ${TESTDIR}/fuzznames/*
./dnsdump "${TESTDIR}/fuzzinput/answer_a" "${TESTDIR}/fuzzinput/answer_aaaa"

Loading…
Cancel
Save