ci: allow running MacOS builds on M1 Macs

This depends on installing Qt via Brew, but that creates a version mismatch,
since it's 5.15.8 and not 5.15.2, which is not optimal but works for now.

In the long term we should probably look into using Nix, or maybe aqt
will support M1 Macs, but this is not great.

Depends on:
- https://github.com/status-im/infra-ci/commit/54408b41
- https://github.com/status-im/infra-ci/commit/39d4fdef

Resolves: https://github.com/status-im/status-desktop/issues/9984

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2023-04-06 11:44:38 +02:00
parent 3c606625d6
commit 349c83347d
No known key found for this signature in database
GPG Key ID: FE65CD384D5BF7B4
7 changed files with 65 additions and 23 deletions

View File

@ -27,23 +27,27 @@ pipeline {
stages { stages {
stage('Build') { stage('Build') {
parallel { parallel {
stage('Linux') { steps { script { stage('Linux/x86_64') { steps { script {
linux = jenkins.Build('status-desktop/platforms/linux') linux_x86_64 = jenkins.Build('status-desktop/platforms/linux/x86_64')
} } } } } }
stage('Windows') { steps { script { stage('Windows/x86_64') { steps { script {
windows = jenkins.Build('status-desktop/platforms/windows') windows_x86_64 = jenkins.Build('status-desktop/platforms/windows/x86_64')
} } } } } }
stage('MacOS') { steps { script { stage('MacOS/x86_64') { steps { script {
macos = jenkins.Build('status-desktop/platforms/macos') macos_x86_64 = jenkins.Build('status-desktop/platforms/macos/x86_64')
} } }
stage('MacOS/arch64') { steps { script {
macos_aarch64 = jenkins.Build('status-desktop/platforms/macos/aarch64')
} } } } } }
} }
} }
stage('Archive') { stage('Archive') {
steps { script { steps { script {
sh('rm -f pkg/*') sh('rm -f pkg/*')
jenkins.copyArts(linux) jenkins.copyArts(linux_x86_64)
jenkins.copyArts(windows) jenkins.copyArts(windows_x86_64)
jenkins.copyArts(macos) jenkins.copyArts(macos_x86_64)
jenkins.copyArts(macos_aarch64)
sha = "pkg/${utils.pkgFilename(ext: 'sha256')}" sha = "pkg/${utils.pkgFilename(ext: 'sha256')}"
dir('pkg') { dir('pkg') {
/* generate sha256 checksums for upload */ /* generate sha256 checksums for upload */
@ -57,9 +61,10 @@ pipeline {
/* object for easier URLs handling */ /* object for easier URLs handling */
urls = [ urls = [
/* mobile */ /* mobile */
Linux: utils.pkgUrl(linux), 'Linux': utils.pkgUrl(linux_x86_64),
Windows: utils.pkgUrl(windows), 'Windows': utils.pkgUrl(windows_x86_64),
MacOS: utils.pkgUrl(macos), 'MacOS/x86_64': utils.pkgUrl(macos_x86_64),
'MacOS/aarch64': utils.pkgUrl(macos_aarch64),
/* upload the sha256 checksums file too */ /* upload the sha256 checksums file too */
SHA: s3.uploadArtifact(sha), SHA: s3.uploadArtifact(sha),
] ]

View File

@ -43,7 +43,7 @@ pipeline {
} }
environment { environment {
TARGET = 'linux' TARGET = "linux-${getArch()}"
/* Improve make performance */ /* Improve make performance */
MAKEFLAGS = "-j4 V=${params.VERBOSE}" MAKEFLAGS = "-j4 V=${params.VERBOSE}"
/* Disable colors in Nim compiler logs */ /* Disable colors in Nim compiler logs */
@ -51,8 +51,8 @@ pipeline {
/* Makefile assumes the compiler folder is included */ /* Makefile assumes the compiler folder is included */
QTDIR = "/opt/qt/5.15.2/gcc_64" QTDIR = "/opt/qt/5.15.2/gcc_64"
/* Control output the filename */ /* Control output the filename */
STATUS_CLIENT_APPIMAGE = "pkg/${utils.pkgFilename(ext: 'AppImage')}" STATUS_CLIENT_APPIMAGE = "pkg/${utils.pkgFilename(ext: 'AppImage', arch: getArch())}"
STATUS_CLIENT_TARBALL = "pkg/${utils.pkgFilename(ext: 'tar.gz')}" STATUS_CLIENT_TARBALL = "pkg/${utils.pkgFilename(ext: 'tar.gz', arch: getArch())}"
} }
stages { stages {
@ -97,3 +97,10 @@ pipeline {
cleanup { sh './scripts/clean-git.sh' } cleanup { sh './scripts/clean-git.sh' }
} }
} }
def getArch() {
def tokens = Thread.currentThread().getName().split('/')
for (def arch in ['x86_64', 'aarch64']) {
if (tokens.contains(arch)) { return arch }
}
}

View File

@ -4,8 +4,9 @@ library 'status-jenkins-lib@v1.6.8'
def isPRBuild = utils.isPRBuild() def isPRBuild = utils.isPRBuild()
pipeline { pipeline {
/* This way we run the same Jenkinsfile on different platforms. */
agent { agent {
label 'macos && x86_64 && qt-5.15.2' label "${getAgentLabels().join(' && ')} && qt-5.15"
} }
parameters { parameters {
@ -38,16 +39,16 @@ pipeline {
} }
environment { environment {
TARGET = 'macos' TARGET = "macos-${getArch()}"
/* Improve make performance */ /* Improve make performance */
MAKEFLAGS = "-j4 V=${params.VERBOSE}" MAKEFLAGS = "-j4 V=${params.VERBOSE}"
/* Disable colors in Nim compiler logs */ /* Disable colors in Nim compiler logs */
NIMFLAGS = '--colors:off' NIMFLAGS = '--colors:off'
/* Qt location is pre-defined */ /* WARNING: Qt 5.15.8 installed via Brew. */
QTDIR = '/usr/local/qt/5.15.2/clang_64' QTDIR = '/opt/homebrew/opt/qt@5'
PATH = "${env.QTDIR}/bin:${env.PATH}" PATH = "${env.QTDIR}/bin:${env.PATH}"
/* Control output the filename */ /* Control output the filename */
STATUS_CLIENT_DMG = "pkg/${utils.pkgFilename(ext: 'dmg')}" STATUS_CLIENT_DMG = "pkg/${utils.pkgFilename(ext: 'dmg', arch: getArch())}"
/* Apple Team ID for Notarization */ /* Apple Team ID for Notarization */
MACOS_NOTARIZE_TEAM_ID = "8B5X2M6H2Y" MACOS_NOTARIZE_TEAM_ID = "8B5X2M6H2Y"
} }
@ -109,3 +110,25 @@ pipeline {
cleanup { sh './scripts/clean-git.sh' } cleanup { sh './scripts/clean-git.sh' }
} }
} }
/* This allows us to use one Jenkinsfile and run
* jobs on different platforms based on job name. */
def getAgentLabels() {
if (params.AGENT_LABEL) { return params.AGENT_LABEL }
/* We extract the name of the job from currentThread because
* before an agent is picket env is not available. */
def tokens = Thread.currentThread().getName().split('/')
def labels = []
/* Check if the job path contains any of the valid labels. */
['linux', 'macos', 'x86_64', 'aarch64', 'arm64'].each {
if (tokens.contains(it)) { labels.add(it) }
}
return labels
}
def getArch() {
def tokens = Thread.currentThread().getName().split('/')
for (def arch in ['x86_64', 'aarch64']) {
if (tokens.contains(arch)) { return arch }
}
}

View File

@ -36,15 +36,15 @@ pipeline {
} }
environment { environment {
TARGET = 'windows' TARGET = "windows-${getArch()}"
/* Improve make performance */ /* Improve make performance */
MAKEFLAGS = "-j${utils.getProcCount()} V=${params.VERBOSE}" MAKEFLAGS = "-j${utils.getProcCount()} V=${params.VERBOSE}"
/* Disable colors in Nim compiler logs */ /* Disable colors in Nim compiler logs */
NIMFLAGS = '--colors:off' NIMFLAGS = '--colors:off'
/* Control output the filename */ /* Control output the filename */
STATUS_CLIENT_EXE = "pkg/${utils.pkgFilename(ext: 'exe')}" STATUS_CLIENT_EXE = "pkg/${utils.pkgFilename(ext: 'exe', arch: getArch())}"
/* 7zip archive filename */ /* 7zip archive filename */
STATUS_CLIENT_7Z = "pkg/${utils.pkgFilename(ext: '7z')}" STATUS_CLIENT_7Z = "pkg/${utils.pkgFilename(ext: '7z', arch: getArch())}"
/* RFC 3161 timestamping URL for DigiCert */ /* RFC 3161 timestamping URL for DigiCert */
WINDOWS_CODESIGN_TIMESTAMP_URL = 'http://timestamp.digicert.com' WINDOWS_CODESIGN_TIMESTAMP_URL = 'http://timestamp.digicert.com'
} }
@ -100,3 +100,10 @@ pipeline {
cleanup { sh './scripts/clean-git.sh' } cleanup { sh './scripts/clean-git.sh' }
} }
} }
def getArch() {
def tokens = Thread.currentThread().getName().split('/')
for (def arch in ['x86_64', 'aarch64']) {
if (tokens.contains(arch)) { return arch }
}
}