mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Merge branch 'cirrus_ci_apple_silicon' into 'master'
See merge request nheko-reborn/nheko!22
This commit is contained in:
commit
1d477dfc65
6 changed files with 119 additions and 84 deletions
32
.ci/macos/build.sh
Executable file
32
.ci/macos/build.sh
Executable file
|
@ -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/
|
||||||
|
)
|
|
@ -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
|
|
|
@ -7,24 +7,28 @@ set -u
|
||||||
|
|
||||||
# Add Qt binaries to path
|
# Add Qt binaries to path
|
||||||
PATH="/usr/local/opt/qt@5/bin/:${PATH}"
|
PATH="/usr/local/opt/qt@5/bin/:${PATH}"
|
||||||
|
export PATH
|
||||||
|
|
||||||
security unlock-keychain -p "${RUNNER_USER_PW}" login.keychain
|
security unlock-keychain -p "${RUNNER_USER_PW}" login.keychain
|
||||||
|
|
||||||
|
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
|
( cd build || exit
|
||||||
# macdeployqt does not copy symlinks over.
|
unzip nheko.zip
|
||||||
# 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/
|
|
||||||
|
|
||||||
# user=$(id -nu)
|
|
||||||
# chown "${user}" nheko.dmg
|
|
||||||
)
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d "build/nheko.app" ]; then
|
||||||
|
echo "nheko.app is missing, you did something wrong!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "[INFO] Signing app contents"
|
echo "[INFO] Signing app contents"
|
||||||
find "build/nheko.app/Contents"|while read -r fname; do
|
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
|
dmgbuild -s .ci/macos/settings.json "Nheko" nheko.dmg
|
||||||
codesign -s "${APPLE_DEV_IDENTITY}" nheko.dmg
|
codesign -s "${APPLE_DEV_IDENTITY}" nheko.dmg
|
||||||
|
|
||||||
user=$(id -nu)
|
user=$(id -nu)
|
||||||
chown "${user}" nheko.dmg
|
chown "${user}" nheko.dmg
|
||||||
|
|
||||||
|
@ -82,6 +87,7 @@ while sleep 60 && date; do
|
||||||
fi
|
fi
|
||||||
if [ "${sub_status}" = "Invalid" ] || [ "${sub_status}" = "Rejected" ]; then
|
if [ "${sub_status}" = "Invalid" ] || [ "${sub_status}" = "Rejected" ]; then
|
||||||
echo "Notarization failed"
|
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
|
cat "$NOTARIZE_STATUS_LOG" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -91,7 +97,7 @@ done
|
||||||
VERSION=${CI_COMMIT_SHORT_SHA}
|
VERSION=${CI_COMMIT_SHORT_SHA}
|
||||||
|
|
||||||
if [ -n "$VERSION" ]; then
|
if [ -n "$VERSION" ]; then
|
||||||
mv nheko.dmg "nheko-${VERSION}.dmg"
|
mv nheko.dmg "nheko-${VERSION}_${PLAT}.dmg"
|
||||||
mkdir artifacts
|
mkdir artifacts
|
||||||
cp "nheko-${VERSION}.dmg" artifacts/
|
cp "nheko-${VERSION}_${PLAT}.dmg" artifacts/
|
||||||
fi
|
fi
|
24
.cirrus.yml
Normal file
24
.cirrus.yml
Normal file
|
@ -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
|
|
@ -28,6 +28,8 @@ build-clazy:
|
||||||
-DCMAKE_BUILD_TYPE=Release
|
-DCMAKE_BUILD_TYPE=Release
|
||||||
-DCI_BUILD=ON -DFETCHCONTENT_QUIET=OFF -DCMAKE_CXX_COMPILER=clazy
|
-DCI_BUILD=ON -DFETCHCONTENT_QUIET=OFF -DCMAKE_CXX_COMPILER=clazy
|
||||||
- cmake --build build
|
- cmake --build build
|
||||||
|
rules:
|
||||||
|
- if : '$CI_PIPELINE_TRIGGERED == null'
|
||||||
cache:
|
cache:
|
||||||
key: "$CI_JOB_NAME"
|
key: "$CI_JOB_NAME"
|
||||||
paths:
|
paths:
|
||||||
|
@ -63,6 +65,8 @@ build-gcc11:
|
||||||
- cmake --build build
|
- cmake --build build
|
||||||
after_script:
|
after_script:
|
||||||
- mv ../.hunter .hunter
|
- mv ../.hunter .hunter
|
||||||
|
rules:
|
||||||
|
- if : '$CI_PIPELINE_TRIGGERED == null'
|
||||||
cache:
|
cache:
|
||||||
key: "$CI_JOB_NAME"
|
key: "$CI_JOB_NAME"
|
||||||
paths:
|
paths:
|
||||||
|
@ -100,6 +104,8 @@ build-gcc10:
|
||||||
- cmake --build build
|
- cmake --build build
|
||||||
after_script:
|
after_script:
|
||||||
- mv ../.hunter .hunter
|
- mv ../.hunter .hunter
|
||||||
|
rules:
|
||||||
|
- if : '$CI_PIPELINE_TRIGGERED == null'
|
||||||
cache:
|
cache:
|
||||||
key: "$CI_JOB_NAME"
|
key: "$CI_JOB_NAME"
|
||||||
paths:
|
paths:
|
||||||
|
@ -112,22 +118,11 @@ build-macos:
|
||||||
before_script:
|
before_script:
|
||||||
- rm -rf ../.hunter && mv .hunter ../.hunter || true
|
- rm -rf ../.hunter && mv .hunter ../.hunter || true
|
||||||
script:
|
script:
|
||||||
- export PATH=/usr/local/opt/qt@5/bin/:${PATH}
|
- ./.ci/macos/build.sh
|
||||||
- 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)
|
|
||||||
after_script:
|
after_script:
|
||||||
- mv ../.hunter .hunter
|
- mv ../.hunter .hunter
|
||||||
|
rules:
|
||||||
|
- if : '$CI_PIPELINE_TRIGGERED == null'
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- build/nheko.app
|
- build/nheko.app
|
||||||
|
@ -143,22 +138,27 @@ build-macos:
|
||||||
codesign-macos:
|
codesign-macos:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
tags: [macos]
|
tags: [macos]
|
||||||
|
variables:
|
||||||
|
PLAT: "intel"
|
||||||
before_script:
|
before_script:
|
||||||
- 'brew upgrade qt@5'
|
|
||||||
- pip3 install dmgbuild
|
- pip3 install dmgbuild
|
||||||
script:
|
script:
|
||||||
- export PATH=/usr/local/opt/qt@5/bin/:${PATH}
|
- export PATH=/usr/local/opt/qt@5/bin/:${PATH}
|
||||||
- ./.ci/macos/notarize.sh
|
- ./.ci/macos/notarize.sh
|
||||||
after_script:
|
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:
|
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:
|
rules:
|
||||||
- if : '$CI_COMMIT_BRANCH == "master"'
|
- if : '$CI_COMMIT_BRANCH == "master"'
|
||||||
- if : $CI_COMMIT_TAG
|
- if : $CI_COMMIT_TAG
|
||||||
|
- if : '$CI_PIPELINE_TRIGGERED && $CI_COMMIT_REF_PROTECTED'
|
||||||
|
variables:
|
||||||
|
PLAT: "m1"
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- artifacts/nheko-${CI_COMMIT_SHORT_SHA}.dmg
|
- artifacts/nheko-${CI_COMMIT_SHORT_SHA}_${PLAT}.dmg
|
||||||
- /tmp/notarize*
|
- /tmp/notarize*
|
||||||
name: nheko-${CI_COMMIT_SHORT_SHA}-macos
|
name: nheko-${CI_COMMIT_SHORT_SHA}-macos
|
||||||
|
|
||||||
|
@ -181,6 +181,8 @@ build-flatpak-amd64:
|
||||||
after_script:
|
after_script:
|
||||||
- (cd ./scripts && ./upload-to-flatpak-repo.sh ../build-flatpak/repo) || true
|
- (cd ./scripts && ./upload-to-flatpak-repo.sh ../build-flatpak/repo) || true
|
||||||
- bash ./.ci/upload-nightly-gitlab.sh build-flatpak/nheko-amd64.flatpak
|
- bash ./.ci/upload-nightly-gitlab.sh build-flatpak/nheko-amd64.flatpak
|
||||||
|
rules:
|
||||||
|
- if : '$CI_PIPELINE_TRIGGERED == null'
|
||||||
cache:
|
cache:
|
||||||
key: "$CI_JOB_NAME"
|
key: "$CI_JOB_NAME"
|
||||||
paths:
|
paths:
|
||||||
|
@ -209,6 +211,8 @@ build-flatpak-arm64:
|
||||||
after_script:
|
after_script:
|
||||||
- (cd ./scripts && ./upload-to-flatpak-repo.sh ../build-flatpak/repo) || true
|
- (cd ./scripts && ./upload-to-flatpak-repo.sh ../build-flatpak/repo) || true
|
||||||
- bash ./.ci/upload-nightly-gitlab.sh build-flatpak/nheko-arm64.flatpak
|
- bash ./.ci/upload-nightly-gitlab.sh build-flatpak/nheko-arm64.flatpak
|
||||||
|
rules:
|
||||||
|
- if : '$CI_PIPELINE_TRIGGERED == null'
|
||||||
cache:
|
cache:
|
||||||
key: "$CI_JOB_NAME"
|
key: "$CI_JOB_NAME"
|
||||||
paths:
|
paths:
|
||||||
|
@ -230,4 +234,6 @@ linting:
|
||||||
script:
|
script:
|
||||||
- make lint
|
- make lint
|
||||||
- make license
|
- make license
|
||||||
|
rules:
|
||||||
|
- if : '$CI_PIPELINE_TRIGGERED == null'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
|
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15)
|
Loading…
Reference in a new issue