diff options
-rwxr-xr-x | .ci/macos/build.sh | 32 | ||||
-rwxr-xr-x | .ci/macos/deploy.sh | 34 | ||||
-rwxr-xr-x | .ci/macos/notarize.sh | 40 | ||||
-rw-r--r-- | .cirrus.yml | 24 | ||||
-rw-r--r-- | .gitlab-ci.yml | 72 | ||||
-rw-r--r-- | toolchain.cmake | 1 |
6 files changed, 119 insertions, 84 deletions
diff --git a/.ci/macos/build.sh b/.ci/macos/build.sh new file mode 100755 index 00000000..ef95181c --- /dev/null +++ b/.ci/macos/build.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env sh + +set -u + +# unused +#TAG=$(git tag -l --points-at HEAD) + +# Add Qt binaries to path +PATH="$(brew --prefix qt5):${PATH}" +export PATH + +CMAKE_PREFIX_PATH="$(brew --prefix qt5)" +export CMAKE_PREFIX_PATH + +cmake -GNinja -S. -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 \ + -DCI_BUILD=ON +cmake --build build +( cd build || exit + git clone https://github.com/Nheko-Reborn/qt-jdenticon.git + ( cd qt-jdenticon || exit + qmake + make -j 4 + cp libqtjdenticon.dylib ../nheko.app/Contents/MacOS + ) + macdeployqt nheko.app -always-overwrite -qmldir=../resources/qml/ +) diff --git a/.ci/macos/deploy.sh b/.ci/macos/deploy.sh deleted file mode 100755 index 56a1f23a..00000000 --- a/.ci/macos/deploy.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env sh - -set -eux - -# unused -#TAG=$(git tag -l --points-at HEAD) - -# Add Qt binaries to path -PATH=/usr/local/opt/qt@5/bin/:${PATH} - -( cd build - # macdeployqt does not copy symlinks over. - # this specifically addresses icu4c issues but nothing else. - ICU_LIB="$(brew --prefix icu4c)/lib" - export ICU_LIB - mkdir -p nheko.app/Contents/Frameworks - find "${ICU_LIB}" -type l -name "*.dylib" -exec cp -a -n {} nheko.app/Contents/Frameworks/ \; || true - - macdeployqt nheko.app -dmg -always-overwrite -qmldir=../resources/qml/ - - user=$(id -nu) - chown "${user}" nheko.dmg - mv nheko.dmg .. -) - -dmgbuild -s ./.ci/macos/settings.json "Nheko" nheko.dmg - -VERSION=${CI_COMMIT_SHORT_SHA} - -if [ -n "$VERSION" ]; then - mv nheko.dmg "nheko-${VERSION}.dmg" - mkdir artifacts - cp "nheko-${VERSION}.dmg" artifacts/ -fi diff --git a/.ci/macos/notarize.sh b/.ci/macos/notarize.sh index af62a6d2..7a67306d 100755 --- a/.ci/macos/notarize.sh +++ b/.ci/macos/notarize.sh @@ -7,24 +7,28 @@ set -u # Add Qt binaries to path PATH="/usr/local/opt/qt@5/bin/:${PATH}" +export PATH security unlock-keychain -p "${RUNNER_USER_PW}" login.keychain -( 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... - # ICU_LIB="$(brew --prefix icu4c)/lib" - # export ICU_LIB - # mkdir -p nheko.app/Contents/Frameworks - # find "${ICU_LIB}" -type l -name "*.dylib" -exec cp -a -n {} nheko.app/Contents/Frameworks/ \; || true - - #macdeployqt nheko.app -dmg -always-overwrite -qmldir=../resources/qml/ -sign-for-notarization="${APPLE_DEV_IDENTITY}" - macdeployqt nheko.app -always-overwrite -qmldir=../resources/qml/ +if [ "${CI_PIPELINE_TRIGGERED}" ] && [ "${TRIGGERED_BY}" = "cirrus" ]; then + echo "cirrus build id: ${TRIGGER_BUILD_ID}" + cat "${TRIGGER_PAYLOAD}" + # download the build artifacts from cirrus api + curl "https://api.cirrus-ci.com/v1/artifact/build/${TRIGGER_BUILD_ID}/binaries.zip" -o binaries.zip + # cirrus ci artifacts task name is 'binaries' so that's the zip name. + unzip binaries.zip + # we zip 'build/nheko.app' in cirrus ci, cirrus itself puts it in a 'build' directory + # so move it to the right place for the rest of the process. + ( cd build || exit + unzip nheko.zip + ) +fi - # user=$(id -nu) - # chown "${user}" nheko.dmg -) +if [ ! -d "build/nheko.app" ]; then + echo "nheko.app is missing, you did something wrong!" + exit 1 +fi echo "[INFO] Signing app contents" find "build/nheko.app/Contents"|while read -r fname; do @@ -46,6 +50,7 @@ trap finish EXIT dmgbuild -s .ci/macos/settings.json "Nheko" nheko.dmg codesign -s "${APPLE_DEV_IDENTITY}" nheko.dmg + user=$(id -nu) chown "${user}" nheko.dmg @@ -72,7 +77,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!" @@ -82,6 +87,7 @@ while sleep 60 && date; do fi if [ "${sub_status}" = "Invalid" ] || [ "${sub_status}" = "Rejected" ]; then echo "Notarization failed" + xcrun notarytool log "${requestUUID}" --apple-id "${APPLE_DEV_USER}" --password "${APPLE_DEV_PASS}" --team-id "${APPLE_TEAM_ID}" > "$NOTARIZE_STATUS_LOG" 2>&1 cat "$NOTARIZE_STATUS_LOG" 1>&2 exit 1 fi @@ -91,7 +97,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..2658b4b3 --- /dev/null +++ b/.cirrus.yml @@ -0,0 +1,24 @@ +task: + macos_instance: + image: ghcr.io/cirruslabs/macos-monterey-xcode:13 + name: Build - macOS Apple Silicon + only_if: $CIRRUS_REPO_OWNER == 'Nheko-Reborn' + environment: + GITLAB_TRIGGER_TOKEN: ENCRYPTED[!5fb4bbdecbde3b2c766ac7383dca573cd5ec8b815c5ac9bede0cadfe9ad70ecd3e64b1728f7840da087099f3fc1fd4f7!] + homebrew_script: + - brew bundle --file .ci/macos/Brewfile + build_script: + - export PATH="$(brew --prefix qt5)/bin/:${PATH}" + - ./.ci/macos/build.sh + zip_script: + - ditto -c -k --sequesterRsrc --keepParent build/nheko.app build/nheko.zip + gitlab_script: + - curl -X POST + --fail + -F token="${GITLAB_TRIGGER_TOKEN}" + -F ref="${CIRRUS_BRANCH}" + -F "variables[TRIGGER_BUILD_ID]=${CIRRUS_BUILD_ID}" + -F "variables[TRIGGERED_BY]=cirrus" + "https://nheko.im/api/v4/projects/2/trigger/pipeline" + binaries_artifacts: + path: build/nheko.zip \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 197cc7ac..0e172d5c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,10 +14,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) @@ -28,6 +28,8 @@ build-clazy: -DCMAKE_BUILD_TYPE=Release -DCI_BUILD=ON -DFETCHCONTENT_QUIET=OFF -DCMAKE_CXX_COMPILER=clazy - cmake --build build + rules: + - if : '$CI_PIPELINE_TRIGGERED == null' cache: key: "$CI_JOB_NAME" paths: @@ -41,11 +43,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 @@ -63,6 +65,8 @@ build-gcc11: - cmake --build build after_script: - mv ../.hunter .hunter + rules: + - if : '$CI_PIPELINE_TRIGGERED == null' cache: key: "$CI_JOB_NAME" paths: @@ -77,11 +81,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 @@ -100,6 +104,8 @@ build-gcc10: - cmake --build build after_script: - mv ../.hunter .hunter + rules: + - if : '$CI_PIPELINE_TRIGGERED == null' cache: key: "$CI_JOB_NAME" paths: @@ -112,22 +118,11 @@ build-macos: before_script: - rm -rf ../.hunter && mv .hunter ../.hunter || true 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) + - ./.ci/macos/build.sh after_script: - mv ../.hunter .hunter + rules: + - if : '$CI_PIPELINE_TRIGGERED == null' artifacts: paths: - build/nheko.app @@ -143,22 +138,27 @@ build-macos: codesign-macos: stage: deploy tags: [macos] + variables: + PLAT: "intel" before_script: - - 'brew upgrade qt@5' - pip3 install dmgbuild script: - 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 && $CI_COMMIT_REF_PROTECTED' + 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 @@ -181,6 +181,8 @@ build-flatpak-amd64: after_script: - (cd ./scripts && ./upload-to-flatpak-repo.sh ../build-flatpak/repo) || true - bash ./.ci/upload-nightly-gitlab.sh build-flatpak/nheko-amd64.flatpak + rules: + - if : '$CI_PIPELINE_TRIGGERED == null' cache: key: "$CI_JOB_NAME" paths: @@ -209,6 +211,8 @@ build-flatpak-arm64: after_script: - (cd ./scripts && ./upload-to-flatpak-repo.sh ../build-flatpak/repo) || true - bash ./.ci/upload-nightly-gitlab.sh build-flatpak/nheko-arm64.flatpak + rules: + - if : '$CI_PIPELINE_TRIGGERED == null' cache: key: "$CI_JOB_NAME" paths: @@ -230,4 +234,6 @@ linting: script: - make lint - make license + rules: + - if : '$CI_PIPELINE_TRIGGERED == null' diff --git a/toolchain.cmake b/toolchain.cmake index 90f05868..3e80767f 100644 --- a/toolchain.cmake +++ b/toolchain.cmake @@ -1,3 +1,4 @@ set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) +set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15) \ No newline at end of file |