Merge pull request #187 from realm/al-scripts

Move ci commands to scripts - support cached npm modules
This commit is contained in:
Ari Lazier 2015-12-17 13:19:55 -08:00
commit 5860225273
5 changed files with 134 additions and 3 deletions

View File

@ -63,6 +63,20 @@
remoteGlobalIDString = 832C81801AAF6DEF007FA2F7; remoteGlobalIDString = 832C81801AAF6DEF007FA2F7;
remoteInfo = RCTVibration; remoteInfo = RCTVibration;
}; };
02002CEC1C20FB4200265A80 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0270BC9E1B7D04D700010E03 /* RealmJS.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = F63FF2F01C16405C00B3B8E0;
remoteInfo = GCDWebServers;
};
02002CEE1C20FB4200265A80 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0270BC9E1B7D04D700010E03 /* RealmJS.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = F63FF2B11C1241E500B3B8E0;
remoteInfo = "RealmJS static";
};
0270BCAE1B7D04D700010E03 /* PBXContainerItemProxy */ = { 0270BCAE1B7D04D700010E03 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy; isa = PBXContainerItemProxy;
containerPortal = 0270BC9E1B7D04D700010E03 /* RealmJS.xcodeproj */; containerPortal = 0270BC9E1B7D04D700010E03 /* RealmJS.xcodeproj */;
@ -239,6 +253,8 @@
0270BC9F1B7D04D700010E03 /* Products */ = { 0270BC9F1B7D04D700010E03 /* Products */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
02002CED1C20FB4200265A80 /* libGCDWebServers.a */,
02002CEF1C20FB4200265A80 /* libRealmJS.a */,
0270BCAF1B7D04D700010E03 /* RealmJS.framework */, 0270BCAF1B7D04D700010E03 /* RealmJS.framework */,
0270BCB11B7D04D700010E03 /* RealmJSTests.xctest */, 0270BCB11B7D04D700010E03 /* RealmJSTests.xctest */,
0270BCB31B7D04D700010E03 /* RealmReact.framework */, 0270BCB31B7D04D700010E03 /* RealmReact.framework */,
@ -504,6 +520,20 @@
remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */; remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR; sourceTree = BUILT_PRODUCTS_DIR;
}; };
02002CED1C20FB4200265A80 /* libGCDWebServers.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libGCDWebServers.a;
remoteRef = 02002CEC1C20FB4200265A80 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
02002CEF1C20FB4200265A80 /* libRealmJS.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRealmJS.a;
remoteRef = 02002CEE1C20FB4200265A80 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
0270BCAF1B7D04D700010E03 /* RealmJS.framework */ = { 0270BCAF1B7D04D700010E03 /* RealmJS.framework */ = {
isa = PBXReferenceProxy; isa = PBXReferenceProxy;
fileType = wrapper.framework; fileType = wrapper.framework;

View File

@ -6,7 +6,7 @@
"start": "react-native start" "start": "react-native start"
}, },
"dependencies": { "dependencies": {
"react-native": "^0.16.0", "react-native": "0.16.0",
"realm": "file:../../lib" "realm": "file:../../lib"
} }
} }

71
scripts/test.sh Executable file
View File

@ -0,0 +1,71 @@
#!/bin/bash
set -o pipefail
set -e
while pgrep -q Simulator; do
# Kill all the current simulator processes as they may be from a
# different Xcode version
pkill Simulator 2>/dev/null || true
# CoreSimulatorService doesn't exit when sent SIGTERM
pkill -9 Simulator 2>/dev/null || true
done
DESTINATION="-destination id=$(xcrun simctl list devices | grep -v unavailable | grep -m 1 -o '[0-9A-F\-]\{36\}')"
TARGET=$1
CONFIGURATION=${2:-"Debug"}
PACKAGER_OUT="packager_out.txt"
function start_packager()
{
rm -f $PACKAGER_OUT
sh ./node_modules/react-native/packager/packager.sh > packager_out.txt &
while :;
do
if grep -Fxq "React packager ready." packager_out.txt
then
break
else
echo "Waiting for packager."
sleep 2
fi
done
}
function kill_packager()
{
rm -f $PACKAGER_OUT
pkill node || true
}
kill_packager
if [ "$TARGET" = "realmjs" ]; then
xcodebuild -scheme RealmJS -configuration "$CONFIGURATION" -sdk iphonesimulator $DESTINATION build test
elif [ "$TARGET" = "react-tests" ]; then
pushd tests/react-test-app
if [ -f ../../target=node_modules/react_tests_node_modules.zip ]; then
unzip -q ../../target=node_modules/react_tests_node_modules.zip
fi
npm update react-native
start_packager
popd
xcodebuild -scheme RealmReact -configuration "$CONFIGURATION" -sdk iphonesimulator $DESTINATION build test
elif [ "$TARGET" = "react-example" ]; then
pushd examples/ReactExample
if [ -f ../../target=node_modules/react_example_node_modules.zip ]; then
unzip -q ../../target=node_modules/react_example_node_modules.zip
fi
npm update react-native
start_packager
xcodebuild -scheme ReactExample -configuration "$CONFIGURATION" -sdk iphonesimulator build $DESTINATION
popd
else
echo "Invalid target '${TARGET}'"
fi
kill_packager

View File

@ -71,6 +71,20 @@
remoteGlobalIDString = 13B07F861A680F5B00A75B9A; remoteGlobalIDString = 13B07F861A680F5B00A75B9A;
remoteInfo = ReactTests; remoteInfo = ReactTests;
}; };
02002CCE1C20F20B00265A80 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 027799061BBF3BB700C96559 /* RealmJS.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = F63FF2F01C16405C00B3B8E0;
remoteInfo = GCDWebServers;
};
02002CD01C20F20B00265A80 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 027799061BBF3BB700C96559 /* RealmJS.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = F63FF2B11C1241E500B3B8E0;
remoteInfo = "RealmJS static";
};
027799161BBF3BB700C96559 /* PBXContainerItemProxy */ = { 027799161BBF3BB700C96559 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy; isa = PBXContainerItemProxy;
containerPortal = 027799061BBF3BB700C96559 /* RealmJS.xcodeproj */; containerPortal = 027799061BBF3BB700C96559 /* RealmJS.xcodeproj */;
@ -241,6 +255,8 @@
027799071BBF3BB700C96559 /* Products */ = { 027799071BBF3BB700C96559 /* Products */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
02002CCF1C20F20B00265A80 /* libGCDWebServers.a */,
02002CD11C20F20B00265A80 /* libRealmJS.a */,
027799171BBF3BB700C96559 /* RealmJS.framework */, 027799171BBF3BB700C96559 /* RealmJS.framework */,
027799191BBF3BB700C96559 /* RealmJSTests.xctest */, 027799191BBF3BB700C96559 /* RealmJSTests.xctest */,
0277991B1BBF3BB700C96559 /* RealmReact.framework */, 0277991B1BBF3BB700C96559 /* RealmReact.framework */,
@ -497,6 +513,20 @@
remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */; remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR; sourceTree = BUILT_PRODUCTS_DIR;
}; };
02002CCF1C20F20B00265A80 /* libGCDWebServers.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libGCDWebServers.a;
remoteRef = 02002CCE1C20F20B00265A80 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
02002CD11C20F20B00265A80 /* libRealmJS.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRealmJS.a;
remoteRef = 02002CD01C20F20B00265A80 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
027799171BBF3BB700C96559 /* RealmJS.framework */ = { 027799171BBF3BB700C96559 /* RealmJS.framework */ = {
isa = PBXReferenceProxy; isa = PBXReferenceProxy;
fileType = wrapper.framework; fileType = wrapper.framework;
@ -587,7 +617,7 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "rm -rf ../node_modules/realm ../node_modules/realm-tests\n[ -s \"${HOME}/.nvm/nvm.sh\" ] && . \"${HOME}/.nvm/nvm.sh\"\nnpm install realm realm-tests\ncp ../../../src/object-store/parser/queryTests.json ../node_modules/realm-tests\n"; shellScript = "[ -s \"${HOME}/.nvm/nvm.sh\" ] && . \"${HOME}/.nvm/nvm.sh\" \nrm -rf ../node_modules/realm ../node_modules/realm-tests\nnpm install realm realm-tests\ncp ../../../src/object-store/parser/queryTests.json ../node_modules/realm-tests\n";
}; };
/* End PBXShellScriptBuildPhase section */ /* End PBXShellScriptBuildPhase section */

View File

@ -6,7 +6,7 @@
"start": "react-native start" "start": "react-native start"
}, },
"dependencies": { "dependencies": {
"react-native": "^0.16.0", "react-native": "0.16.0",
"realm": "file:../../lib", "realm": "file:../../lib",
"realm-tests": "file:../lib" "realm-tests": "file:../lib"
} }