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)
pull/826/head
Brad House 4 months ago committed by GitHub
parent 8a53099184
commit 072972aec1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 14
      .cirrus.yml
  2. 74
      .github/workflows/macos.yml
  3. 2
      .github/workflows/msys2.yml
  4. 2
      ci/build.sh
  5. 18
      ci/test.sh

@ -73,18 +73,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"
TEST_DEBUGGER: "lldb"
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"
@ -150,7 +138,7 @@ task:
env:
BUILD_TYPE: "valgrind"
TEST_WRAP: "valgrind --leak-check=full"
TEST_FILTER: "--gtest_filter=-*Container*:-*LiveSearchANY*"
TEST_FILTER: "-4 --gtest_filter=-*Container*:-*LiveSearchANY*"
install_script:
- |

@ -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
env:

@ -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,6 +31,7 @@ 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

@ -1,13 +1,13 @@
#!/bin/sh
# Copyright (C) The c-ares project and its contributors
# SPDX-License-Identifier: MIT
set -e -x
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
@ -37,13 +37,19 @@ $TEST_WRAP "${TOOLSBIN}/ahost" www.google.com
cd "${TESTSBIN}"
if [ "$TEST_WRAP" != "" ] ; then
$TEST_WRAP ./arestest -4 $TEST_FILTER
$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 -4 $TEST_FILTER
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 --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 -4 $TEST_FILTER
# 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 -4 $TEST_FILTER
./arestest $TEST_FILTER
fi
./aresfuzz ${TESTDIR}/fuzzinput/*

Loading…
Cancel
Save