Skip to content

Commit

Permalink
Merge branch 'trunk' into release/1.110.1
Browse files Browse the repository at this point in the history
# Conflicts:
#	.buildkite/commands/build-ios.sh
#	.buildkite/pipeline.yml
#	gutenberg
#	ios-xcframework/Podfile.lock
#	package-lock.json
#	package.json
  • Loading branch information
fluiddot committed Jan 23, 2024
2 parents 0929912 + 8d3f9a9 commit 1d0593a
Show file tree
Hide file tree
Showing 24 changed files with 524 additions and 335 deletions.
34 changes: 34 additions & 0 deletions .buildkite/commands/build-android.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash -eu

echo "--- :npm: Set up Node dependencies"
npm ci --unsafe-perm --prefer-offline --no-audit --no-progress

echo '--- :android: Set env var for Android E2E testing'
set -x
export TEST_RN_PLATFORM=android
export TEST_ENV=sauce
set +x

echo '--- :react: Build Android bundle for E2E testing'
npm run test:e2e:bundle:android

echo '--- :react: Build Android app for E2E testing'
npm run core test:e2e:build-app:android

WORK_DIR=$(pwd)
ARTIFACT_PATH="$WORK_DIR/gutenberg/packages/react-native-editor/android/app/build/outputs/apk/debug/app-debug.apk"

if [[ ! -f $ARTIFACT_PATH ]]; then
echo '+++ APK not found at expected path'
echo "Expected path: $ARTIFACT_PATH"
exit 1
fi

echo '--- :saucelabs: Upload app artifact to SauceLabs'
SAUCE_FILENAME=${BUILDKITE_BRANCH//[\/]/-}
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" \
--location \
--request POST 'https://api.us-west-1.saucelabs.com/v1/storage/upload' \
--form "payload=@\"$ARTIFACT_PATH\"" \
--form "name=Gutenberg-$SAUCE_FILENAME.apk" \
--form 'description="Gutenberg"'
13 changes: 8 additions & 5 deletions .buildkite/commands/build-ios.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/bash -eu

echo '--- :node: Setup Node depenendencies'
echo '--- :desktop_computer: Clear up some disk space'
rm -rfv ~/.Trash/15.1.xip

echo '--- :node: Set up Node depenendencies'
npm ci --unsafe-perm --prefer-offline --no-audit --no-progress

echo '--- :ios: Set env var for iOS E2E testing'
Expand All @@ -10,15 +13,15 @@ export TEST_ENV=sauce
# We must use a simulator that's available on the selected Xcode version
# otherwsie Xcode fallbacks to "generic destination" which requires provision
# profiles to built the Demo app.
export RN_EDITOR_E2E_IOS_DESTINATION="platform=iOS Simulator,name=iPhone 15,OS=17.2"
export RN_EDITOR_E2E_IOS_DESTINATION="platform=iOS Simulator,name=iPhone 15"
set +x

echo '--- :react: Build iOS app for E2E testing'
npm run core test:e2e:build-app:ios

echo '--- :react: Build iOS bundle for E2E testing'
npm run test:e2e:bundle:ios

echo '--- :react: Build iOS app for E2E testing'
npm run core test:e2e:build-app:ios

echo '--- :compression: Prepare artifact for SauceLabs upload'
WORK_DIR=$(pwd) \
&& pushd ./gutenberg/packages/react-native-editor/ios/build/GutenbergDemo/Build/Products/Release-iphonesimulator \
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/commands/publish-react-native-ios-artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildkite-agent artifact download ios-assets.tar.gz .
mkdir -p ios-xcframework/Gutenberg/Resources
tar -xzvf ios-assets.tar.gz -C ios-xcframework/Gutenberg/Resources/

echo '--- :node: Setup node_modules for RNReanimated'
echo '--- :node: Set up node_modules for RNReanimated'
npm ci --unsafe-perm --prefer-offline --no-audit --no-progress

echo "--- :rubygems: Setting up Gems"
Expand Down
69 changes: 69 additions & 0 deletions .buildkite/commands/test-android.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash -eu

MODE="full"
INPUT="${1-}"
while [ "$INPUT" != "" ]; do
case $INPUT in
--canary )
MODE="canary"
;;
* )
echo "Unknown option: $1"
exit 1
;;
esac
shift
INPUT="${1-}"
done

echo '--- :node: Set up Node depenendencies'
npm ci --prefer-offline --no-audit --ignore-scripts
npm ci --prefix gutenberg --prefer-offline --no-audit

echo '--- :ios: Set env var for Android E2E testing'
set -x
export TEST_RN_PLATFORM=android
export TEST_ENV=sauce
export JEST_JUNIT_OUTPUT_FILE="reports/test-results/android-test-results.xml"
# This is a relic of the CircleCI setup.
# It should be removed once the migration to Buildkite is completed.
export CIRCLE_BRANCH=${BUILDKITE_BRANCH}
set +x

if [ "$MODE" == 'canary' ]; then
SECTION='--- :saucelabs: Test Android Canary Pages'
TESTS_CMD='device-tests-canary'
else
SECTION='--- :saucelabs: Test Android'
TESTS_CMD='device-tests'
fi

set +e
echo "$SECTION"
npm run "$TESTS_CMD"
TESTS_EXIT_CODE=$?
set -e

REPORT_SECTION_NAME='🚦 Report Tests Status'
if [[ $TESTS_EXIT_CODE -eq 0 ]]; then
echo "--- $REPORT_SECTION_NAME"
echo "npm run $TESTS_CMD passed. 🎉"
else
echo "+++ $REPORT_SECTION_NAME"
echo "npm run $TESTS_CMD failed."

if ! command -v ruby ; then
echo 'Skipping test reporting because Ruby is not available on this machine.'
exit $TESTS_EXIT_CODE
fi

echo "For more details about the failed tests, check the Buildkite annotation, the logs under the '$SECTION' section and the tests results in the artifacts tab."

if [[ $BUILDKITE_BRANCH == trunk ]]; then
annotate_test_failures "$JEST_JUNIT_OUTPUT_FILE" --slack "build-and-ship"
else
annotate_test_failures "$JEST_JUNIT_OUTPUT_FILE"
fi

exit $TESTS_EXIT_CODE
fi
8 changes: 7 additions & 1 deletion .buildkite/commands/test-ios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ while [ "$INPUT" != "" ]; do
INPUT="${1-}"
done

echo '--- :node: Setup Node depenendencies'
echo '--- :node: Set up Node depenendencies'
npm ci --prefer-offline --no-audit --ignore-scripts
npm ci --prefix gutenberg --prefer-offline --no-audit

Expand Down Expand Up @@ -57,6 +57,12 @@ if [[ $TESTS_EXIT_CODE -eq 0 ]]; then
else
echo "+++ $REPORT_SECTION_NAME"
echo "npm run $TESTS_CMD failed."

if ! command -v ruby ; then
echo 'Skipping test reporting because Ruby is not available on this machine.'
exit $TESTS_EXIT_CODE
fi

echo "For more details about the failed tests, check the Buildkite annotation, the logs under the '$SECTION' section and the tests results in the artifacts tab."

if [[ $BUILDKITE_BRANCH == trunk ]]; then
Expand Down
30 changes: 29 additions & 1 deletion .buildkite/commands/unit-tests-android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,33 @@
echo "--- :npm: Install Node dependencies"
npm ci --unsafe-perm --prefer-offline --no-audit --no-progress

echo "--- :node: Lint and Unit Tests"
SECTION='--- :node: Android Unit Tests'
set +e
echo "$SECTION"
CHECK_CORRECTNESS=false CHECK_TESTS=true TEST_RN_PLATFORM=android ./bin/ci-checks-js.sh
TESTS_EXIT_CODE=$?
set -e

REPORT_SECTION_NAME='🚦 Report Tests Status'
if [[ $TESTS_EXIT_CODE -eq 0 ]]; then
echo "--- $REPORT_SECTION_NAME"
echo "Android tests passed. 🎉"
else
echo "+++ $REPORT_SECTION_NAME"
echo "Android tests failed."

if ! command -v ruby ; then
echo 'Skipping test reporting because Ruby is not available on this machine.'
exit $TESTS_EXIT_CODE
fi

echo "For more details about the failed tests, check the Buildkite annotation, the logs under the '$SECTION' section and the tests results in the artifacts tab."

if [[ $BUILDKITE_BRANCH == trunk ]]; then
annotate_test_failures "$JEST_JUNIT_OUTPUT_FILE" --slack "build-and-ship"
else
annotate_test_failures "$JEST_JUNIT_OUTPUT_FILE"
fi

exit $TESTS_EXIT_CODE
fi
30 changes: 29 additions & 1 deletion .buildkite/commands/unit-tests-ios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,33 @@
echo "--- :npm: Install Node dependencies"
npm ci --unsafe-perm --prefer-offline --no-audit --no-progress

echo "--- :node: Lint and Unit Tests"
SECTION='--- :node: iOS Unit Tests'
set +e
echo "$SECTION"
CHECK_CORRECTNESS=false CHECK_TESTS=true TEST_RN_PLATFORM=ios ./bin/ci-checks-js.sh
TESTS_EXIT_CODE=$?
set -e

REPORT_SECTION_NAME='🚦 Report Tests Status'
if [[ $TESTS_EXIT_CODE -eq 0 ]]; then
echo "--- $REPORT_SECTION_NAME"
echo "iOS tests passed. 🎉"
else
echo "+++ $REPORT_SECTION_NAME"
echo "iOS tests failed."

if ! command -v ruby ; then
echo 'Skipping test reporting because Ruby is not available on this machine.'
exit $TESTS_EXIT_CODE
fi

echo "For more details about the failed tests, check the Buildkite annotation, the logs under the '$SECTION' section and the tests results in the artifacts tab."

if [[ $BUILDKITE_BRANCH == trunk ]]; then
annotate_test_failures "$JEST_JUNIT_OUTPUT_FILE" --slack "build-and-ship"
else
annotate_test_failures "$JEST_JUNIT_OUTPUT_FILE"
fi

exit $TESTS_EXIT_CODE
fi
Loading

0 comments on commit 1d0593a

Please sign in to comment.