Skip to content

Commit 5dc1f4b

Browse files
authored
Run pull request tests on Github Actions (#8681)
And remove all Xcode Cloud related things.
1 parent 1bab047 commit 5dc1f4b

File tree

10 files changed

+599
-894
lines changed

10 files changed

+599
-894
lines changed

.github/workflows/build-pr.yml

Lines changed: 469 additions & 0 deletions
Large diffs are not rendered by default.

.github/workflows/update-xcode-cloud-workflows.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

RealmSwift/Tests/ObjectTests.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1641,7 +1641,7 @@ class ObjectTests: TestCase, @unchecked Sendable {
16411641
let realm = try await Realm(actor: CustomGlobalActor.shared)
16421642
let obj = realm.objects(SwiftObject.self).first!
16431643
var value = 0
1644-
for try await change in changesetPublisher(obj).values {
1644+
for try await change in changesetPublisher(obj).buffer(size: 10, prefetch: .byRequest, whenFull: .dropOldest).values {
16451645
guard case let .change(object, props) = change else {
16461646
return XCTFail("Expected .change, got \(change)")
16471647
}
@@ -1696,8 +1696,7 @@ class ObjectTests: TestCase, @unchecked Sendable {
16961696
}
16971697

16981698
@available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *)
1699-
func testCancelTaskWhileWaitingForInitial() async throws {
1700-
return; // FIXME
1699+
func skip_testCancelTaskWhileWaitingForInitial() async throws {
17011700
// This can't be tested deterministically as it's trying to hit specific
17021701
// timing windows, so instead spawn a bunch of tasks and hope that at
17031702
// least one is in each of the interesting states. Not handling all of
@@ -1727,7 +1726,7 @@ class ObjectTests: TestCase, @unchecked Sendable {
17271726
// Actor executors aren't fifo, so we can sometimes prevent the
17281727
// async opens from ever completing by continuously spawning new
17291728
// tasks
1730-
while waitingForRealm.value > 10 {
1729+
while waitingForRealm.value >= 10 {
17311730
await Task.yield()
17321731
}
17331732
}

build.sh

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,13 @@ if [ -n "${CI}" ]; then
2626
CODESIGN_PARAMS=(CODE_SIGN_IDENTITY='' CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO)
2727
fi
2828

29-
if [ -n "${CI_XCODE_CLOUD}" ]; then
30-
DERIVED_DATA="$CI_DERIVED_DATA_PATH"
31-
ROOT_WORKSPACE="$CI_WORKSPACE"
32-
BRANCH="$CI_BRANCH"
33-
elif [ -n "${GITHUB_WORKSPACE}" ]; then
34-
DERIVED_DATA="$GITHUB_WORKSPACE/build/DerivedData/Realm"
29+
if [ -n "${GITHUB_WORKSPACE}" ]; then
30+
DERIVED_DATA="$GITHUB_WORKSPACE/build/DerivedData"
3531
ROOT_WORKSPACE="$GITHUB_WORKSPACE"
36-
BRANCH="$GITHUB_REF"
32+
BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF}}"
3733
else
3834
ROOT_WORKSPACE="$(pwd)"
39-
DERIVED_DATA="$ROOT_WORKSPACE/build/DerivedData/Realm"
35+
DERIVED_DATA="$ROOT_WORKSPACE/build/DerivedData"
4036
BRANCH="$(git branch --show-current)"
4137
fi
4238

@@ -69,7 +65,7 @@ command:
6965
test-swiftpm: tests ObjC and Swift macOS frameworks via SwiftPM
7066
test-ios-swiftui: tests SwiftUI framework UI tests
7167
test-swiftuiserver-osx: tests Server Sync in SwiftUI
72-
verify: verifies docs, cocoapods, swiftpm, xcframework, swiftuiserver-osx, swiftlint, spm-ios, objectserver-osx, watchos in both Debug and Release configurations
68+
verify: verifies docs, cocoapods, swiftpm, xcframework, swiftuiserver-osx, swiftlint, spm-ios, sync, watchos in both Debug and Release configurations
7369
7470
docs: builds docs in docs/output
7571
examples: builds all examples
@@ -183,7 +179,7 @@ build_combined() {
183179
build_args=(-scheme "$product" -configuration "$config" build REALM_HIDE_SYMBOLS=YES)
184180

185181
# Derive build paths
186-
local build_products_path="$DERIVED_DATA/Build/Products"
182+
local build_products_path="$DERIVED_DATA/Realm/Build/Products"
187183
local product_name="$product.framework"
188184
local os_path="$build_products_path/$config${config_suffix}/$product_name"
189185
local simulator_path="$build_products_path/$config-$simulator_suffix/$product_name"
@@ -257,7 +253,7 @@ build_platform() {
257253
;;
258254
esac
259255

260-
build_products_path="$DERIVED_DATA/Build/Products"
256+
build_products_path="$DERIVED_DATA/Realm/Build/Products"
261257
build_path="$build_products_path/$config${config_suffix}"
262258

263259
build_args=(-scheme "$product" -configuration "$config" build REALM_HIDE_SYMBOLS=YES)
@@ -533,11 +529,11 @@ case "$COMMAND" in
533529
done
534530

535531
# Assemble them into xcframeworks
536-
rm -rf "$DERIVED_DATA/Build/Products"*.xcframework
537-
find "$DERIVED_DATA/Build/Products" -name 'Realm.framework' \
532+
rm -rf "$DERIVED_DATA/Realm/Build/Products"*.xcframework
533+
find "$DERIVED_DATA/Realm/Build/Products" -name 'Realm.framework' \
538534
| sed 's/.*/-framework &/' \
539535
| xargs xcodebuild -create-xcframework -allow-internal-distribution -output "build/$CONFIGURATION/Realm.xcframework"
540-
find "$DERIVED_DATA/Build/Products" -name 'RealmSwift.framework' \
536+
find "$DERIVED_DATA/Realm/Build/Products" -name 'RealmSwift.framework' \
541537
| sed 's/.*/-framework &/' \
542538
| xargs xcodebuild -create-xcframework -allow-internal-distribution -output "build/$CONFIGURATION/RealmSwift.xcframework"
543539

@@ -648,7 +644,7 @@ case "$COMMAND" in
648644
exit 0
649645
;;
650646

651-
"test-objectserver-osx")
647+
"test-sync")
652648
xctest 'Object Server Tests' -configuration "$CONFIGURATION" -sdk macosx -destination "platform=macOS,arch=$(uname -m)"
653649
exit 0
654650
;;
@@ -669,7 +665,7 @@ case "$COMMAND" in
669665
;;
670666

671667
"test-ios-swiftui")
672-
xctest 'SwiftUITestHost' -configuration "$CONFIGURATION" -sdk iphonesimulator -destination 'name=iPhone 11'
668+
xctest 'SwiftUITestHost' -configuration "$CONFIGURATION" -sdk iphonesimulator -destination 'name=iPhone 14'
673669
exit 0
674670
;;
675671

@@ -683,6 +679,16 @@ case "$COMMAND" in
683679
exit 0
684680
;;
685681

682+
"test-visionos")
683+
xctest Realm -configuration "$CONFIGURATION" -sdk xrsimulator -destination 'platform=visionOS Simulator,name=Apple Vision Pro' CODE_SIGN_IDENTITY=''
684+
exit 0
685+
;;
686+
687+
"test-visionos-swift")
688+
xctest RealmSwift -configuration "$CONFIGURATION" -sdk xrsimulator -destination 'platform=visionOS Simulator,name=Apple Vision Pro' CODE_SIGN_IDENTITY=''
689+
exit 0
690+
;;
691+
686692
"test-swiftuiserver-osx")
687693
xctest 'SwiftUISyncTestHost' -configuration "$CONFIGURATION" -sdk macosx -destination 'platform=macOS'
688694
exit 0
@@ -695,7 +701,7 @@ case "$COMMAND" in
695701
sh build.sh verify-cocoapods
696702
sh build.sh verify-docs
697703
sh build.sh verify-spm-ios
698-
sh build.sh verify-objectserver-osx
704+
sh build.sh verify-sync
699705
sh build.sh verify-swiftlint
700706
sh build.sh verify-swiftpm
701707
sh build.sh verify-watchos
@@ -723,15 +729,15 @@ case "$COMMAND" in
723729
;;
724730

725731
"verify-cocoapods")
726-
export REALM_TEST_BRANCH="$sha"
732+
export REALM_TEST_BRANCH="$BRANCH"
727733
if [[ -d .git ]]; then
728734
# Verify the current branch, unless one was already specified in the sha environment variable.
729-
if [[ -z $sha ]]; then
735+
if [[ -z $BRANCH ]]; then
730736
export REALM_TEST_BRANCH=$(git rev-parse --abbrev-ref HEAD)
731737
fi
732738

733739
if [[ $(git log -1 '@{push}..') != "" ]] || ! git diff-index --quiet HEAD; then
734-
echo "WARNING: verify-cocoapods will test the latest revision of $sha found on GitHub."
740+
echo "WARNING: verify-cocoapods will test the latest revision of $BRANCH found on GitHub."
735741
echo " Any unpushed local changes will not be tested."
736742
echo ""
737743
sleep 1
@@ -751,7 +757,7 @@ case "$COMMAND" in
751757
PLATFORM=$(echo "$COMMAND" | cut -d - -f 3)
752758
cd examples/installation
753759

754-
REALM_TEST_BRANCH="$sha" ./build.rb "$PLATFORM" cocoapods "$LINKAGE"
760+
REALM_TEST_BRANCH="$BRANCH" ./build.rb "$PLATFORM" cocoapods "$LINKAGE"
755761
;;
756762

757763
"verify-docs")
@@ -768,15 +774,15 @@ case "$COMMAND" in
768774
;;
769775

770776
"verify-spm")
771-
export REALM_TEST_BRANCH="$sha"
777+
export REALM_TEST_BRANCH="$BRANCH"
772778
if [[ -d .git ]]; then
773779
# Verify the current branch, unless one was already specified in the sha environment variable.
774-
if [[ -z $sha ]]; then
780+
if [[ -z $BRANCH ]]; then
775781
export REALM_TEST_BRANCH=$(git rev-parse --abbrev-ref HEAD)
776782
fi
777783

778784
if [[ $(git log -1 '@{push}..') != "" ]] || ! git diff-index --quiet HEAD; then
779-
echo "WARNING: verify-spm will test the latest revision of $sha found on GitHub."
785+
echo "WARNING: verify-spm will test the latest revision of $BRANCH found on GitHub."
780786
echo " Any unpushed local changes will not be tested."
781787
echo ""
782788
sleep 1
@@ -797,12 +803,7 @@ case "$COMMAND" in
797803
PLATFORM=$(echo "$COMMAND" | cut -d - -f 3)
798804
cd examples/installation
799805

800-
REALM_TEST_BRANCH="$sha" ./build.rb "$PLATFORM" spm "$LINKAGE"
801-
exit 0
802-
;;
803-
804-
"verify-objectserver-osx")
805-
REALM_TEST_BRANCH="$sha" sh build.sh test-objectserver-osx
806+
REALM_TEST_BRANCH="$BRANCH" ./build.rb "$PLATFORM" spm "$LINKAGE"
806807
exit 0
807808
;;
808809

@@ -837,9 +838,7 @@ case "$COMMAND" in
837838
sh build.sh examples-osx
838839

839840
(
840-
DERIVED_EXAMPLE_DATA=${DERIVED_DATA:-examples/osx/objc/build/DerivedData/RealmExamples}
841-
842-
cd $DERIVED_EXAMPLE_DATA/Build/Products/$CONFIGURATION
841+
cd examples/osx/objc/build/DerivedData/RealmExamples/Build/Products/Release
843842
DYLD_FRAMEWORK_PATH=. ./JSONImport >/dev/null
844843
)
845844
exit 0

ci_scripts/ci_post_clone.sh

Lines changed: 0 additions & 96 deletions
This file was deleted.

ci_scripts/ci_pre_xcodebuild.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.

dependencies.list

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
VERSION=10.53.1
22
REALM_CORE_VERSION=v14.12.1
3-
STITCH_VERSION=2f308db6f65333728a101d1fecbb792f9659a5ce
3+
STITCH_VERSION=c794ec6e2b751ef0cb5ab35256b07f5fa0c74c3a

examples/installation/SubRealm/SubRealm.podspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Pod::Spec.new do |s|
1111
s.osx.deployment_target = '10.15'
1212
s.watchos.deployment_target = '5.0'
1313
s.tvos.deployment_target = '12.0'
14+
s.visionos.deployment_target = '1.0'
1415
s.source_files = "*.swift"
1516
s.dependency 'RealmSwift'
1617
end

0 commit comments

Comments
 (0)