Skip to content

Commit

Permalink
github actions pull request testing
Browse files Browse the repository at this point in the history
  • Loading branch information
tgoyne committed Sep 11, 2024
1 parent c21605e commit 7da3f05
Show file tree
Hide file tree
Showing 8 changed files with 593 additions and 882 deletions.
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.

56 changes: 30 additions & 26 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 @@ -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 @@ -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 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,12 @@ case "$COMMAND" in
PLATFORM=$(echo "$COMMAND" | cut -d - -f 3)
cd examples/installation

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

"verify-objectserver-osx")
REALM_TEST_BRANCH="$sha" sh build.sh test-objectserver-osx
REALM_TEST_BRANCH="$BRANCH" sh build.sh test-objectserver-osx
exit 0
;;

Expand Down Expand Up @@ -837,9 +843,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
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.

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

0 comments on commit 7da3f05

Please sign in to comment.