Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add macos-14 build for Apple Silicon. #139

Merged
merged 1 commit into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions .ci-scripts/build-osx-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,26 @@ if [ ! -d "$SCRIPT_DIR/dockerfiles" ]; then
git clone --depth=1 https://github.com/TokTok/dockerfiles "$SCRIPT_DIR/dockerfiles"
fi

ARCH="$1"

install_deps() {
for dep in "$@"; do
mkdir -p _build-dep
pushd _build-dep
"$SCRIPT_DIR/dockerfiles/qtox/$dep" --arch macos
"$SCRIPT_DIR/dockerfiles/qtox/$dep" --arch "macos-$ARCH"
popd
rm -rf _build-dep
done
}

install_deps \
build_openssl.sh \
build_qrencode.sh \
build_libexif.sh \
build_sodium.sh \
build_openal.sh \
build_vpx.sh \
build_opus.sh \
build_ffmpeg.sh \
build_toxcore.sh \
build_sqlcipher.sh \
build_openssl.sh \
build_qrencode.sh \
build_libexif.sh \
build_sodium.sh \
build_openal.sh \
build_vpx.sh \
build_opus.sh \
build_ffmpeg.sh \
build_toxcore.sh \
build_sqlcipher.sh
68 changes: 34 additions & 34 deletions .ci-scripts/build-qtox-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,62 +18,62 @@
# Fail out on error
set -eu -o pipefail

readonly BIN_NAME="qTox.dmg"
readonly BIN_NAME="qTox-$2.dmg"

SCRIPT_DIR=$(dirname $(realpath "$0"))
SCRIPT_DIR=$(dirname "$(realpath "$0")")
if [ ! -d "$SCRIPT_DIR/dockerfiles" ]; then
git clone --depth=1 https://github.com/TokTok/dockerfiles "$SCRIPT_DIR/dockerfiles"
git clone --depth=1 https://github.com/TokTok/dockerfiles "$SCRIPT_DIR/dockerfiles"
fi

source "${SCRIPT_DIR}/dockerfiles/qtox/build_utils.sh"
source "$SCRIPT_DIR/dockerfiles/qtox/build_utils.sh"

# kind of a hack.. but we want to extract DEP_PREFIX from it
parse_arch --arch macos --supported macos --dep macos

if [ "$1" == "user" ]; then
DEPLOYMENT_TARGET=""
PREFIX_PATH="$(brew --prefix qt@6)"
DEPLOYMENT_TARGET=""
PREFIX_PATH="$(brew --prefix qt@6)"
elif [ "$1" == "dist" ]; then
DEPLOYMENT_TARGET="-DCMAKE_OSX_DEPLOYMENT_TARGET=$MACOS_MINIMUM_SUPPORTED_VERSION"
PREFIX_PATH="$DEP_PREFIX;$(brew --prefix qt@6)"
DEPLOYMENT_TARGET="-DCMAKE_OSX_DEPLOYMENT_TARGET=$MACOS_MINIMUM_SUPPORTED_VERSION"
PREFIX_PATH="$DEP_PREFIX;$(brew --prefix qt@6)"
else
echo "Unknown arg $1"
exit 1
echo "Unknown arg $1"
exit 1
fi

build_qtox() {
# Explicitly include with -isystem to avoid warnings from system headers.
# CMake will use -I instead of -isystem, so we need to set it manually.
cmake \
-DCMAKE_CXX_FLAGS="-isystem/usr/local/include" \
-DUPDATE_CHECK=ON \
-DSPELL_CHECK=OFF \
-DSTRICT_OPTIONS=ON \
-DCMAKE_BUILD_TYPE=Release \
"${DEPLOYMENT_TARGET}" \
-DCMAKE_PREFIX_PATH="${PREFIX_PATH}" \
-GNinja \
.
cmake --build .
ctest --output-on-failure --parallel "$(sysctl -n hw.ncpu)"
cmake --build . --target install
# Explicitly include with -isystem to avoid warnings from system headers.
# CMake will use -I instead of -isystem, so we need to set it manually.
cmake \
-DCMAKE_CXX_FLAGS="-isystem/usr/local/include" \
-DUPDATE_CHECK=ON \
-DSPELL_CHECK=OFF \
-DSTRICT_OPTIONS=ON \
-DCMAKE_BUILD_TYPE=Release \
"$DEPLOYMENT_TARGET" \
-DCMAKE_PREFIX_PATH="$PREFIX_PATH" \
-GNinja \
.
cmake --build .
ctest --output-on-failure --parallel "$(sysctl -n hw.ncpu)"
cmake --build . --target install
cp qTox.dmg "$BIN_NAME"
}

check() {
if [[ ! -s "$BIN_NAME" ]]
then
echo "There's no $BIN_NAME!"
exit 1
fi
if [[ ! -s "$BIN_NAME" ]]; then
echo "There's no $BIN_NAME!"
exit 1
fi
}

make_hash() {
shasum -a 256 "$BIN_NAME" > "$BIN_NAME".sha256
shasum -a 256 "$BIN_NAME" >"$BIN_NAME".sha256
}

main() {
build_qtox
check
make_hash
build_qtox
check
make_hash
}
main
49 changes: 29 additions & 20 deletions .github/workflows/build-test-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -302,16 +302,24 @@ jobs:

build-osx-distributable:
name: macOS distributable
runs-on: macos-13
needs: update-nightly-tag
strategy:
matrix:
arch: [x86_64, arm64]
include:
- arch: x86_64
os: macos-13
- arch: arm64
os: macos-14
runs-on: ${{ matrix.os }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.job }}
key: ${{ github.job }}-${{ matrix.arch }}
append-timestamp: false
- name: Fetch build scripts
run: git clone --depth=1 https://github.com/TokTok/dockerfiles ".ci-scripts/dockerfiles"
Expand All @@ -322,33 +330,30 @@ jobs:
uses: actions/cache@v4
with:
path: ".ci-scripts/dockerfiles/local-deps"
key: ${{ runner.os }}-local-deps
key: ${{ runner.os }}-${{ matrix.arch }}-local-deps
- name: Build dependencies
if: steps.cache-deps.outputs.cache-hit != 'true'
run: ./.ci-scripts/build-osx-deps.sh
run: ./.ci-scripts/build-osx-deps.sh ${{ matrix.arch }}
- name: Build qTox
run: ./.ci-scripts/build-qtox-macos.sh dist
run: ./.ci-scripts/build-qtox-macos.sh dist ${{ matrix.arch }}
- name: Upload dmg
uses: actions/upload-artifact@v4
with:
name: qTox-${{ github.sha }}.dmg
name: qTox-${{ github.sha }}-${{ matrix.arch }}.dmg
path: qTox.dmg
- name: Create shasum for versioned release
if: contains(github.ref, 'refs/tags/v')
run: sha256sum qTox.dmg > qTox.dmg.sha256
- name: Upload to versioned release
if: contains(github.ref, 'refs/tags/v')
uses: ncipollo/release-action@v1
with:
allowUpdates: true
draft: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "qTox.dmg,qTox.dmg.sha256"
artifacts: "qTox-${{ matrix.arch }}.dmg,qTox-${{ matrix.arch }}.dmg.sha256"
- name: Rename artifact for nightly upload
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
cp qTox.dmg qTox-nightly.dmg
sha256sum qTox-nightly.dmg > qTox-nightly.dmg.sha256
cp qTox-${{ matrix.arch }}.dmg qTox-nightly-${{ matrix.arch }}.dmg
cp qTox-${{ matrix.arch }}.dmg.sha256 qTox-nightly-${{ matrix.arch }}.dmg.sha256
- name: Upload to nightly release
uses: ncipollo/release-action@v1
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
Expand All @@ -360,29 +365,33 @@ jobs:
prerelease: true
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "qTox-nightly.dmg,qTox-nightly.dmg.sha256"
artifacts: "qTox-nightly-${{ matrix.arch }}.dmg,qTox-nightly-${{ matrix.arch }}.dmg.sha256"

build-osx-users:
build-osx-user:
name: macOS user
if: github.event_name == 'pull_request'
runs-on: macos-13
strategy:
matrix:
arch: [x86_64]
include:
- arch: x86_64
os: macos-13
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.job }}
key: ${{ github.job }}-${{ matrix.arch }}
append-timestamp: false
- name: Fetch build scripts
run: git clone --depth=1 https://github.com/TokTok/dockerfiles ".ci-scripts/dockerfiles"
- name: Homebrew
run: brew bundle --file ./osx/Brewfile
- name: Install toxcore
run: |
git clone --depth=1 https://github.com/TokTok/dockerfiles
dockerfiles/qtox/build_toxcore_linux.sh sudo
run: .ci-scripts/dockerfiles/qtox/build_toxcore_linux.sh sudo
- name: Build qTox
run: ./.ci-scripts/build-qtox-macos.sh user
run: ./.ci-scripts/build-qtox-macos.sh user ${{ matrix.arch }}

build-docs:
name: Docs
Expand Down
1 change: 0 additions & 1 deletion osx/Brewfile-DepBuildDeps
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ brew "coreutils"
brew "git"
brew "libtool"
brew "ninja"
brew "pkgconfig"
brew "yasm"

brew "qt@6" # Qt sets a low compatibility version by default: https://doc.qt.io/qt-6/macos.html#target-platforms
Loading