-
Notifications
You must be signed in to change notification settings - Fork 844
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into storybook/7646-v8-upgrade
- Loading branch information
Showing
111 changed files
with
3,878 additions
and
2,729 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 |
---|---|---|
@@ -1,7 +1,111 @@ | ||
agents: | ||
provider: gcp | ||
machineType: 'n2-standard-2' | ||
preemptible: true | ||
|
||
steps: | ||
- command: "echo 'This pipeline is currently a no-op'" | ||
label: ':shrug: noop' | ||
- group: ':hammer: Unit and static tests' | ||
key: 'unit-static-tests' | ||
steps: | ||
- label: ':typescript: Linting' | ||
command: '.buildkite/scripts/pipelines/pipeline_test.sh' | ||
env: | ||
TEST_TYPE: 'lint' | ||
agents: | ||
machineType: 'n1-standard-1' | ||
timeout_in_minutes: 15 | ||
retry: | ||
automatic: | ||
- exit_status: '-1' | ||
limit: 1 | ||
- label: ':jest: TS unit tests' | ||
command: '.buildkite/scripts/pipelines/pipeline_test.sh' | ||
env: | ||
TEST_TYPE: 'unit:ts' | ||
agents: | ||
machineType: 'n1-standard-1' | ||
timeout_in_minutes: 60 | ||
retry: | ||
automatic: | ||
- exit_status: '-1' | ||
limit: 1 | ||
- label: ':jest: TSX unit tests on React 16' | ||
command: '.buildkite/scripts/pipelines/pipeline_test.sh' | ||
env: | ||
TEST_TYPE: 'unit:tsx:16' | ||
timeout_in_minutes: 60 | ||
retry: | ||
automatic: | ||
- exit_status: '-1' | ||
limit: 1 | ||
- label: ':jest: TSX unit tests on React 17' | ||
command: '.buildkite/scripts/pipelines/pipeline_test.sh' | ||
env: | ||
TEST_TYPE: 'unit:tsx:17' | ||
timeout_in_minutes: 60 | ||
retry: | ||
automatic: | ||
- exit_status: '-1' | ||
limit: 1 | ||
- label: ':jest: TSX unit tests on React 18' | ||
command: '.buildkite/scripts/pipelines/pipeline_test.sh' | ||
env: | ||
TEST_TYPE: 'unit:tsx' | ||
timeout_in_minutes: 60 | ||
retry: | ||
automatic: | ||
- exit_status: '-1' | ||
limit: 1 | ||
- group: ':hammer: E2E component tests' | ||
key: 'e2e-tests' | ||
steps: | ||
- label: ':cypress: Cypress tests on React 16' | ||
command: '.buildkite/scripts/pipelines/pipeline_test.sh' | ||
env: | ||
TEST_TYPE: 'cypress:16' | ||
artifact_paths: | ||
- 'cypress/screenshots/**/*.png' | ||
- 'cypress/videos/**/*.mp4' | ||
timeout_in_minutes: 60 | ||
retry: | ||
automatic: | ||
- exit_status: '-1' | ||
limit: 1 | ||
- label: ':cypress: Cypress tests on React 17' | ||
command: '.buildkite/scripts/pipelines/pipeline_test.sh' | ||
env: | ||
TEST_TYPE: 'cypress:17' | ||
artifact_paths: | ||
- 'cypress/screenshots/**/*.png' | ||
- 'cypress/videos/**/*.mp4' | ||
timeout_in_minutes: 60 | ||
retry: | ||
automatic: | ||
- exit_status: '-1' | ||
limit: 1 | ||
- label: ':cypress: Cypress tests on React 18' | ||
command: '.buildkite/scripts/pipelines/pipeline_test.sh' | ||
env: | ||
TEST_TYPE: 'cypress:18' | ||
artifact_paths: | ||
- 'cypress/screenshots/**/*.png' | ||
- 'cypress/videos/**/*.mp4' | ||
timeout_in_minutes: 60 | ||
retry: | ||
automatic: | ||
- exit_status: '-1' | ||
limit: 1 | ||
- wait | ||
- label: ':npm: Update version, build and publish package' | ||
key: 'update-build-and-publish' | ||
commands: | ||
- .buildkite/scripts/release/step_update_version.sh | ||
- .buildkite/scripts/release/step_build.sh | ||
- .buildkite/scripts/release/step_commit_and_publish.sh | ||
agents: | ||
provider: gcp | ||
# TODO: remove the test-automatic-releases condition when the pipeline is production-ready | ||
if: build.branch == "main" || build.branch == "build/test-automatic-releases" | ||
image: 'docker.elastic.co/ci-agent-images/eui/basic-buildkite-agent:latest' | ||
provider: k8s | ||
ephemeralStorage: '20G' | ||
cpu: '4000m' | ||
memory: '8G' | ||
if: build.branch != "main" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
# Build EUI and publish to npm | ||
|
||
set -eo pipefail | ||
|
||
# include utils | ||
source .buildkite/scripts/common/utils.sh | ||
|
||
echo "+++ :yarn: Installing dependencies" | ||
yarn | ||
|
||
echo "+++ :yarn: Building @elastic/eui" | ||
yarn build | ||
|
||
echo "+++ :yarn: Built @elastic/eui" |
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,111 @@ | ||
#!/bin/bash | ||
# Commit changes to upstream git repository and publish built package to npmjs | ||
|
||
set -eo pipefail | ||
|
||
git_remote_name="origin" | ||
git_branch="${BUILDKITE_BRANCH}" | ||
npm_version=$(jq -r '.version' package.json) | ||
|
||
## | ||
# Configure git | ||
## | ||
|
||
# Get Sigstore OIDC token for commit signing | ||
echo "Fetching OIDC token to sign the commit" | ||
SIGSTORE_ID_TOKEN="$(buildkite-agent oidc request-token --audience sigstore)" | ||
|
||
# Set commit user details | ||
github_user_vault="secret/ci/elastic-eui/github_machine_user" | ||
git config --local user.name "$(retry 5 vault read -field=name "${github_user_vault}")" | ||
git config --local user.email "$(retry 5 vault read -field=email "${github_user_vault}")" | ||
|
||
# Enable signing of commits and tags | ||
git config --local commit.gpgsign true | ||
git config --local tag.gpgsign true | ||
git config --local gpg.x509.program gitsign | ||
git config --local gpg.format x509 | ||
|
||
## | ||
# Check if version isn't already published if RELEASE_VERSION is set | ||
## | ||
|
||
echo "+++ :npm: Checking npm registry" | ||
if [[ "$(npm show @elastic/eui versions --json | jq 'index("${npm_version}")')" != "null" ]]; then | ||
>&2 echo "Version ${npm_version} has already been published to npm and can't be overridden:" | ||
>&2 echo "https://www.npmjs.com/package/@elastic/eui/v/${npm_version}" | ||
exit 2 | ||
fi | ||
|
||
echo "Version ${npm_version} hasn't been published to npm yet" | ||
|
||
## | ||
# Commit package.json | ||
## | ||
|
||
echo "+++ :git: Adding and committing package.json" | ||
|
||
# Always stage package.json | ||
git add package.json | ||
|
||
# Stage additional build artifacts | ||
|
||
if [[ "$(git ls-files -m | grep "i18ntokens" -c)" -gt 0 ]]; then | ||
echo "Found i18ntokens.json changes to stage" | ||
git add i18ntokens.json i18ntokens_changelog.json | ||
fi | ||
|
||
if [[ "$(git ls-files -m | wc -l)" -gt 0 ]]; then | ||
>&2 echo "Found unexpected additional build artifacts:" | ||
git ls-files -m | ||
>&2 echo "eui-release doesn't know what to do with these files, exiting..." | ||
exit 5 | ||
fi | ||
|
||
git commit -m "release: @elastic/eui v${npm_version} [skip-ci]" --no-verify | ||
|
||
echo "+++ :git: Pushing commit to ${git_branch}" | ||
|
||
# git push will be rejected by remote if there are any new commits or other | ||
# changes made to the branch between the start of this build and now. | ||
if ! git push "${git_remote_name}" HEAD:"${git_branch}"; then | ||
# fetch remote objects and refs without changing the local state | ||
git fetch upstream | ||
|
||
latest_commit_on_branch=$(git rev-parse "${git_remote_name}/${git_branch}") | ||
latest_commit_on_branch_subject=$(git rev-list --max-count=1 --no-commit-header --format=%s "${latest_commit_on_branch}") | ||
expected_commit_on_branch_subject=$(git rev-list --max-count=1 --no-commit-header --format=%s "${BUILDKITE_COMMIT}") | ||
|
||
>&2 echo "Git push failed. This usually means the remote branch (${git_branch}) has changed since this build started." | ||
>&2 echo "This script expected commit ${BUILDKITE_COMMIT} (${expected_commit_on_branch_subject}) to be the HEAD of branch ${git_branch} but instead it's ${latest_commit_on_branch} (${latest_commit_on_branch_subject})" | ||
exit 3 | ||
fi | ||
|
||
if [[ "${RELEASE_TYPE}" == "release" ]]; then | ||
tag_name="v${npm_version}" | ||
echo "Creating and pushing release tag ${tag_name}" | ||
git tag --annotate "${tag_name}" | ||
git push "${git_remote_name}" "${tag_name}" | ||
echo "+++ :git: Pushed release tag - https://github.com/elastic/eui/tree/${tag_name}" | ||
fi | ||
|
||
## | ||
# Publish to npm | ||
## | ||
|
||
echo "+++ :npm: Authenticating to npm" | ||
|
||
npm_vault="secret/ci/elastic-eui/npm" | ||
NPM_TOKEN=$(retry 5 vault read -field=token "${npm_vault}") | ||
npm config set "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" | ||
|
||
echo "+++ :npm: Publishing @elastic/eui" | ||
|
||
if [[ "${RELEASE_TYPE}" == "release" ]]; then | ||
npm publish --dry-run | ||
else | ||
npm publish --dry-run --tag next | ||
fi | ||
|
||
echo "+++ :white_check_mark: Version ${npm_version} published!" | ||
echo "https://www.npmjs.com/package/@elastic/eui/v/${npm_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/bin/bash | ||
# Update version number and commit it back to the repository. | ||
# | ||
# Supported configuration via environment variables: | ||
# * RELEASE_TYPE (optional) - Type of release that should be performed. Defaults to prerelease (possible values: "release", "prerelease") | ||
# * RELEASE_VERSION (required when RELEASE_TYPE="release") - The new package.json version string. Must follow semver notation. | ||
|
||
set -eo pipefail | ||
|
||
source .buildkite/scripts/common/utils.sh | ||
|
||
# TODO: Support releasing non-HEAD commits when FORCE_SKIP_GIT_UPDATES=true | ||
|
||
npm_version_prerelease_prefix="next" | ||
|
||
if [[ -z "${BUILDKITE_BRANCH}" ]]; then | ||
>&2 echo "BUILDKITE_BRANCH is not set. This usually means you're trying to execute this script from the outside of Buildkite pipeline which is unsupported." | ||
exit 1 | ||
fi | ||
|
||
## | ||
# Check version number | ||
## | ||
|
||
if [[ "${RELEASE_TYPE}" == "release" ]] && [[ -z "${RELEASE_VERSION}" ]]; then | ||
>&2 echo "RELEASE_VERSION must be set when RELEASE_TYPE is 'release'" | ||
exit 1 | ||
fi | ||
|
||
## | ||
# Print run's configuration | ||
## | ||
|
||
echo "+++ Updating version on branch ${BUILDKITE_BRANCH}" | ||
echo "release type: ${RELEASE_TYPE}" | ||
echo "release version: ${RELEASE_VERSION}" | ||
echo "npm version prerelease prefix: ${npm_version_prerelease_prefix}" | ||
echo "node version: $(node -v)" | ||
|
||
## | ||
# Update package version | ||
## | ||
|
||
echo "+++ Updating @elastic/eui version string" | ||
|
||
npm_version_args=( | ||
--git-tag-version=false # disable tagging the new version | ||
--sign-git-tag=false # disable signing the git tag | ||
--commit-hooks=false # disable all git commit hooks | ||
) | ||
|
||
new_version="" | ||
if [[ "${RELEASE_TYPE}" == "release" ]]; then | ||
new_version=$(npm version "${npm_version_args[@]}" "${RELEASE_VERSION}") | ||
else | ||
new_version=$(npm version "${npm_version_args[@]}" --preid=${npm_version_prerelease_prefix} prerelease) | ||
fi | ||
|
||
# npm version output prefixes the new version with 'v' | ||
new_version="${new_version:1}" | ||
|
||
echo "Updated @elastic/eui version string to ${new_version}" | ||
|
||
## | ||
# Success! | ||
## | ||
|
||
echo "+++ :white_check_mark: Version successfully updated" |
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 +1 @@ | ||
20.11.1 | ||
20.12.1 |
Oops, something went wrong.