diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml new file mode 100644 index 0000000000..af255359c4 --- /dev/null +++ b/.buildkite/pipeline.yml @@ -0,0 +1,32 @@ +steps: + - label: "Bundle Android" + key: "bundle-android" + plugins: + - docker#v3.8.0: + image: "public.ecr.aws/automattic/gb-mobile-image:latest" + environment: + - "CI=true" + command: | + source /root/.bashrc + + pushd gutenberg && nvm install && nvm use && popd + npm ci --unsafe-perm --prefer-offline --no-audit --no-progress + + npm run prebundle:js + npm run bundle:android + + buildkite-agent artifact upload bundle/android/App.js + + - label: "Build Android RN Bridge & Publish to S3" + depends_on: "bundle-android" + plugins: + - docker#v3.8.0: + image: "public.ecr.aws/automattic/android-build-image:v1.0.0" + propagate-environment: true + environment: + # DO NOT MANUALLY SET THESE VALUES! + # They are passed from the BuildKite agent to the Docker container + - "AWS_ACCESS_KEY" + - "AWS_SECRET_KEY" + command: | + .buildkite/publish-android-artifacts.sh diff --git a/.buildkite/publish-android-artifacts.sh b/.buildkite/publish-android-artifacts.sh new file mode 100755 index 0000000000..0a6ebc588b --- /dev/null +++ b/.buildkite/publish-android-artifacts.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -euo pipefail + +buildkite-agent artifact download bundle/android/App.js . +mkdir -p gutenberg/packages/react-native-bridge/android/react-native-bridge/build/assets +cp ./bundle/android/App.js ./gutenberg/packages/react-native-bridge/android/react-native-bridge/build/assets/index.android.bundle + +pushd ./gutenberg/packages/react-native-aztec/android +./gradlew -PwillPublishReactNativeAztecBinary=true :prepareToPublishToS3 `prepare_to_publish_to_s3_params` :publish +PUBLISHED_AZTEC_VERSION=`cat ./build/published-version.txt` +echo "PUBLISHED_AZTEC_VERSION: $PUBLISHED_AZTEC_VERSION" +popd + +pushd ./gutenberg/packages/react-native-bridge/android +./gradlew -PwillPublishReactNativeBridgeBinary=true -PreactNativeAztecVersion="$PUBLISHED_AZTEC_VERSION" :react-native-bridge:prepareToPublishToS3 `prepare_to_publish_to_s3_params` :react-native-bridge:publish diff --git a/.circleci/config.yml b/.circleci/config.yml index af85ad7d97..47b3d94cde 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -314,101 +314,6 @@ jobs: include_job_number_field: false include_project_field: false failure_message: ':red_circle: Scheduled tests failed on iOS device!' - android-build-and-publish-react-native-bridge: - # This job builds the JS bunle required by the Android version of the - # react-native-bridge package, builds the AAR for that package, and uploads - # it to S3. - # - # Running on a Ubuntu machine to have more memory compared to the Docker + - # Node or Docker + Android images that CircleCI offers (circleci/node) - # - # Also running all in one job so that we can bail out early under cetrain - # conditions and save CI cycles. - # - # See: https://github.com/wordpress-mobile/gutenberg-mobile/pull/3038#issuecomment-765334675 - machine: - image: << pipeline.parameters.linux-machine-image >> - steps: - - run: - name: Evaluate whether to run - command: | - # This is a partial duplication of the logic to compute the version - # to use for the AAR from below. It's useful to have it here - # because there are conditions under which we shouldn't run the job - # that can't be captured in a CircleCI filter. - # - # Exiting here saves a non-trivial amount of CI time because of how - # heavy the repo is to checkout (it takes at least 1 minute) and - # how time consuming running `npm ci` is. - if [[ -z ${CIRCLE_TAG+x} ]]; then - if [[ -n "$CIRCLE_PULL_REQUEST" ]]; then - echo "Build initiated from a branch with a pull request: proceeding..." - elif [[ $CIRCLE_BRANCH == "develop" ]]; then - echo "Build initiated on $CIRCLE_BRANCH: proceeding..." - else - # We end up here on the first push of a new branch, when there - # isn't a PR open for it yet. - echo "Build initiated from a feature branch with no pull request: aborting." - circleci-agent step halt - fi - else - echo "Build initiated from a tag: proceeding..." - fi - - checkout-shallow - - checkout-submodules - - run: - # Setting up Android before fetching the Node dependencies because - # this step is faster, so if it fails we'll learn about it sooner and - # avoid wasting cycles. - name: Setup Android Tooling - command: .circleci/setup-android-on-ubuntu.sh - - npm-install - - run: - name: Build JavaScript Bundle - command: | - npm run prebundle:js - npm run bundle:android - # The job can take a long time, so let's bump the no_output_timeout - # to more than the default 10m - no_output_timeout: 20m - - run: - name: Build React Native Bridge & Upload to S3 - environment: - # This value is set in the setup script, but I'm not sure whether - # it's available after executing it - ANDROID_SDK_ROOT: /usr/lib/android-sdk - command: | - # We publish from PRs as well as the main branch and tags to help - # developers to iterate faster. - # - # If we're not on a PR but a merge commit on the develop branch the - # version will be the "develop-" followed by the commit SHA1. - # - # On a tag, the version should be the tag value. - # - # If we're on a different branch that has no open PR, we should - # not build and exit early instead. - if [[ -z "${CIRCLE_TAG+x}" ]]; then - if [[ -n "$CIRCLE_PULL_REQUEST" ]]; then - PR_NUMBER=$(basename $CIRCLE_PULL_REQUEST) - # CIRCLE_SHA1 should always be available. - VERSION="$PR_NUMBER-$CIRCLE_SHA1" - elif [[ $CIRCLE_BRANCH == "develop" ]]; then - VERSION="$CIRCLE_BRANCH-$CIRCLE_SHA1" - else - # This happens on the first push of a new branch, when there - # isn't a PR open for it yet. - echo "Running on a feature branch with no open PR." - echo "The checks previous to this step should not have let this happen." - exit 1 - fi - else - VERSION=$CIRCLE_TAG - fi - - cd gutenberg/packages/react-native-bridge/android - - ./publish-aztec-and-bridge.sh $VERSION workflows: gutenberg-mobile: @@ -457,15 +362,6 @@ workflows: filters: branches: only: /^dependabot/submodules/.*/ - - android-build-and-publish-react-native-bridge: - name: Build Android RN Bridge & Publish to S3 - filters: - branches: - # Don't run on trunk, otherwise, run on every other branch - ignore: trunk - tags: - # Run for every tag - only: /.*/ ui-tests-full-scheduled: jobs: diff --git a/gutenberg b/gutenberg index 5c5ff4dda4..e5b387b19f 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit 5c5ff4dda48293e2803eeffdcce739e0dca12e56 +Subproject commit e5b387b19ffc50555f52ea5f0b415ab846896def