Skip to content

Commit

Permalink
Add revision: v2.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
GovernikusAusweisApp2 committed Sep 12, 2024
1 parent c91c6be commit 62fd85e
Show file tree
Hide file tree
Showing 12 changed files with 80 additions and 104 deletions.
2 changes: 1 addition & 1 deletion AusweisApp2SDKWrapper/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let package = Package(
.package(
name: "AusweisApp2",
url: "https://github.com/Governikus/AusweisApp2-SDK-iOS",
.exact("2.2.0")
.exact("2.2.1")
)
],
targets: [
Expand Down
2 changes: 1 addition & 1 deletion AusweisApp2SDKWrapper/packaging/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let package = Package(
.package(
name: "AusweisApp2",
url: "https://github.com/Governikus/AusweisApp2-SDK-iOS",
.exact("2.2.0")
.exact("2.2.1")
)
],
targets: [
Expand Down
93 changes: 76 additions & 17 deletions jenkins/PipelineBuild.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ pipeline {
timeout(time: 30, unit: 'MINUTES')
}
stages {
stage('Cleanup') {
steps {
cleanWs(
deleteDirs: true,
disableDeferredWipeout: true
)
}
}
stage('Checkout') {
steps {
script {
Expand All @@ -39,55 +47,113 @@ pipeline {
stage('Patch') {
when { expression { params.REVIEWBOARD_REVIEW_ID != '' } }
steps {
executeParameterLessStageScript('StagePatch')
script {
def executor = load 'jenkins/Stage_Patch.groovy'
executor()
}
}
}
stage('Static analysis') {
steps {
executeParameterLessStageScript('StageStaticAnalysis')
script {
sh 'swiftlint --strict'
}
}
}
stage('Sonar') {
when { expression { params.performSonarScan } }
steps {
script {
def executor = load 'jenkins/stages/StageSonar.groovy'
executor(params.activateReviewBuildParams)
def pullRequestParams = params.activateReviewBuildParams ? '-Dsonar.pullrequest.key=${REVIEWBOARD_REVIEW_ID} -Dsonar.pullrequest.branch=${REVIEWBOARD_REVIEW_ID} -Dsonar.pullrequest.base=${REVIEWBOARD_REVIEW_BRANCH}' : '-Dsonar.branch.name=${REVIEWBOARD_REVIEW_BRANCH}'
catchError(buildResult: 'SUCCESS', stageResult: 'UNSTABLE') {
sh "sonar-scanner -Dsonar.scanner.metadataFilePath=\${WORKSPACE}/tmp/sonar-metadata.txt ${pullRequestParams} -Dsonar.token=\${SONARQUBE_TOKEN} -Dsonar.qualitygate.wait=true -Dsonar.qualitygate.timeout=90"
}
}
}
}
stage('Copy Swift Package') {
when { expression { params.spmSource != 'github' } }
steps {
script {
def executor = load 'jenkins/stages/StageCopySwiftPkg.groovy'
def executor = load 'jenkins/Stage_CopySwiftPkg.groovy'
executor(params.spmSource)
}
}
}
stage('Resolve Swift Package dependencies') {
steps {
executeParameterLessStageScript('StageResolveSwiftPkgDependencies')
script {
def derivedDataDir = 'ResolvedDerivedData'
sh "rm -rf ${derivedDataDir}; rm -rf AusweisApp2SDKWrapper/build/${derivedDataDir}"
sh "cd AusweisApp2SDKWrapper; xcodebuild -scheme AusweisApp2SDKWrapper -resolvePackageDependencies -derivedDataPath build/${derivedDataDir} -clonedSourcePackagesDirPath ../${derivedDataDir}"
}
}
}
stage('Compile SDKWrapper') {
steps {
executeParameterLessStageScript('StageCompileWrapper')
script {
def commonBuildPrefix = 'cd AusweisApp2SDKWrapper; xcodebuild archive -workspace SDKWrapper.xcworkspace -scheme AusweisApp2SDKWrapper'
def osNameBuildCmdStemMap = [
"iphoneos" : "${commonBuildPrefix} -sdk iphoneos -destination \"platform=iOS,name=Any iOS Device\" -configuration MinSizeRel ARCHS='arm64'",
"iphonesimulator-arm64" : "${commonBuildPrefix} -sdk iphonesimulator -destination \"platform=iOS Simulator,name=Any iOS Simulator Device\" -configuration MinSizeRel ARCHS='arm64'",
"iphonesimulator-x86_64" : "${commonBuildPrefix} -sdk iphonesimulator -destination \"platform=iOS Simulator,name=Any iOS Simulator Device\" -configuration MinSizeRel ARCHS='x86_64'"
]

sh 'security unlock-keychain ${KEYCHAIN_CREDENTIALS} ${HOME}/Library/Keychains/login.keychain-db'
osNameBuildCmdStemMap.each{entry -> sh "rm -rf ${entry.key}; rm -rf AusweisApp2SDKWrapper/build/${entry.key}" }
osNameBuildCmdStemMap.each{osName, buildCmdStem -> sh "${buildCmdStem} -derivedDataPath build/${osName} -clonedSourcePackagesDirPath ../${osName} -archivePath build/AusweisApp2SDKWrapper-${osName}.xcarchive SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES" }
}
}
}
stage('Test') {
steps {
executeParameterLessStageScript('StageTest')
script {
def cacheDir = 'test'
sh "rm -rf ${cacheDir}; rm -rf AusweisApp2SDKWrapper/build/${cacheDir}"
sh "cd AusweisApp2SDKWrapper; xcodebuild test -scheme SDKWrapperTests -destination \"platform=iOS Simulator,name=iPhone 15\" -derivedDataPath build/${cacheDir} -clonedSourcePackagesDirPath ../${cacheDir}"
}
}
}
stage('Package xcframework') {
steps {
executeParameterLessStageScript('StagePackageXcframework')
script {
sh 'cd AusweisApp2SDKWrapper; mkdir -p build/AusweisApp2SDKWrapper-iphoneos.xcarchive/Products/Library/Frameworks/AusweisApp2SDKWrapper.framework/Modules'
sh 'cd AusweisApp2SDKWrapper; cp -r build/iphoneos/Build/Intermediates.noindex/ArchiveIntermediates/AusweisApp2SDKWrapper/BuildProductsPath/MinSizeRel-iphoneos/AusweisApp2SDKWrapper.swiftmodule build/AusweisApp2SDKWrapper-iphoneos.xcarchive/Products/Library/Frameworks/AusweisApp2SDKWrapper.framework/Modules/AusweisApp2SDKWrapper.swiftmodule'

sh 'cd AusweisApp2SDKWrapper; cp -r build/AusweisApp2SDKWrapper-iphonesimulator-arm64.xcarchive build/AusweisApp2SDKWrapper-iphonesimulator.xcarchive'
sh 'cd AusweisApp2SDKWrapper; lipo -create -output build/AusweisApp2SDKWrapper-iphonesimulator.xcarchive/Products/Library/Frameworks/AusweisApp2SDKWrapper.framework/AusweisApp2SDKWrapper build/AusweisApp2SDKWrapper-iphonesimulator-arm64.xcarchive/Products/Library/Frameworks/AusweisApp2SDKWrapper.framework/AusweisApp2SDKWrapper build/AusweisApp2SDKWrapper-iphonesimulator-x86_64.xcarchive/Products/Library/Frameworks/AusweisApp2SDKWrapper.framework/AusweisApp2SDKWrapper'
sh 'cd AusweisApp2SDKWrapper; mkdir -p build/AusweisApp2SDKWrapper-iphonesimulator.xcarchive/Products/Library/Frameworks/AusweisApp2SDKWrapper.framework/Modules'
sh 'cd AusweisApp2SDKWrapper; cp -r build/iphonesimulator-arm64/Build/Intermediates.noindex/ArchiveIntermediates/AusweisApp2SDKWrapper/BuildProductsPath/MinSizeRel-iphonesimulator/AusweisApp2SDKWrapper.swiftmodule build/AusweisApp2SDKWrapper-iphonesimulator.xcarchive/Products/Library/Frameworks/AusweisApp2SDKWrapper.framework/Modules/'
sh 'cd AusweisApp2SDKWrapper; cp -r build/iphonesimulator-x86_64/Build/Intermediates.noindex/ArchiveIntermediates/AusweisApp2SDKWrapper/BuildProductsPath/MinSizeRel-iphonesimulator/AusweisApp2SDKWrapper.swiftmodule build/AusweisApp2SDKWrapper-iphonesimulator.xcarchive/Products/Library/Frameworks/AusweisApp2SDKWrapper.framework/Modules/'

sh 'cd AusweisApp2SDKWrapper; xcodebuild -create-xcframework -framework build/AusweisApp2SDKWrapper-iphoneos.xcarchive/Products/Library/Frameworks/AusweisApp2SDKWrapper.framework -framework build/AusweisApp2SDKWrapper-iphonesimulator.xcarchive/Products/Library/Frameworks/AusweisApp2SDKWrapper.framework -output build/spm/AusweisApp2SDKWrapper.xcframework'

sh 'cd AusweisApp2SDKWrapper; cp -r Sources/ build/spm'
sh 'cd AusweisApp2SDKWrapper; cp -r packaging/ build/spm'

sh 'cd AusweisApp2SDKWrapper; mkdir -p build/dist'
sh 'cd AusweisApp2SDKWrapper/build/spm; zip -r ../dist/AusweisApp2SDKWrapper.xcframework.zip AusweisApp2SDKWrapper.xcframework Package.swift Sources'
sh 'cd AusweisApp2SDKWrapper/build; zip -r dist/AusweisApp2SDKWrapper-iphoneos.framework.dSYM.zip AusweisApp2SDKWrapper-iphoneos.xcarchive/dSYMs/AusweisApp2SDKWrapper.framework.dSYM'
sh 'cd AusweisApp2SDKWrapper/build; zip -r dist/AusweisApp2SDKWrapper-iphonesimulator-arm64.framework.dSYM.zip AusweisApp2SDKWrapper-iphonesimulator-arm64.xcarchive/dSYMs/AusweisApp2SDKWrapper.framework.dSYM'
sh 'cd AusweisApp2SDKWrapper/build; zip -r dist/AusweisApp2SDKWrapper-iphonesimulator-x86_64.framework.dSYM.zip AusweisApp2SDKWrapper-iphonesimulator-x86_64.xcarchive/dSYMs/AusweisApp2SDKWrapper.framework.dSYM'
}
}
}
stage('Verify formatting') {
steps {
executeParameterLessStageScript('StageVerifyFormatting')
script {
sh 'hg commit --addremove --secret -u jenkins -m review || exit 0'
sh 'swiftformat --indent tab --commas inline AusweisApp2SDKWrapper SDKWrapperTester'
sh('''\
STATUS=$(hg status | wc -c | xargs)
if [ "$STATUS" != "0" ]; then
echo 'FORMATTING FAILED: Patch is not formatted'
hg diff
hg revert -a -C
exit 1
fi
'''.stripIndent().trim())
}
}
}
}
Expand All @@ -111,10 +177,3 @@ pipeline {
}
}
}

def executeParameterLessStageScript(String stageFilePath) {
script {
def executor = load "jenkins/stages/${stageFilePath}.groovy"
executor()
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
def name = 'StageCopySwiftPkg'
return { pSpmSource ->
echo "Entering ${name}"
copyArtifacts(
projectName: "${pSpmSource}",
filter: '**/*.zip',
Expand All @@ -11,4 +9,4 @@ return { pSpmSource ->
sh 'cd AusweisApp2SDKWrapper; find . -type f -name \'Package.swift\' -exec sed -i "" -e "/url:/d" -e "s/\\.exact\\(.*\\)/path: \\"..\\/AA2SwiftPackage\\"/" {} \\;'
sh 'find . -type f \\( -iname "*.zip" -not -iname "AusweisApp2SDKWrapper*.zip" -not -path "./shared_workspace/*" \\) -exec unzip -o -d AA2SwiftPackage {} \\;'
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
def name = 'StagePatch'
return {
echo "Entering ${name}"
sh 'hg --config extensions.strip= strip -r "secret() or draft()" --no-backup --force || exit 0'
publishReview downloadOnly: true, installRBTools: false
sh "hg --config patch.eol=auto import --no-commit patch.diff"
}
}
14 changes: 0 additions & 14 deletions jenkins/stages/StageCompileWrapper.groovy

This file was deleted.

23 changes: 0 additions & 23 deletions jenkins/stages/StagePackageXcframework.groovy

This file was deleted.

7 changes: 0 additions & 7 deletions jenkins/stages/StageResolveSwiftPkgDependencies.groovy

This file was deleted.

8 changes: 0 additions & 8 deletions jenkins/stages/StageSonar.groovy

This file was deleted.

5 changes: 0 additions & 5 deletions jenkins/stages/StageStaticAnalysis.groovy

This file was deleted.

7 changes: 0 additions & 7 deletions jenkins/stages/StageTest.groovy

This file was deleted.

15 changes: 0 additions & 15 deletions jenkins/stages/StageVerifyFormatting.groovy

This file was deleted.

0 comments on commit 62fd85e

Please sign in to comment.