CI(ga): Add macOS instance

This commit is contained in:
Robert Adam 2025-08-15 17:27:11 +02:00
parent 02e99d187e
commit 1f5c5db944
7 changed files with 88 additions and 10 deletions

View File

@ -26,13 +26,18 @@ echo ""
# Make targetDir an absolute path
targetDir="$( realpath "$targetDir" )"
# Use gtar instead of tar if available (for MacOS compatibility)
# Use gtar and gwc instead of tar if available (for MacOS compatibility)
tarExec="tar"
if [ -x "$(command -v gtar)" ]; then
tarExec="gtar"
fi
wcExec="wc"
if [ -x "$(command -v gwc)" ]; then
wcExec="gwc"
fi
tmp_dir="__extract_root__"
mkdir "$tmp_dir"
if [[ "$fromFile" = *.7z || "$fromFile" = *.zip ]]; then
extract_cmd=( 7z x "$fromFile" -o"$tmp_dir" )
@ -46,9 +51,9 @@ else
toSize=$(xz --robot --list "$fromFile" | tail -n -1 | cut -f 5)
steps=100
checkPointStep=$(expr "$toSizeKB" / "$steps" )
checkPointStep=$(expr "$toSize" / 1000 / "$steps" )
extract_cmd=( "$tarExec" -x --record-size=1K --checkpoint="$checkPointStep" --checkpoint-action="echo=%u / $toSize" -f "$fromFile" -C "$tmp_dir" )
extract_cmd=( "$tarExec" -x --record-size=1K --checkpoint="$checkPointStep" --checkpoint-action="echo=%u / $toSize" --file "$fromFile" --directory "$tmp_dir" )
fi
# Convert sizes to KB
@ -63,7 +68,7 @@ echo ""
"${extract_cmd[@]}"
num_files="$( ls -Al "$tmp_dir" | tail -n +2 | wc -l )"
num_files="$( ls -Al "$tmp_dir" | tail -n +2 | $wcExec -l )"
if [[ ! -d "$targetDir" ]]; then
mkdir "$targetDir"

View File

@ -0,0 +1,64 @@
set -e
set -x
if [[ "$MUMBLE_ENVIRONMENT_SOURCE" == "" ]]; then
echo "MUMBLE_ENVIRONMENT_SOURCE not set!"
exit 1
fi
if [[ "$MUMBLE_ENVIRONMENT_VERSION" == "" ]]; then
echo "MUMBLE_ENVIRONMENT_VERSION not set!"
exit 1
fi
if [[ "$MUMBLE_ENVIRONMENT_DIR" == "" ]]; then
echo "MUMBLE_ENVIRONMENT_DIR not set!"
exit 1
fi
brew install coreutils
envDir="$MUMBLE_ENVIRONMENT_DIR"
if [[ -d "$envDir" && -n "$(ls -A "$envDir")" ]]; then
echo "Environment is cached"
else
# We use gtar instead of tar as the default tar on macOS doesn't support
# the --record-size option
brew install aria2 gnu-tar xz
envArchive="$MUMBLE_ENVIRONMENT_VERSION.tar.xz"
aria2c "$MUMBLE_ENVIRONMENT_SOURCE/$envArchive" --out="$envArchive"
echo "Extracting archive..."
if [[ ! -d "$envDir" ]]; then
mkdir -p "$envDir"
fi
"$(dirname $0)/extractWithProgress.sh" "$envArchive" "$envDir"
if [[ ! -d "$envDir" || -z "$(ls -A "$envDir")" ]]; then
echo "Environment did not follow expected form"
ls -al "$envDir"
exit 1
fi
chmod +x "$envDir/installed/$MUMBLE_VCPKG_TRIPLET/tools/Ice/slice2cpp"
fi
# Setup PostgreSQL database for the Mumble tests
# Note: we don't configure MySQL as that's not installed on the Azure runners for macOS
# by default and installing it via homebrew takes forever.
echo "Configuring PostgreSQL..."
brew install postgresql
brew services start postgresql
# Give the database some time to start
sleep 5
echo "CREATE DATABASE mumble_test_db; "\
"CREATE USER mumble_test_user ENCRYPTED PASSWORD 'MumbleTestPassword'; "\
"ALTER DATABASE mumble_test_db OWNER TO mumble_test_user;" | psql -d postgres

View File

@ -55,7 +55,7 @@ else
envArchive="$MUMBLE_ENVIRONMENT_VERSION.tar.xz"
aria2c "$MUMBLE_ENVIRONMENT_SOURCE/$envArchive" --dir="$envArchive"
aria2c "$MUMBLE_ENVIRONMENT_SOURCE/$envArchive" --out="$envArchive"
echo "Extracting archive..."
if [[ ! -d "$envDir" ]]; then

View File

@ -26,7 +26,7 @@ if [[ -d "$envDir" && -n "$(ls -A '$envDir')" ]]; then
else
envArchive="$MUMBLE_ENVIRONMENT_VERSION.7z"
aria2c "$MUMBLE_ENVIRONMENT_SOURCE/$envArchive" --dir="$envArchive"
aria2c "$MUMBLE_ENVIRONMENT_SOURCE/$envArchive" --out="$envArchive"
echo "Extracting archive..."
if [[ ! -d "$envDir" ]]; then

View File

@ -49,8 +49,9 @@ case "$os" in
;;
"macos")
OS_SPECIFIC_CMAKE_OPTIONS="$OS_SPECIFIC_CMAKE_OPTIONS -Ddatabase-sqlite-tests=ON"
OS_SPECIFIC_CMAKE_OPTIONS="$OS_SPECIFIC_CMAKE_OPTIONS -Ddatabase-mysql-tests=ON"
OS_SPECIFIC_CMAKE_OPTIONS="$OS_SPECIFIC_CMAKE_OPTIONS -Ddatabase-mysql-tests=OFF"
OS_SPECIFIC_CMAKE_OPTIONS="$OS_SPECIFIC_CMAKE_OPTIONS -Ddatabase-postgresql-tests=ON"
OS_SPECIFIC_CMAKE_OPTIONS="-DCMAKE_OSX_ARCHITECTURES=$arch"
;;
*)
echo "OS $os is not supported"

View File

@ -44,12 +44,14 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-24.04, windows-2022]
os: [ubuntu-22.04, ubuntu-24.04, windows-2022, macos-14]
type: [static, shared]
arch: [x86_64]
exclude:
- os: windows-2022
type: shared
- os: macos-14
type: shared
# Currently the "static" build doesn't work for Linux systems
- os: ubuntu-22.04
type: static
@ -65,6 +67,11 @@ jobs:
fetch-depth: 1
# The Bash version installed on macOS is ancient. We need a newer version
- name: Install Bash
if: startswith(matrix.os, 'macos')
run: brew install bash
- name: Set environment variables
run: $GITHUB_WORKSPACE/.github/workflows/set_environment_variables.sh "${{ matrix.os }}" "${{ matrix.type }}" "${{ matrix.arch }}" "${{ runner.workspace }}"
shell: bash

View File

@ -70,9 +70,10 @@ echo "MUMBLE_ENVIRONMENT_DIR=$MUMBLE_ENVIRONMENT_DIR" >> "$GITHUB_ENV"
echo "MUMBLE_ENVIRONMENT_VERSION=$MUMBLE_ENVIRONMENT_VERSION" >> "$GITHUB_ENV"
echo "ADDITIONAL_CMAKE_OPTIONS=$ADDITIONAL_CMAKE_OPTIONS" >> "$GITHUB_ENV"
echo "VCPKG_CMAKE_OPTIONS=$VCPKG_CMAKE_OPTIONS" >> "$GITHUB_ENV"
echo "MUMBLE_VCPKG_TRIPLET=$VCPKG_TARGET_TRIPLET" >> "$GITHUB_ENV"
if [[ ! "$os" = "windows" ]]; then
if [[ "$os" = "ubuntu" ]]; then
# Setting this is necessary in order to be able to run tests on the CLI
# on non-Windows systems
# on Linuex systems (which don't have a desktop environment on CI)
echo "QT_QPA_PLATFORM=offscreen" >> "$GITHUB_ENV"
fi