From 2d791f8a8570c100c114e8dc72b0cf4a32d7f826 Mon Sep 17 00:00:00 2001 From: Joseph Donofry Date: Thu, 20 Oct 2022 21:18:09 -0400 Subject: [PATCH] Cirrus build for Apple Silicon - maybe --- .ci/macos/notarize.sh | 12 +++++++---- .cirrus.yml | 23 +++++++++++++++++++++ .gitlab-ci.yml | 47 ++++++++++++++++++++++++++----------------- 3 files changed, 60 insertions(+), 22 deletions(-) create mode 100644 .cirrus.yml diff --git a/.ci/macos/notarize.sh b/.ci/macos/notarize.sh index af62a6d2..d0ff50c5 100755 --- a/.ci/macos/notarize.sh +++ b/.ci/macos/notarize.sh @@ -10,10 +10,14 @@ PATH="/usr/local/opt/qt@5/bin/:${PATH}" security unlock-keychain -p "${RUNNER_USER_PW}" login.keychain +if [ "${CI_PIPELINE_TRIGGERED}" ]; then + cat "${TRIGGER_PAYLOAD}" +fi + ( cd build || exit # macdeployqt does not copy symlinks over. # this specifically addresses icu4c issues but nothing else. - # We might not even need this any longer... + # We might not even need this any longer... # ICU_LIB="$(brew --prefix icu4c)/lib" # export ICU_LIB # mkdir -p nheko.app/Contents/Frameworks @@ -72,7 +76,7 @@ while sleep 60 && date; do #isSuccess=$(grep "success" "$NOTARIZE_STATUS_LOG") #isFailure=$(grep "invalid" "$NOTARIZE_STATUS_LOG") - echo "Status for submission \"${requestUUID}\": \"${sub_status}\"" + echo "Status for submission \"${requestUUID}\": \"${sub_status}\"" if [ "${sub_status}" = "Accepted" ]; then echo "Notarization done!" @@ -91,7 +95,7 @@ done VERSION=${CI_COMMIT_SHORT_SHA} if [ -n "$VERSION" ]; then - mv nheko.dmg "nheko-${VERSION}.dmg" + mv nheko.dmg "nheko-${VERSION}_${PLAT}.dmg" mkdir artifacts - cp "nheko-${VERSION}.dmg" artifacts/ + cp "nheko-${VERSION}_${PLAT}.dmg" artifacts/ fi \ No newline at end of file diff --git a/.cirrus.yml b/.cirrus.yml new file mode 100644 index 00000000..c607654f --- /dev/null +++ b/.cirrus.yml @@ -0,0 +1,23 @@ +task: + macos_instance: + image: ghcr.io/cirruslabs/macos-monterey-xcode:13 + name: Build - macOS Apple Silicon + homebrew_script: + - brew bundle --file .ci/macos/Brewfile + build_script: + - export PATH=/usr/local/opt/qt@5/bin/:${PATH} + - export CMAKE_PREFIX_PATH=/usr/local/opt/qt@5 + - cmake -GNinja -H. -Bbuild + -DCMAKE_BUILD_TYPE=RelWithDebInfo + -DCMAKE_INSTALL_PREFIX=.deps/usr + -DHUNTER_ROOT="../.hunter" + -DHUNTER_ENABLED=ON -DBUILD_SHARED_LIBS=OFF + -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHUNTER_CONFIGURATION_TYPES=RelWithDebInfo + -DUSE_BUNDLED_OPENSSL=ON + -DUSE_BUNDLED_BOOST=ON + -DCI_BUILD=ON + -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 + - cmake --build build + - (cd build && git clone https://github.com/Nheko-Reborn/qt-jdenticon.git && cd qt-jdenticon && qmake && make -j 4 && cp libqtjdenticon.dylib ../nheko.app/Contents/MacOS) + binaries_artifacts: + path: build/nheko.app \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 197cc7ac..877e3904 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,6 +4,11 @@ variables: # prevent configure tzdata hanging apt install commands DEBIAN_FRONTEND: noninteractive +# default to not running jobs when pipeline is triggered from a webhook. +default: + rules: + - if : '!$CI_PIPELINE_TRIGGERED' + build-clazy: stage: build image: ubuntu:22.04 @@ -14,10 +19,10 @@ build-clazy: before_script: - apt-get update - apt-get -y install --no-install-suggests --no-install-recommends ca-certificates build-essential ninja-build cmake gcc make automake liblmdb-dev libre2-dev - libssl-dev libqt5multimedia5-plugins libqt5multimediagsttools5 libqt5multimediaquick5 libqt5svg5-dev - qtmultimedia5-dev qtquickcontrols2-5-dev qttools5-dev qttools5-dev-tools qtdeclarative5-dev - qml-module-qtmultimedia qml-module-qtquick-controls2 qml-module-qtquick-layouts qml-module-qt-labs-platform - qt5keychain-dev ccache clazy libcurl4-openssl-dev libevent-dev libspdlog-dev git nlohmann-json3-dev libcmark-dev asciidoc # libolm-dev + libssl-dev libqt5multimedia5-plugins libqt5multimediagsttools5 libqt5multimediaquick5 libqt5svg5-dev + qtmultimedia5-dev qtquickcontrols2-5-dev qttools5-dev qttools5-dev-tools qtdeclarative5-dev + qml-module-qtmultimedia qml-module-qtquick-controls2 qml-module-qtquick-layouts qml-module-qt-labs-platform + qt5keychain-dev ccache clazy libcurl4-openssl-dev libevent-dev libspdlog-dev git nlohmann-json3-dev libcmark-dev asciidoc # libolm-dev script: - export PATH="/usr/local/bin/:/usr/lib/ccache:${PATH}" - export CMAKE_BUILD_PARALLEL_LEVEL=$(cat /proc/cpuinfo | awk '/^processor/{print $3}' | wc -l) @@ -41,11 +46,11 @@ build-gcc11: TRAVIS_OS_NAME: linux before_script: - apt-get update - - apt-get -y install --no-install-suggests --no-install-recommends ca-certificates build-essential ninja-build cmake gcc make automake ccache liblmdb-dev - libssl-dev libqt5multimedia5-plugins libqt5multimediagsttools5 libqt5multimediaquick5 libqt5svg5-dev - qtmultimedia5-dev qtquickcontrols2-5-dev qttools5-dev qttools5-dev-tools qtdeclarative5-dev - qml-module-qtmultimedia qml-module-qtquick-controls2 qml-module-qtquick-layouts qml-module-qt-labs-platform - qt5keychain-dev ccache clazy libcurl4-openssl-dev libevent-dev libspdlog-dev git nlohmann-json3-dev libcmark-dev asciidoc # libolm-dev + - apt-get -y install --no-install-suggests --no-install-recommends ca-certificates build-essential ninja-build cmake gcc make automake ccache liblmdb-dev + libssl-dev libqt5multimedia5-plugins libqt5multimediagsttools5 libqt5multimediaquick5 libqt5svg5-dev + qtmultimedia5-dev qtquickcontrols2-5-dev qttools5-dev qttools5-dev-tools qtdeclarative5-dev + qml-module-qtmultimedia qml-module-qtquick-controls2 qml-module-qtquick-layouts qml-module-qt-labs-platform + qt5keychain-dev ccache clazy libcurl4-openssl-dev libevent-dev libspdlog-dev git nlohmann-json3-dev libcmark-dev asciidoc # libolm-dev # need recommended deps for wget - apt-get -y install wget - /usr/sbin/update-ccache-symlinks @@ -77,11 +82,11 @@ build-gcc10: TRAVIS_OS_NAME: linux before_script: - apt-get update - - apt-get -y install --no-install-suggests --no-install-recommends ca-certificates build-essential ninja-build cmake gcc make automake ccache liblmdb-dev - libssl-dev libqt5multimedia5-plugins libqt5multimediagsttools5 libqt5multimediaquick5 libqt5svg5-dev - qtmultimedia5-dev qtquickcontrols2-5-dev qttools5-dev qttools5-dev-tools qtdeclarative5-dev - qml-module-qtmultimedia qml-module-qtquick-controls2 qml-module-qtquick-layouts qml-module-qt-labs-platform - qt5keychain-dev ccache clazy libcurl4-openssl-dev libevent-dev libspdlog-dev git nlohmann-json3-dev libcmark-dev asciidoc # libolm-dev + - apt-get -y install --no-install-suggests --no-install-recommends ca-certificates build-essential ninja-build cmake gcc make automake ccache liblmdb-dev + libssl-dev libqt5multimedia5-plugins libqt5multimediagsttools5 libqt5multimediaquick5 libqt5svg5-dev + qtmultimedia5-dev qtquickcontrols2-5-dev qttools5-dev qttools5-dev-tools qtdeclarative5-dev + qml-module-qtmultimedia qml-module-qtquick-controls2 qml-module-qtquick-layouts qml-module-qt-labs-platform + qt5keychain-dev ccache clazy libcurl4-openssl-dev libevent-dev libspdlog-dev git nlohmann-json3-dev libcmark-dev asciidoc # libolm-dev # need recommended deps for wget - apt-get -y install wget - /usr/sbin/update-ccache-symlinks @@ -143,6 +148,8 @@ build-macos: codesign-macos: stage: deploy tags: [macos] + variables: + PLAT: "intel" before_script: - 'brew upgrade qt@5' - pip3 install dmgbuild @@ -150,15 +157,19 @@ codesign-macos: - export PATH=/usr/local/opt/qt@5/bin/:${PATH} - ./.ci/macos/notarize.sh after_script: - - ./.ci/upload-nightly-gitlab.sh artifacts/nheko-${CI_COMMIT_SHORT_SHA}.dmg + - ./.ci/upload-nightly-gitlab.sh artifacts/nheko-${CI_COMMIT_SHORT_SHA}_${PLAT}.dmg needs: - - build-macos + - job: build-macos + optional: true # optional since we want to be able to also trigger this job from cirrus ci for apple silicon builds. rules: - - if: '$CI_COMMIT_BRANCH == "master"' + - if : '$CI_COMMIT_BRANCH == "master"' - if : $CI_COMMIT_TAG + - if : $CI_PIPELINE_TRIGGERED + variables: + PLAT: "m1" artifacts: paths: - - artifacts/nheko-${CI_COMMIT_SHORT_SHA}.dmg + - artifacts/nheko-${CI_COMMIT_SHORT_SHA}_${PLAT}.dmg - /tmp/notarize* name: nheko-${CI_COMMIT_SHORT_SHA}-macos