Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Buildkite integration with publish to s3 plugin #3733

Merged
merged 38 commits into from
Jul 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
d702eae
BuildKite integration for 'Build React Native Bridge & Upload to S3'
oguzkocer Jun 11, 2021
dd0751b
Update gb hash that removes submodule check for android artifacts
oguzkocer Jun 13, 2021
f4130c8
Fix publish-aztec-and-bridge version name in buildkite
oguzkocer Jun 13, 2021
14e2d8f
Npm ci prefer offline
oguzkocer Jun 15, 2021
b7f2762
Only run npm actions in BuildKite
oguzkocer Jun 15, 2021
3f98af7
Publish android artifacts from BuildKite
oguzkocer Jun 15, 2021
b8dd4e0
Update gutenberg hash that removes copy bundle step for react-native-…
oguzkocer Jun 15, 2021
4b66a74
Update BuildKite to a multi-step process
oguzkocer Jun 15, 2021
41f6def
Add dependency between BuildKite steps
oguzkocer Jun 15, 2021
e001199
Pass AWS access and secret key to Docker container in BuildKite
oguzkocer Jun 15, 2021
a6054bd
Update Gutenberg hash which temporarily fixes how gradle deps are res…
oguzkocer Jun 15, 2021
80d6afe
Adds date to publish to S3 tasks in CircleCI and BuildKite
oguzkocer Jun 16, 2021
61377a6
Merge remote-tracking branch 'origin/develop' into add/buildkite
oguzkocer Jul 1, 2021
6f8f24a
Update Gutenberg hash which contains Android build improvements
oguzkocer Jul 1, 2021
89d2941
Publish android artifacts script moved to gutenberg-mobile
oguzkocer Jul 1, 2021
0bd890d
Rebase gutenberg and update package.json files
oguzkocer Jul 1, 2021
a44d08e
Add CI environment variable to BuildKite
oguzkocer Jul 1, 2021
4afa48a
Manually reset package.json and gutenberg submodule to origin/develop
oguzkocer Jul 1, 2021
849c650
Update Android image for Buildkite
oguzkocer Jul 1, 2021
ae7644e
Update Gutenberg hash which fixes node_modules check in react-native-…
oguzkocer Jul 1, 2021
3c08261
Update kotlin to 1.5.20 in Android projects
oguzkocer Jul 1, 2021
777002b
Fix where the android bundle is copied during Buildkite publishing
oguzkocer Jul 13, 2021
d5edb4d
Update react-native-bridge artifact id to react-native-gutenberg-bridge
oguzkocer Jul 13, 2021
e74df6e
Merge remote-tracking branch 'origin/develop' into improve-android-pr…
oguzkocer Jul 13, 2021
56132d6
Remove publish-aztec-and-bridge.sh from Gutenberg repo
oguzkocer Jul 15, 2021
e5d681c
Simplify nvm use in Buildkite pipeline
oguzkocer Jul 17, 2021
a47e2ea
Adds prepare_to_publish_to_s3 params
oguzkocer Jul 17, 2021
54efc62
Use prepare_to_publish_to_s3 script and publish the correct Android v…
oguzkocer Jul 17, 2021
21a94c2
Update android docker image for Buildkite
oguzkocer Jul 20, 2021
1af05c8
Update both Docker images in Buildkite
oguzkocer Jul 20, 2021
cc3a1e0
Re-add AWS_ACCESS_KEY & AWS_SECRET_KEY to Buildkite Docker
oguzkocer Jul 20, 2021
7d1c1e4
Merge remote-tracking branch 'origin/develop' into add/buildkite-inte…
oguzkocer Jul 20, 2021
43cd60a
Removes Android artifact publishing from CircleCI
oguzkocer Jul 20, 2021
bdaff13
Update publish-to-s3 plugin and move Buildkite android publishing to …
oguzkocer Jul 20, 2021
9e56603
Revert prepare_to_publish_to_s3_params change in .buildkite/publish-a…
oguzkocer Jul 20, 2021
15762e9
Update Docker images in Buildkite to production versions
oguzkocer Jul 20, 2021
39c0934
Rebase gutenberg against 5c5ff4dda48293e2803eeffdcce739e0dca12e56 and…
oguzkocer Jul 21, 2021
8991d5b
Update gutenberg submodule ref
mchowning Jul 22, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions .buildkite/publish-android-artifacts.sh
Original file line number Diff line number Diff line change
@@ -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
104 changes: 0 additions & 104 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion gutenberg
Submodule gutenberg updated 244 files