Replace qt6 builds in macos with a universal build

This commit is contained in:
Luis Ángel San Martín Rodríguez 2023-07-22 19:05:35 +02:00
parent fe1a980983
commit 56b1e20aef
2 changed files with 12 additions and 76 deletions

View File

@ -141,10 +141,10 @@ jobs:
displayName: 'Run tests'
#
# MacOS qt6(intel)
# MacOS Qt6(universal)
#
- job: MacOS_qt6_Intel
- job: MacOS_qt6_Universal
timeoutInMinutes: 90
dependsOn: CodeFormatValidation
variables:
@ -175,66 +175,7 @@ jobs:
VERSION="$(cat common/yacreader_global.h | grep '#define VERSION "' | tr -d '#define VERSION' | tr -d '"' )"
echo "Trying to know if we are in a forked repo: $IS_FORK"
SKIP_CODESIGN="$(tr [A-Z] [a-z] <<< "$IS_FORK")"
./compileOSX.sh $VERSION $(Build.BuildNumber) $SKIP_CODESIGN Qt6 x86_64
displayName: 'Build'
- script: |
cd $(Build.SourcesDirectory)/tests
qmake
make check TESTARGS="-maxwarnings 100000"
displayName: 'Build and run tests'
- script: |
SKIP_CODESIGN="$(tr [A-Z] [a-z] <<< "$IS_FORK")"
if [ "$SKIP_CODESIGN" = false ]; then
xcrun notarytool submit *.dmg --apple-id $(AppleId) --team-id $(TeamId) --password $(AppPassword) --wait
xcrun stapler staple *.dmg
fi
displayName: 'Notarize'
- task: CopyFiles@2
inputs:
contents: '*.dmg'
targetFolder: $(Build.ArtifactStagingDirectory)
- task: PublishPipelineArtifact@1
inputs:
path: $(Build.ArtifactStagingDirectory)
artifactName: Macos qt6 Intel $(Build.BuildNumber) dmg
#
# MacOS qt6(apple)
#
#TODO create a template
- job: MacOS_qt6_Apple
timeoutInMinutes: 90
dependsOn: CodeFormatValidation
variables:
- ${{ if and(eq(variables['System.TeamFoundationCollectionUri'], 'https://dev.azure.com/luisangelsm/'), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['Build.SourceBranch'], 'refs/heads/develop'))) }}:
- group: macos-codesign
pool:
vmImage: 'macOS-latest'
steps:
- script: |
pip3 install aqtinstall
python3 -m aqt install 6.3.1 mac desktop -m qt5compat qtmultimedia qtimageformats
echo '##vso[task.prependpath]$(Build.SourcesDirectory)/6.3.1/macos/bin'
brew install create-dmg
brew install node
brew link --overwrite node
npm install -g appdmg
mkdir $(Build.SourcesDirectory)\compressed_archive
wget "https://github.com/YACReader/yacreader-7z-deps/blob/main/7z2301-src.7z?raw=true" -O $(Build.SourcesDirectory)/compressed_archive/7z2301-src.7z
7z x $(Build.SourcesDirectory)/compressed_archive/7z2301-src.7z -o$(Build.SourcesDirectory)/compressed_archive/lib7zip
displayName: 'Install dependencies'
- ${{ if and(eq(variables['System.TeamFoundationCollectionUri'], 'https://dev.azure.com/luisangelsm/'), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['Build.SourceBranch'], 'refs/heads/develop'))) }}:
- task: InstallAppleCertificate@2
inputs:
certSecureFile: 'developerID_application.p12'
certPwd: $(P12Password)
- script: |
cd $(Build.SourcesDirectory)
VERSION="$(cat common/yacreader_global.h | grep '#define VERSION "' | tr -d '#define VERSION' | tr -d '"' )"
echo "Trying to know if we are in a forked repo: $IS_FORK"
SKIP_CODESIGN="$(tr [A-Z] [a-z] <<< "$IS_FORK")"
./compileOSX.sh $VERSION $(Build.BuildNumber) $SKIP_CODESIGN Qt6 arm64
./compileOSX.sh $VERSION $(Build.BuildNumber) $SKIP_CODESIGN Qt6 universal
displayName: 'Build'
- script: |
cd $(Build.SourcesDirectory)/tests
@ -370,8 +311,7 @@ jobs:
- Linux_qt6
- Linux_qt6_7zip
- MacOS
- MacOS_qt6_Apple
- MacOS_qt6_Intel
- MacOS_qt6_Universal
- Windows_x86
- Windows_x64
- Windows_x64_qt6
@ -413,8 +353,7 @@ jobs:
- Linux_qt6
- Linux_qt6_7zip
- MacOS
- MacOS_qt6_Apple
- MacOS_qt6_Intel
- MacOS_qt6_Universal
- Windows_x86
- Windows_x64
- Windows_x64_qt6

View File

@ -17,13 +17,10 @@ if [ "$6" == "clean" ]; then
./cleanOSX.sh
fi
if [ "$ARCH" == "arm64" ]; then
ARCH_NAME="Apple"
elif [ "$ARCH" == "x86_64" ]; then
if [ "$ARCH" == "x86_64" ]; then
ARCH_NAME="Intel"
else
echo "Unknown arch: $ARCH"
exit 1
elif [ "$ARCH" == "x86_64" ]; then
ARCH_NAME="U"
fi
echo "Building for $ARCH_NAME"
@ -32,19 +29,19 @@ hash qmake 2>/dev/null || { echo >&2 "Qmake command not available. Please add th
echo "Compiling YACReader"
cd YACReader
qmake DEFINES+="BUILD_NUMBER=\\\\\\\"${BUILD_NUMBER}\\\\\\\"" QMAKE_APPLE_DEVICE_ARCHS="${ARCH}"
qmake DEFINES+="BUILD_NUMBER=\\\\\\\"${BUILD_NUMBER}\\\\\\\"" QMAKE_APPLE_DEVICE_ARCHS="x86_64 arm64"
make
cd ..
echo "Compiling YACReaderLibrary"
cd YACReaderLibrary
qmake DEFINES+="BUILD_NUMBER=\\\\\\\"${BUILD_NUMBER}\\\\\\\"" QMAKE_APPLE_DEVICE_ARCHS="${ARCH}"
qmake DEFINES+="BUILD_NUMBER=\\\\\\\"${BUILD_NUMBER}\\\\\\\"" QMAKE_APPLE_DEVICE_ARCHS="x86_64 arm64"
make
cd ..
echo "Compiling YACReaderLibraryServer"
cd YACReaderLibraryServer
qmake DEFINES+="BUILD_NUMBER=\\\\\\\"${BUILD_NUMBER}\\\\\\\"" QMAKE_APPLE_DEVICE_ARCHS="${ARCH}"
qmake DEFINES+="BUILD_NUMBER=\\\\\\\"${BUILD_NUMBER}\\\\\\\"" QMAKE_APPLE_DEVICE_ARCHS="x86_64 arm64"
make
cd ..
@ -87,7 +84,7 @@ fi
echo "Preparing apps for release, Done."
dest="YACReader-$VERSION.$BUILD_NUMBER MacOSX-$ARCH_NAME ${QT_VERSION}"
dest="YACReader-$VERSION.$BUILD_NUMBER MacOSX $ARCH_NAME ${QT_VERSION}"
echo "Copying to destination folder ${dest}"
mkdir -p "$dest"
cp -R YACReader.app "${dest}/YACReader.app"