Skip to content

Commit

Permalink
Merge branch 'main' into storybook/7481-stories-p
Browse files Browse the repository at this point in the history
  • Loading branch information
mgadewoll authored Apr 9, 2024
2 parents a3e312d + b58cd67 commit 01892f4
Show file tree
Hide file tree
Showing 150 changed files with 4,712 additions and 3,325 deletions.
114 changes: 109 additions & 5 deletions .buildkite/pipelines/pipeline_release.yml
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"
15 changes: 15 additions & 0 deletions .buildkite/scripts/release/step_build.sh
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"
111 changes: 111 additions & 0 deletions .buildkite/scripts/release/step_commit_and_publish.sh
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}"
68 changes: 68 additions & 0 deletions .buildkite/scripts/release/step_update_version.sh
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"
71 changes: 71 additions & 0 deletions changelogs/CHANGELOG_2024.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,74 @@
## [`v94.0.0`](https://github.com/elastic/eui/releases/v94.0.0)

- Updated `EuiTable`, `EuiBasicTable`, and `EuiInMemoryTable` with a new `responsiveBreakpoint` prop, which allows customizing the point at which the table collapses into a mobile-friendly view with cards ([#7625](https://github.com/elastic/eui/pull/7625))
- Updated `EuiProvider`'s `componentDefaults` prop to allow configuring `EuiTable.responsiveBreakpoint` ([#7625](https://github.com/elastic/eui/pull/7625))

**Bug fixes**

- `EuiBasicTable` & `EuiInMemoryTable` `isPrimary` actions are now correctly shown on mobile views ([#7640](https://github.com/elastic/eui/pull/7640))
- Table `mobileOptions`: ([#7642](https://github.com/elastic/eui/pull/7642))
- `mobileOptions.align` is now respected instead of all cells being forced to left alignment
- `textTruncate` and `textOnly` are now respected even if a `render` function is not passed

**Breaking changes**

- Removed unused `EuiTableHeaderButton` component ([#7621](https://github.com/elastic/eui/pull/7621))
- Removed the `responsive` prop from `EuiTable`, `EuiBasicTable`, and `EuiInMemoryTable`. Use the new `responsiveBreakpoint` prop instead ([#7625](https://github.com/elastic/eui/pull/7625))
- The following props are no longer needed by `EuiBasicTable` or `EuiInMemoryTable` for responsive table behavior to work correctly, and can be removed: ([#7632](https://github.com/elastic/eui/pull/7632))
- `isSelectable`
- `isExpandable`
- `hasActions`
- Removed the `showOnHover` prop from `EuiTableRowCell` / `EuiBasicTable`/`EuiInMemoryTable`'s `columns` API. Use the new actions `columns[].actions[].showOnHover` API instead. ([#7640](https://github.com/elastic/eui/pull/7640))
- Removed top-level `textOnly` prop from `EuiBasicTable` and `EuiInMemoryTable`. Use `columns[].textOnly` instead. ([#7642](https://github.com/elastic/eui/pull/7642))

**DOM changes**

- `EuiTable` mobile headers no longer render in the DOM when not visible (previously rendered with `display: none`). This may affect DOM testing assertions. ([#7625](https://github.com/elastic/eui/pull/7625))
- `EuiTableRowCell` now applies passed `className`s to the parent `<td>` element, instead of to the inner cell content `<div>`. ([#7631](https://github.com/elastic/eui/pull/7631))
- `EuiTableRow`s rendered by basic and memory tables now only render a `.euiTableRow-isSelectable` className if the selection checkbox is not disabled ([#7632](https://github.com/elastic/eui/pull/7632))
- `EuiTableRowCell`s with `textOnly` set to `false` will no longer attempt to apply the `.euiTableCellContent__text` className to child elements. ([#7641](https://github.com/elastic/eui/pull/7641))
- `EuiTableRowCell` no longer renders mobile headers to the DOM unless the current table is displaying its responsive view. ([#7642](https://github.com/elastic/eui/pull/7642))
- `EuiTableHeaderCell` and `EuiTableRowCell` will no longer render in the DOM at all on mobile if their columns' `mobileOptions.show` is set to `false`. ([#7642](https://github.com/elastic/eui/pull/7642))
- `EuiTableHeaderCell` and `EuiTableRowCell` will no longer render in the DOM at all on desktop if their columns' `mobileOptions.only` is set to `true`. ([#7642](https://github.com/elastic/eui/pull/7642))

**CSS-in-JS conversions**

- Converted `EuiTable`, `EuiTableRow`, `EuiTableRowCell`, and all other table subcomponents to Emotion ([#7654](https://github.com/elastic/eui/pull/7654))
- Removed the following `EuiTable` Sass variables: ([#7654](https://github.com/elastic/eui/pull/7654))
- `$euiTableCellContentPadding`
- `$euiTableCellContentPaddingCompressed`
- `$euiTableCellCheckboxWidth`
- `$euiTableHoverColor`
- `$euiTableSelectedColor`
- `$euiTableHoverSelectedColor`
- `$euiTableActionsBorderColor`
- `$euiTableHoverClickableColor`
- `$euiTableFocusClickableColor`
- Removed the following `EuiTable` Sass mixins: ([#7654](https://github.com/elastic/eui/pull/7654))
- `euiTableActionsBackgroundMobile`
- `euiTableCellCheckbox`
- `euiTableCell`

## [`v93.6.0`](https://github.com/elastic/eui/releases/v93.6.0)

- Updated `EuiBreadcrumb` styles to improve visual distinction of clickable breadcrumbs ([#7615](https://github.com/elastic/eui/pull/7615))

**Deprecations**

- Deprecated `color` prop on `EuiBreadcrumb` ([#7615](https://github.com/elastic/eui/pull/7615))

**Bug fixes**

- Fixed `EuiComboBox` to correctly select full matches within groups via the `Enter` key ([#7658](https://github.com/elastic/eui/pull/7658))

**Accessibility**

- Updated `EuiHeaderBreadcrumb` styles to ensure min. required color contrast ([#7643](https://github.com/elastic/eui/pull/7643))
- `EuiSuperSelect` now correctly reads out parent `EuiFormRow` labels to screen readers ([#7650](https://github.com/elastic/eui/pull/7650))
- `EuiSuperSelect` now more closely mimics native `<select>` behavior in its keyboard behavior and navigation ([#7650](https://github.com/elastic/eui/pull/7650))
- `EuiSuperSelect` no longer strands keyboard focus on close ([#7650](https://github.com/elastic/eui/pull/7650))
- `EuiSuperSelect` now correctly allows keyboard navigating past disabled options in the middle of the options list ([#7650](https://github.com/elastic/eui/pull/7650))

## [`v93.5.2`](https://github.com/elastic/eui/releases/v93.5.2)

**Dependency updates**
Expand Down
5 changes: 0 additions & 5 deletions changelogs/upcoming/7615.md

This file was deleted.

Loading

0 comments on commit 01892f4

Please sign in to comment.