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

RCOCOA-2430 Run pull request tests on Github Actions #8681

Merged
merged 1 commit into from
Sep 17, 2024
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
469 changes: 469 additions & 0 deletions .github/workflows/build-pr.yml

Large diffs are not rendered by default.

16 changes: 0 additions & 16 deletions .github/workflows/update-xcode-cloud-workflows.yml

This file was deleted.

7 changes: 3 additions & 4 deletions RealmSwift/Tests/ObjectTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1641,7 +1641,7 @@ class ObjectTests: TestCase, @unchecked Sendable {
let realm = try await Realm(actor: CustomGlobalActor.shared)
let obj = realm.objects(SwiftObject.self).first!
var value = 0
for try await change in changesetPublisher(obj).values {
for try await change in changesetPublisher(obj).buffer(size: 10, prefetch: .byRequest, whenFull: .dropOldest).values {
guard case let .change(object, props) = change else {
return XCTFail("Expected .change, got \(change)")
}
Expand Down Expand Up @@ -1696,8 +1696,7 @@ class ObjectTests: TestCase, @unchecked Sendable {
}

@available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *)
func testCancelTaskWhileWaitingForInitial() async throws {
return; // FIXME
func skip_testCancelTaskWhileWaitingForInitial() async throws {
// This can't be tested deterministically as it's trying to hit specific
// timing windows, so instead spawn a bunch of tasks and hope that at
// least one is in each of the interesting states. Not handling all of
Expand Down Expand Up @@ -1727,7 +1726,7 @@ class ObjectTests: TestCase, @unchecked Sendable {
// Actor executors aren't fifo, so we can sometimes prevent the
// async opens from ever completing by continuously spawning new
// tasks
while waitingForRealm.value > 10 {
while waitingForRealm.value >= 10 {
await Task.yield()
}
}
Expand Down
65 changes: 32 additions & 33 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,13 @@ if [ -n "${CI}" ]; then
CODESIGN_PARAMS=(CODE_SIGN_IDENTITY='' CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO)
fi

if [ -n "${CI_XCODE_CLOUD}" ]; then
DERIVED_DATA="$CI_DERIVED_DATA_PATH"
ROOT_WORKSPACE="$CI_WORKSPACE"
BRANCH="$CI_BRANCH"
elif [ -n "${GITHUB_WORKSPACE}" ]; then
DERIVED_DATA="$GITHUB_WORKSPACE/build/DerivedData/Realm"
if [ -n "${GITHUB_WORKSPACE}" ]; then
DERIVED_DATA="$GITHUB_WORKSPACE/build/DerivedData"
ROOT_WORKSPACE="$GITHUB_WORKSPACE"
BRANCH="$GITHUB_REF"
BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF}}"
else
ROOT_WORKSPACE="$(pwd)"
DERIVED_DATA="$ROOT_WORKSPACE/build/DerivedData/Realm"
DERIVED_DATA="$ROOT_WORKSPACE/build/DerivedData"
BRANCH="$(git branch --show-current)"
fi

Expand Down Expand Up @@ -69,7 +65,7 @@ command:
test-swiftpm: tests ObjC and Swift macOS frameworks via SwiftPM
test-ios-swiftui: tests SwiftUI framework UI tests
test-swiftuiserver-osx: tests Server Sync in SwiftUI
verify: verifies docs, cocoapods, swiftpm, xcframework, swiftuiserver-osx, swiftlint, spm-ios, objectserver-osx, watchos in both Debug and Release configurations
verify: verifies docs, cocoapods, swiftpm, xcframework, swiftuiserver-osx, swiftlint, spm-ios, sync, watchos in both Debug and Release configurations

docs: builds docs in docs/output
examples: builds all examples
Expand Down Expand Up @@ -183,7 +179,7 @@ build_combined() {
build_args=(-scheme "$product" -configuration "$config" build REALM_HIDE_SYMBOLS=YES)

# Derive build paths
local build_products_path="$DERIVED_DATA/Build/Products"
local build_products_path="$DERIVED_DATA/Realm/Build/Products"
local product_name="$product.framework"
local os_path="$build_products_path/$config${config_suffix}/$product_name"
local simulator_path="$build_products_path/$config-$simulator_suffix/$product_name"
Expand Down Expand Up @@ -257,7 +253,7 @@ build_platform() {
;;
esac

build_products_path="$DERIVED_DATA/Build/Products"
build_products_path="$DERIVED_DATA/Realm/Build/Products"
build_path="$build_products_path/$config${config_suffix}"

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

# Assemble them into xcframeworks
rm -rf "$DERIVED_DATA/Build/Products"*.xcframework
find "$DERIVED_DATA/Build/Products" -name 'Realm.framework' \
rm -rf "$DERIVED_DATA/Realm/Build/Products"*.xcframework
find "$DERIVED_DATA/Realm/Build/Products" -name 'Realm.framework' \
| sed 's/.*/-framework &/' \
| xargs xcodebuild -create-xcframework -allow-internal-distribution -output "build/$CONFIGURATION/Realm.xcframework"
find "$DERIVED_DATA/Build/Products" -name 'RealmSwift.framework' \
find "$DERIVED_DATA/Realm/Build/Products" -name 'RealmSwift.framework' \
| sed 's/.*/-framework &/' \
| xargs xcodebuild -create-xcframework -allow-internal-distribution -output "build/$CONFIGURATION/RealmSwift.xcframework"

Expand Down Expand Up @@ -648,7 +644,7 @@ case "$COMMAND" in
exit 0
;;

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

"test-ios-swiftui")
xctest 'SwiftUITestHost' -configuration "$CONFIGURATION" -sdk iphonesimulator -destination 'name=iPhone 11'
xctest 'SwiftUITestHost' -configuration "$CONFIGURATION" -sdk iphonesimulator -destination 'name=iPhone 14'
exit 0
;;

Expand All @@ -683,6 +679,16 @@ case "$COMMAND" in
exit 0
;;

"test-visionos")
xctest Realm -configuration "$CONFIGURATION" -sdk xrsimulator -destination 'platform=visionOS Simulator,name=Apple Vision Pro' CODE_SIGN_IDENTITY=''
exit 0
;;

"test-visionos-swift")
xctest RealmSwift -configuration "$CONFIGURATION" -sdk xrsimulator -destination 'platform=visionOS Simulator,name=Apple Vision Pro' CODE_SIGN_IDENTITY=''
exit 0
;;

"test-swiftuiserver-osx")
xctest 'SwiftUISyncTestHost' -configuration "$CONFIGURATION" -sdk macosx -destination 'platform=macOS'
exit 0
Expand All @@ -695,7 +701,7 @@ case "$COMMAND" in
sh build.sh verify-cocoapods
sh build.sh verify-docs
sh build.sh verify-spm-ios
sh build.sh verify-objectserver-osx
sh build.sh verify-sync
sh build.sh verify-swiftlint
sh build.sh verify-swiftpm
sh build.sh verify-watchos
Expand Down Expand Up @@ -723,15 +729,15 @@ case "$COMMAND" in
;;

"verify-cocoapods")
export REALM_TEST_BRANCH="$sha"
export REALM_TEST_BRANCH="$BRANCH"
if [[ -d .git ]]; then
# Verify the current branch, unless one was already specified in the sha environment variable.
if [[ -z $sha ]]; then
if [[ -z $BRANCH ]]; then
export REALM_TEST_BRANCH=$(git rev-parse --abbrev-ref HEAD)
fi

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

REALM_TEST_BRANCH="$sha" ./build.rb "$PLATFORM" cocoapods "$LINKAGE"
REALM_TEST_BRANCH="$BRANCH" ./build.rb "$PLATFORM" cocoapods "$LINKAGE"
;;

"verify-docs")
Expand All @@ -768,15 +774,15 @@ case "$COMMAND" in
;;

"verify-spm")
export REALM_TEST_BRANCH="$sha"
export REALM_TEST_BRANCH="$BRANCH"
if [[ -d .git ]]; then
# Verify the current branch, unless one was already specified in the sha environment variable.
if [[ -z $sha ]]; then
if [[ -z $BRANCH ]]; then
export REALM_TEST_BRANCH=$(git rev-parse --abbrev-ref HEAD)
fi

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

REALM_TEST_BRANCH="$sha" ./build.rb "$PLATFORM" spm "$LINKAGE"
exit 0
;;

"verify-objectserver-osx")
REALM_TEST_BRANCH="$sha" sh build.sh test-objectserver-osx
REALM_TEST_BRANCH="$BRANCH" ./build.rb "$PLATFORM" spm "$LINKAGE"
exit 0
;;

Expand Down Expand Up @@ -837,9 +838,7 @@ case "$COMMAND" in
sh build.sh examples-osx

(
DERIVED_EXAMPLE_DATA=${DERIVED_DATA:-examples/osx/objc/build/DerivedData/RealmExamples}

cd $DERIVED_EXAMPLE_DATA/Build/Products/$CONFIGURATION
cd examples/osx/objc/build/DerivedData/RealmExamples/Build/Products/Release
DYLD_FRAMEWORK_PATH=. ./JSONImport >/dev/null
)
exit 0
Expand Down
96 changes: 0 additions & 96 deletions ci_scripts/ci_post_clone.sh

This file was deleted.

11 changes: 0 additions & 11 deletions ci_scripts/ci_pre_xcodebuild.sh

This file was deleted.

2 changes: 1 addition & 1 deletion dependencies.list
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
VERSION=10.53.1
REALM_CORE_VERSION=v14.12.1
STITCH_VERSION=2f308db6f65333728a101d1fecbb792f9659a5ce
STITCH_VERSION=c794ec6e2b751ef0cb5ab35256b07f5fa0c74c3a
1 change: 1 addition & 0 deletions examples/installation/SubRealm/SubRealm.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Pod::Spec.new do |s|
s.osx.deployment_target = '10.15'
s.watchos.deployment_target = '5.0'
s.tvos.deployment_target = '12.0'
s.visionos.deployment_target = '1.0'
s.source_files = "*.swift"
s.dependency 'RealmSwift'
end
Loading
Loading