-
Notifications
You must be signed in to change notification settings - Fork 301
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add automation to run code freeze in CI (#1688)
- Loading branch information
Showing
54 changed files
with
757 additions
and
407 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash -eu | ||
|
||
# We expect BUILDKITE_RELEASE_VERSION to be as an environment variable, e.g. by the automation that triggers the build on Buildkite. | ||
# It must use the `BUILDKITE_` prefix to be passed to the agent due to how `hostmgr` works, in case this runs on a Mac agents. | ||
if [[ -z "${BUILDKITE_RELEASE_VERSION}" ]]; then | ||
echo "BUILDKITE_RELEASE_VERSION is not set." | ||
exit 1 | ||
fi | ||
|
||
# Buildkite, by default, checks out a specific commit. | ||
# For many release actions, we need to be on a release branch instead. | ||
BRANCH_NAME="release/${BUILDKITE_RELEASE_VERSION}" | ||
git fetch origin "$BRANCH_NAME" | ||
git checkout "$BRANCH_NAME" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash -eu | ||
|
||
echo "--- :rubygems: Setting up Gems" | ||
install_gems | ||
|
||
echo "--- :closed_lock_with_key: Installing Secrets" | ||
bundle exec fastlane run configure_apply | ||
|
||
echo "--- :hammer_and_wrench: Building app" | ||
bundle exec fastlane build_for_distribution | ||
|
||
echo "--- :computer: Use deterministic APK name for next steps" | ||
|
||
OUTPUT_DIR="build" | ||
if [ "$(find "$OUTPUT_DIR/*.apk" | wc -l)" -gt 1 ]; then | ||
echo "Found more than one APK in $OUTPUT_DIR." | ||
exit 1 | ||
fi | ||
|
||
ORIGINAL_APK_PATH=$(ls -1 "$OUTPUT_DIR/*.apk") | ||
|
||
set -x | ||
mv "$ORIGINAL_APK_PATH" $OUTPUT_DIR/simplenote.apk | ||
set +x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash -eu | ||
|
||
echo "--- :arrow_down: Downloading Artifacts" | ||
ARTIFACT_PATH='build/simplenote.apk' # Must be the same as release-build.sh | ||
STEP=build | ||
buildkite-agent artifact download "$ARTIFACT_PATH" . --step $STEP | ||
|
||
echo "--- :rubygems: Setting up Gems" | ||
install_gems | ||
|
||
echo "--- :closed_lock_with_key: Installing Secrets" | ||
bundle exec fastlane run configure_apply | ||
|
||
echo "--- :android: Upload to Play Store" | ||
bundle exec fastlane create_release_on_github \ | ||
apk_path:"$ARTIFACT_PATH" \ | ||
"beta:${1:-true}" # use first call param, default to true for safety |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash -eu | ||
|
||
echo "--- :arrow_down: Downloading Artifacts" | ||
ARTIFACT_PATH='build/simplenote.apk' # Must be the same as release-build.sh | ||
STEP=build | ||
buildkite-agent artifact download "$ARTIFACT_PATH" . --step $STEP | ||
|
||
echo "--- :rubygems: Setting up Gems" | ||
install_gems | ||
|
||
echo "--- :closed_lock_with_key: Installing Secrets" | ||
bundle exec fastlane run configure_apply | ||
|
||
echo "--- :android: Upload to Play Store" | ||
bundle exec fastlane upload_build_to_play_store \ | ||
apk_path:"$ARTIFACT_PATH/simplenote.apk" \ | ||
"beta:${1:-true}" # use first call param, default to true for safety |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,50 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json | ||
--- | ||
|
||
# Nodes with values to reuse in the pipeline. | ||
common_params: | ||
# Common plugin settings to use with the `plugins` key. | ||
- &common_plugins | ||
- automattic/a8c-ci-toolkit#2.13.0 | ||
|
||
agents: | ||
queue: "android" | ||
queue: android | ||
|
||
# This is the default pipeline – it will build and test the app | ||
steps: | ||
- label: "Gradle Wrapper Validation" | ||
command: | | ||
validate_gradle_wrapper | ||
plugins: *common_plugins | ||
- label: ":gradle: Gradle Wrapper Validation" | ||
command: validate_gradle_wrapper | ||
plugins: [$CI_TOOLKIT_PLUGIN] | ||
notify: | ||
- github_commit_status: | ||
context: Gradle Wrapper Validation | ||
|
||
# Wait for Gradle Wrapper to be validated before running any other jobs | ||
- wait | ||
|
||
- label: "🛠 Build and Test" | ||
- label: ":hammer_and_pick: Build and Test" | ||
command: ./gradlew --stacktrace testRelease | ||
plugins: *common_plugins | ||
plugins: [$CI_TOOLKIT_PLUGIN] | ||
notify: | ||
- github_commit_status: | ||
context: Build and Test | ||
|
||
- label: "☢️ Danger - PR Check" | ||
- label: ":radioactive_sign: Danger - PR Check" | ||
command: danger | ||
key: danger | ||
if: "build.pull_request.id != null" | ||
retry: | ||
manual: | ||
permit_on_passed: true | ||
agents: | ||
queue: "linter" | ||
queue: linter | ||
notify: | ||
- github_commit_status: | ||
context: Danger - PR Check | ||
|
||
- label: "🔬 Lint" | ||
- label: ":microscope: Lint" | ||
command: ./gradlew --stacktrace lintRelease | ||
plugins: *common_plugins | ||
plugins: [$CI_TOOLKIT_PLUGIN] | ||
notify: | ||
- github_commit_status: | ||
context: Lint | ||
|
||
- label: "🛠 Prototype Build" | ||
- label: ":hammer_and_pick: Prototype Build" | ||
command: .buildkite/commands/build-prototype.sh | ||
plugins: *common_plugins | ||
plugins: [$CI_TOOLKIT_PLUGIN] | ||
if: "build.pull_request.id != null || build.pull_request.draft" | ||
notify: | ||
- github_commit_status: | ||
context: Prototype Build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json | ||
--- | ||
|
||
# This pipeline is meant to be run via the Buildkite API, and is only used for release builds | ||
|
||
agents: | ||
queue: android | ||
|
||
steps: | ||
- label: ":gradle: Gradle Wrapper Validation" | ||
command: validate_gradle_wrapper | ||
priority: 1 | ||
plugins: [$CI_TOOLKIT_PLUGIN] | ||
|
||
- wait | ||
|
||
- label: ":hammer_and_pick: Build" | ||
key: build | ||
command: .buildkite/commands/release-build.sh | ||
priority: 1 | ||
plugins: [$CI_TOOLKIT_PLUGIN] | ||
artifact_paths: ["build/*.apk"] | ||
notify: | ||
- slack: "#build-and-ship" | ||
|
||
- label: ":android: Upload to Play Store" | ||
depends_on: build | ||
key: upload_play_store | ||
command: .buildkite/commands/release-upload.sh $BETA_RELEASE | ||
priority: 1 | ||
plugins: [$CI_TOOLKIT_PLUGIN] | ||
notify: | ||
- slack: "#build-and-ship" | ||
|
||
- label: ":github: Create GitHub relaese" | ||
depends_on: upload_play_store | ||
command: .buildkite/commands/release-create-on-github.sh $BETA_RELEASE | ||
priority: 1 | ||
plugins: [$CI_TOOLKIT_PLUGIN] | ||
notify: | ||
- slack: "#build-and-ship" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json | ||
--- | ||
|
||
# Variables used in this pipeline are defined in `shared-pipeline-vars`, which is `source`'d before calling `buildkite-agent pipeline upload` | ||
|
||
agents: | ||
queue: tumblr-metal | ||
|
||
steps: | ||
- label: Complete Code Freeze | ||
key: complete_code_freeze | ||
plugins: [$CI_TOOLKIT_PLUGIN] | ||
command: | | ||
echo '--- :robot_face: Use bot for Git operations' | ||
source use-bot-for-git wpmobilebot | ||
echo '--- :git: Checkout release branch' | ||
.buildkite/commands/checkout-release-branch.sh | ||
echo '--- :ruby: Set up Ruby Tools' | ||
install_gems | ||
echo '--- :closed_lock_with_key: Access secrets' | ||
bundle exec fastlane run configure_apply | ||
echo '--- :shipit: Complete code freeze' | ||
bundle exec fastlane complete_code_freeze skip_confirm:true | ||
retry: | ||
manual: | ||
# If failed, we prefer retrying via ReleaseV2 rather than Buildkite. | ||
# Rationale: ReleaseV2 is the source of truth for the process and track links to the various builds. | ||
allowed: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json | ||
--- | ||
|
||
# Variables used in this pipeline are defined in `shared-pipeline-vars`, which is `source`'d before calling `buildkite-agent pipeline upload` | ||
|
||
steps: | ||
- label: Start Code Freeze | ||
plugins: | ||
- $CI_TOOLKIT_PLUGIN | ||
agents: | ||
queue: tumblr-metal | ||
command: | | ||
echo '--- :robot_face: Use bot for Git operations' | ||
source use-bot-for-git wpmobilebot | ||
echo '--- :ruby: Setup Ruby Tools' | ||
install_gems | ||
echo '--- :shipit: Start code freeze' | ||
bundle exec fastlane start_code_freeze skip_confirm:true | ||
retry: | ||
manual: | ||
# If failed, we prefer retrying via ReleaseV2 rather than Buildkite. | ||
# Rationale: ReleaseV2 is the source of truth for the process and track links to the various builds. | ||
allowed: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
|
||
# This file is `source`'d before calling `buildkite-agent pipeline upload`, and can be used | ||
# to set up some variables that will be interpolated in the `.yml` pipeline before uploading it. | ||
|
||
export CI_TOOLKIT_PLUGIN_VERSION="3.5.1" | ||
|
||
export CI_TOOLKIT_PLUGIN="automattic/a8c-ci-toolkit#$CI_TOOLKIT_PLUGIN_VERSION" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.