Skip to content

Commit

Permalink
Apply artifacts packing in demo-projects' CI (prep for AWS upload)
Browse files Browse the repository at this point in the history
  • Loading branch information
d4vidi committed Dec 22, 2019
1 parent 257f854 commit 06e85d2
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ detox/ios_src
package-lock.json
/detox/src/devices/detox/notifications/notification.json
detox/test/artifacts
/examples/demo-react-native/artifacts
/examples/demo-react-native-jest/artifacts

## Final outputs

Expand Down
4 changes: 2 additions & 2 deletions examples/demo-react-native-jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"test:jest-circus:ios-release": "detox test --configuration ios.sim.release -l verbose -o e2e/config-circus.json",
"test:jest-circus:ios-release-ci": "detox test --configuration ios.sim.release -l verbose -o e2e/config-circus.json --workers 2",
"test:android-release": "detox test --configuration android.emu.release",
"test:android-release-ci": "detox test --configuration android.emu.release -l verbose --workers 2 --headless",
"test:android-release-ci": "detox test --configuration android.emu.release -l verbose --workers 2 --headless --record-logs all --take-screenshots all",
"test:jest-circus:android-release": "detox test --configuration android.emu.release -o e2e/config-circus.json",
"test:jest-circus:android-release-ci": "detox test --configuration android.emu.release -o e2e/config-circus.json -l verbose --workers 2 --headless"
"test:jest-circus:android-release-ci": "detox test --configuration android.emu.release -o e2e/config-circus.json -l verbose --workers 2 --headless --record-logs all --take-screenshots all"
},
"devDependencies": {
"detox": "^14.9.1",
Expand Down
4 changes: 2 additions & 2 deletions examples/demo-react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"test:ios": "detox test --configuration ios.sim.debug",
"test:android-debug": "detox test --configuration android.emu.debug",
"test:android-release": "detox test --configuration android.emu.release",
"test:android-release-ci": "detox test --configuration android.emu.release -l verbose --headless",
"test:android-release-ci": "detox test --configuration android.emu.release -l verbose --headless --record-logs all --take-screenshots all",
"test:android-explicit-require": "detox test e2eExplicitRequire -c android.emu.release --runner-config e2eExplicitRequire/mocha.opts",
"test:android-explicit-require-ci": "detox test e2eExplicitRequire -c android.emu.release --runner-config e2eExplicitRequire/mocha.opts -l verbose --headless",
"test:android-explicit-require-ci": "detox test e2eExplicitRequire -c android.emu.release --runner-config e2eExplicitRequire/mocha.opts -l verbose --headless --record-logs all --take-screenshots all",
"e2e:ios": "npm run build:ios && npm run test:ios",
"e2e:android-debug": "npm run build:android-debug && npm run test:android-debug",
"e2e:android-release": "npm run build:android-release && npm run test:android-release"
Expand Down
37 changes: 24 additions & 13 deletions scripts/upload_artifact.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,32 @@ export AWS_SECRET_ACCESS_KEY=$AWS_ACCESS_SECRET

DATE=`date '+%Y-%m-%d_%H-%M-%S'`

if [ $JENKINS_CI ]; then
ARTIFACTS_NAME="artifacts_${BUILD_ID}_${DATE}.tar.gz"
else
ARTIFACTS_NAME="artifacts_${TRAVIS_BUILD_ID}_${DATE}.tar.gz"
fi

if [ -d "detox/test/artifacts" ]; then
tar cvzf ${ARTIFACTS_NAME} ./detox/test/artifacts/
upload_artifacts() {
ARTIFACTS_DIR=$1
CONTEXT=$2

if [ $JENKINS_CI ]; then
echo "Jenkins has build in plugin"
ARTIFACTS_NAME="artifacts_${CONTEXT}_${BUILD_ID}_${DATE}.tar.gz"
else
aws s3 cp ${ARTIFACTS_NAME} s3://detox-artifacts/ --region=us-east-1
ARTIFACTS_NAME="artifacts_${CONTEXT}_${TRAVIS_BUILD_ID}_${DATE}.tar.gz"
fi

if [ -d "$ARTIFACTS_DIR" ]; then
echo "Packing artifacts..."
tar cvzf "${ARTIFACTS_NAME}" ./detox/test/artifacts/

if [ $JENKINS_CI ]; then
echo "Upload: Jenkins will upload using built-in plugin"
else
echo "Uploading artifacts..."
aws s3 cp "${ARTIFACTS_NAME}" s3://detox-artifacts/ --region=us-east-1
fi

echo "The artifacts archive is available for download at:"
echo "https://detox-artifacts.s3.amazonaws.com/${ARTIFACTS_NAME}"
fi
}

echo "The artifacts archive is available for download at:"
echo "https://detox-artifacts.s3.amazonaws.com/${ARTIFACTS_NAME}"
fi
upload_artifacts "detox/test/artifacts" "detoxtest"
upload_artifacts "examples/demo-react-native/artifacts" "rnexample"
upload_artifacts "examples/demo-react-native-jest/artifacts" "rnexamplejest"

0 comments on commit 06e85d2

Please sign in to comment.