Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework the installation examples #8289

Merged
merged 3 commits into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
26 changes: 21 additions & 5 deletions .jenkins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ target:
- swiftpm-debug
- swiftpm-address
- swiftpm-thread
- swiftpm-ios
- ios-xcode-spm
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This renaming is a lazy way to get it to stop installing baas for these tests.

- ios-static
- ios-dynamic
- watchos
Expand All @@ -34,8 +34,9 @@ target:
- cocoapods-osx
- cocoapods-ios
- cocoapods-ios-dynamic
- cocoapods-ios-subdependency
- cocoapods-watchos
- cocoapods-tvos
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to distinguish which targets are building the framework and which are installation test

- cocoapods-catalyst
- swiftui-ios
- swiftui-server-osx
configuration:
Expand Down Expand Up @@ -127,20 +128,35 @@ exclude:
- xcode_version: 14.2
target: xcframework

- xcode_version: 14.1
target: cocoapods-ios

- xcode_version: 14.2
target: cocoapods-ios

- xcode_version: 14.1
target: cocoapods-ios-dynamic

- xcode_version: 14.2
target: cocoapods-ios-dynamic

- xcode_version: 14.1
target: cocoapods-ios-subdependency
target: cocoapods-watchos

- xcode_version: 14.2
target: cocoapods-ios-subdependency
target: cocoapods-watchos

- xcode_version: 14.1
target: cocoapods-tvos

- xcode_version: 14.2
target: cocoapods-watchos
target: cocoapods-tvos

- xcode_version: 14.1
target: cocoapods-catalyst

- xcode_version: 14.2
target: cocoapods-catalyst

- xcode_version: 14.1
target: swiftui-ios
Expand Down
83 changes: 19 additions & 64 deletions Jenkinsfile.releasability
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,23 @@ platformNames = ['osx': 'macOS', 'ios': 'iOS', 'watchos': 'watchOS', 'tvos': 'tv
carthageXcodeVersion = '14.3.1'
docsSwiftVersion = '5.8.1'

def installationTest(platform, test, language) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know you tested this for a release, how do you do it without actually posting a release?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is part of the cocoa-pipeline job, so it happens after building the release but before publishing it, so I just ran it on this branch. There's also post-release testing which validates that the published release works, and that'll probably need some fiddling to fix after merging this since it's hard to validate now.

def installationTest(platform, test, xcode, language = 'swift', linkage = 'dynamic') {
return {
node('osx') {
deleteDir()
unstash 'source'

if (test == "dynamic" || test == "static") {
if (test == "xcframework") {
unstash "${language}-packaged"
sh "mv *.zip examples/installation"
}

sh """
hostname
export REALM_XCODE_VERSION=${carthageXcodeVersion}
archive=\$(echo \$PWD/realm-${language}-*.zip)

export REALM_XCODE_VERSION='${xcode}'
export REALM_TEST_BRANCH='${sha}'
cd examples/installation
if [[ -f \$archive ]]; then
mv \$archive .
unzip realm-${language}-*.zip
rm realm-${language}-*.zip
mv realm-${language}-* realm-${language}-latest
fi

./build.sh test-${platform}-${language}-${test}
./build.rb ${platform} ${test} ${linkage}
"""
}
}
Expand All @@ -50,22 +43,6 @@ def xcframeworkEvolutionTest() {
}
}

def spmInstallationTest(platform) {
return {
node('osx') {
deleteDir()
unstash 'source'

sh """
hostname
export REALM_XCODE_VERSION=${carthageXcodeVersion}
cd examples/installation
./build.sh test-${platform}-spm
"""
}
}
}

def doBuild() {
stage('prepare') {
node('docker') {
Expand All @@ -82,6 +59,7 @@ def doBuild() {
)

stash includes: '**', name: 'source'
stash includes: 'build.sh,scripts/*', name: 'build-scripts'
}
}

Expand Down Expand Up @@ -257,17 +235,10 @@ def doBuild() {
deleteDir()

unstash 'objc-packaged'
unstash 'build-scripts'

def sha = params.sha
sh """
hostname
curl -O https://raw.githubusercontent.com/realm/realm-swift/${sha}/build.sh
mkdir -p scripts
curl https://raw.githubusercontent.com/realm/realm-swift/${sha}/scripts/swift-version.sh -o scripts/swift-version.sh
curl https://raw.githubusercontent.com/realm/realm-swift/${sha}/scripts/reset-simulators.sh -o scripts/reset-simulators.sh
curl https://raw.githubusercontent.com/realm/realm-swift/${sha}/scripts/reset-simulators.rb -o scripts/reset-simulators.rb
chmod +x scripts/reset-simulators.rb

sh build.sh package-test-examples-objc
"""
}
Expand All @@ -278,17 +249,10 @@ def doBuild() {
deleteDir()

unstash 'swift-packaged'
unstash 'build-scripts'

def sha = params.sha
sh """
hostname
curl -O https://raw.githubusercontent.com/realm/realm-swift/${sha}/build.sh
mkdir -p scripts
curl https://raw.githubusercontent.com/realm/realm-swift/${sha}/scripts/swift-version.sh -o scripts/swift-version.sh
curl https://raw.githubusercontent.com/realm/realm-swift/${sha}/scripts/reset-simulators.sh -o scripts/reset-simulators.sh
curl https://raw.githubusercontent.com/realm/realm-swift/${sha}/scripts/reset-simulators.rb -o scripts/reset-simulators.rb
chmod +x scripts/reset-simulators.rb

sh build.sh package-test-examples-swift
"""
}
Expand Down Expand Up @@ -316,30 +280,21 @@ def doBuild() {
}
]

for (def platform in ["osx", "ios", "watchos"]) {
for (def platform in ['osx', 'ios', 'watchos', 'tvos', 'catalyst']) {
def platformName = platformNames[platform]
for (def test in ["dynamic", "cocoapods", "carthage"]) {
parallelBuilds["Installation - ${platformName} Obj-C ${test}"] = installationTest(platform, test, 'objc')
for (def test in ['xcframework', 'cocoapods', 'carthage', 'spm']) {
if (platform != 'catalyst' || test != 'carthage') {
parallelBuilds["Installation - ${platformName} ${test}"] = installationTest(platform, test, carthageXcodeVersion)
}
}
parallelBuilds["Installation - ${platformName} CocoaPods static"] = installationTest(platform, 'cocoapods', carthageXcodeVersion, 'swift', 'static')
}

parallelBuilds["Installation - iOS Obj-C static"] = installationTest('ios', 'static', 'objc')
parallelBuilds["Installation - iOS Obj-C CocoaPods dynamic"] = installationTest('ios', 'cocoapods-dynamic', 'objc')
parallelBuilds["Installation - iOS Swift Package Manager"] = spmInstallationTest('ios')

parallelBuilds["Installation - Mac Catalyst Obj-C CocoaPods"] = installationTest('catalyst', 'cocoapods', 'objc')
parallelBuilds["Installation - Mac Catalyst Obj-C CocoaPods dynamic"] = installationTest('catalyst', 'cocoapods-dynamic', 'objc')

for (def platform in ["osx", "ios", "watchos"]) {
def platformName = platformNames[platform]
for (def test in ["dynamic", "cocoapods", "carthage"]) {
parallelBuilds["Installation - ${platformName} Swift ${test}"] = installationTest(platform, test, 'swift')
}
parallelBuilds['Installation - iOS Static'] = installationTest('ios', 'xcframework', carthageXcodeVersion, 'objc', 'static')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this the only installation test we are doing for obj-s, is that what we are supposed to be doing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Installing the Swift SDK only works if the obj-c SDK successfully installs, so in practice every time we've had something break the obj-c installation it's been caught by the Swift tests and separately testing obj-c as well hasn't been useful. The static framework needs to test obj-c directly because we don't ship a static Swift framework.

parallelBuilds['Installation - XCFramework Evolution'] = xcframeworkEvolutionTest()
for (def version in xcodeVersions) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this duplicating testing

  • installationTest('osx', 'xcframework', version, 'swift', ‘dynamic’)
    where version == carthageXcodeVersion

parallelBuilds["Installation - Xcode ${version}"] = installationTest('osx', 'xcframework', version)
}

parallelBuilds["Installation - Mac Catalyst Swift CocoaPods"] = installationTest('catalyst', 'cocoapods', 'swift')
parallelBuilds["Installation - XCFramework Evolution"] = xcframeworkEvolutionTest()

parallel parallelBuilds
}
}
Expand Down
Loading
Loading