Skip to content

Commit bf25125

Browse files
authored
Merge branch 'main' into snyk-upgrade-de353905732d58fe633fb009a3665e48
2 parents ff165fa + 54ce5c2 commit bf25125

2,374 files changed

Lines changed: 16540 additions & 22558 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 66 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,72 @@
11
# 🏠/.buildkite/pipelines/pipeline_pull_request_test.yml
22

33
steps:
4-
- agents:
4+
- command: .buildkite/scripts/pipeline_test.sh
5+
label: ":typescript: Linting"
6+
agents:
57
provider: "gcp"
6-
command: .buildkite/scripts/pipeline_test.sh
7-
if: build.branch != "main" # We're skipping testing commits in main for now to maintain parity with previous Jenkins setup
8+
env:
9+
TEST_TYPE: 'lint'
10+
if: build.branch != "main" # This job is triggered by the combined test and deploy docs for every PR
11+
12+
- command: .buildkite/scripts/pipeline_test.sh
13+
label: ":jest: TS unit tests"
14+
agents:
15+
provider: "gcp"
16+
env:
17+
TEST_TYPE: 'unit:ts'
18+
if: build.branch != "main"
19+
20+
- command: .buildkite/scripts/pipeline_test.sh
21+
label: ":jest: TSX unit tests on React 16"
22+
agents:
23+
provider: "gcp"
24+
env:
25+
TEST_TYPE: 'unit:tsx:16'
26+
if: build.branch != "main"
27+
28+
- command: .buildkite/scripts/pipeline_test.sh
29+
label: ":jest: TSX unit tests on React 17"
30+
agents:
31+
provider: "gcp"
32+
env:
33+
TEST_TYPE: 'unit:tsx:17'
34+
if: build.branch != "main"
35+
36+
- command: .buildkite/scripts/pipeline_test.sh
37+
label: ":jest: TSX unit tests on React 18"
38+
agents:
39+
provider: "gcp"
40+
env:
41+
TEST_TYPE: 'unit:tsx'
42+
if: build.branch != "main"
43+
44+
- command: .buildkite/scripts/pipeline_test.sh
45+
label: ":cypress: Cypress tests on React 16"
46+
agents:
47+
provider: "gcp"
48+
env:
49+
TEST_TYPE: 'cypress:16'
50+
if: build.branch != "main"
51+
artifact_paths:
52+
- "cypress/screenshots/**/*.png"
53+
54+
- command: .buildkite/scripts/pipeline_test.sh
55+
label: ":cypress: Cypress tests on React 17"
56+
agents:
57+
provider: "gcp"
58+
env:
59+
TEST_TYPE: 'cypress:17'
60+
if: build.branch != "main"
61+
artifact_paths:
62+
- "cypress/screenshots/**/*.png"
63+
64+
- command: .buildkite/scripts/pipeline_test.sh
65+
label: ":cypress: Cypress tests on React 18"
66+
agents:
67+
provider: "gcp"
68+
env:
69+
TEST_TYPE: 'cypress:18'
70+
if: build.branch != "main"
871
artifact_paths:
972
- "cypress/screenshots/**/*.png"

.buildkite/scripts/pipeline_test.sh

Lines changed: 60 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,63 @@
22

33
set -euo pipefail
44

5-
docker run \
6-
-i --rm \
7-
--env GIT_COMMITTER_NAME=test \
8-
--env GIT_COMMITTER_EMAIL=test \
9-
--env HOME=/tmp \
10-
--user="$(id -u):$(id -g)" \
11-
--volume="$(pwd):/app" \
12-
--workdir=/app \
13-
docker.elastic.co/eui/ci:5.3 \
14-
bash -c "/opt/yarn*/bin/yarn \
15-
&& yarn cypress install \
16-
&& NODE_OPTIONS=\"--max-old-space-size=2048\" npm run test-ci"
5+
DOCKER_OPTIONS=(
6+
-i --rm
7+
--env GIT_COMMITTER_NAME=test
8+
--env GIT_COMMITTER_EMAIL=test
9+
--env HOME=/tmp
10+
--user="$(id -u):$(id -g)"
11+
--volume="$(pwd):/app"
12+
--workdir=/app
13+
docker.elastic.co/eui/ci:5.3
14+
)
15+
16+
case $TEST_TYPE in
17+
lint)
18+
echo "[TASK]: Running linters"
19+
DOCKER_OPTIONS+=(bash -c "/opt/yarn*/bin/yarn && yarn lint")
20+
;;
21+
22+
unit:ts)
23+
echo "[TASK]: Running .ts and .js unit tests"
24+
DOCKER_OPTIONS+=(bash -c "/opt/yarn*/bin/yarn && yarn test-unit --node-options=--max_old_space_size=2048 --testMatch=non-react")
25+
;;
26+
27+
unit:tsx:16)
28+
echo "[TASK]: Running Jest .tsx tests against React 16"
29+
DOCKER_OPTIONS+=(bash -c "/opt/yarn*/bin/yarn && yarn test-unit --node-options=--max_old_space_size=2048 --react-version=16 --testMatch=react")
30+
;;
31+
32+
unit:tsx:17)
33+
echo "[TASK]: Running Jest .tsx tests against React 17"
34+
DOCKER_OPTIONS+=(bash -c "/opt/yarn*/bin/yarn && yarn test-unit --node-options=--max_old_space_size=2048 --react-version=17 --testMatch=react")
35+
;;
36+
37+
unit:tsx)
38+
echo "[TASK]: Running Jest .tsx tests against React 18"
39+
DOCKER_OPTIONS+=(bash -c "/opt/yarn*/bin/yarn && yarn test-unit --node-options=--max_old_space_size=2048 --testMatch=react")
40+
;;
41+
42+
cypress:16)
43+
echo "[TASK]: Running Cypress tests against React 16"
44+
DOCKER_OPTIONS+=(bash -c "/opt/yarn*/bin/yarn && yarn test-cypress --node-options=--max_old_space_size=2048 --react-version=16")
45+
;;
46+
47+
cypress:17)
48+
echo "[TASK]: Running Cypress tests against React 17"
49+
DOCKER_OPTIONS+=(bash -c "/opt/yarn*/bin/yarn && yarn test-cypress --node-options=--max_old_space_size=2048 --react-version=17")
50+
;;
51+
52+
cypress:18)
53+
echo "[TASK]: Running Cypress tests against React 18"
54+
DOCKER_OPTIONS+=(bash -c "/opt/yarn*/bin/yarn && yarn test-cypress --node-options=--max_old_space_size=2048")
55+
;;
56+
57+
*)
58+
echo "[ERROR]: Unknown task"
59+
echo "Exit code: 1"
60+
exit 1
61+
;;
62+
esac
63+
64+
docker run "${DOCKER_OPTIONS[@]}"

.github/config/label_commenter_config.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,18 @@ labels:
77
labeled:
88
issue:
99
body: 👋 Thank you for your suggestion or request! While the EUI team agrees that it's valid, it's unlikely that we will prioritize this issue on our roadmap. We'll leave the issue open if you or anyone else in the community wants to implement it by contributing to EUI. If not, this issue will auto close in one year.
10+
- name: breaking change
11+
labeled:
12+
pr:
13+
body: |
14+
This PR contains breaking changes. The opener of this pull request is asked to perform the following due diligence steps below, to assist EUI in our next Kibana upgrade:
15+
- If this PR contains **prop/API changes**:
16+
- [ ] Search through Kibana for `<EuiComponent` usages ([example search](https://github.com/search?q=repo%3Aelastic%2Fkibana+%3CEuiAccordion&type=code))
17+
- [ ] In the PR description or in a PR comment, include a count or list with the number of component usages in Kibana that will need to be updated (if that amount is "none", include that information as well)
18+
- If this PR contains **CSS changes**:
19+
- [ ] Search through Kibana for the changed EUI selectors, e.g. `.euiComponent` ([example search](https://github.com/search?q=repo%3Aelastic%2Fkibana+.euiAccordion&type=code))
20+
- [ ] In the PR description or in a PR comment, include a count or list with the number of custom CSS overrides in Kibana that will need to be updated (if that amount is "none", include that information as well)
21+
- 🔍 Tip: When searching through Kibana, consider excluding `**/target, **/*.snap, **/*.storyshot` files to reduce noise and only look at source code usages
22+
- ⚠️ For extremely risky changes, the EUI team should potentially consider the following precautions:
23+
- Using a [pre-release](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/releasing-versions.md#pre-release-process) release candidate to test Kibana CI ahead of time
24+
- Using [`kibana-a-la-carte`](https://github.com/elastic/eui/blob/main/wiki/contributing-to-eui/testing/testing-in-kibana.md#testing-in-the-cloud) for manual QA, and to give other Kibana teams a staging server to quickly test against

.github/pull_request_template.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,27 @@
22

33
Provide a detailed summary of your PR. Explain how you arrived at your solution. If it includes changes to UI elements include a screenshot or gif.
44

5+
If this is your first PR in the EUI repo, please ensure you've fully read through our [contributing to EUI](https://github.com/elastic/eui/blob/main/wiki/contributing-to-eui#how-to-ensure-the-timely-review-of-pull-requests) wiki guide.
6+
57
## QA
68

79
Remove or strikethrough items that do not apply to your PR.
810

911
### General checklist
1012

11-
- [ ] Checked in both **light and dark** modes
12-
- [ ] Checked in **mobile**
13-
- [ ] Checked in **Chrome**, **Safari**, **Edge**, and **Firefox**
14-
- [ ] Props have proper **autodocs** (using `@default` if default values are missing) and **[playground toggles](https://github.com/elastic/eui/blob/main/wiki/contributing-to-eui/documenting/playgrounds.md)**
15-
- [ ] Added **[documentation](https://github.com/elastic/eui/blob/main/wiki/contributing-to-eui/documenting)**
16-
- [ ] Checked **[Code Sandbox](https://codesandbox.io/)** works for any docs examples
17-
- [ ] Added or updated **[jest](https://github.com/elastic/eui/blob/main/wiki/contributing-to-eui/testing/unit-testing.md) and [cypress](https://github.com/elastic/eui/blob/main/wiki/contributing-to-eui/testing/cypress-testing.md) tests**
18-
- [ ] Checked for **breaking changes** and labeled appropriately
19-
- [ ] Checked for **accessibility** including keyboard-only and screenreader modes
20-
- [ ] Updated the **[Figma](https://www.figma.com/community/file/964536385682658129)** library counterpart
21-
- [ ] A **[changelog](https://github.com/elastic/eui/blob/main/wiki/contributing-to-eui/documenting/changelogs.md)** entry exists and is marked appropriately
13+
- Browser QA
14+
- [ ] Checked in both **light and dark** modes
15+
- [ ] Checked in **mobile**
16+
- [ ] Checked in **Chrome**, **Safari**, **Edge**, and **Firefox**
17+
- [ ] Checked for **accessibility** including keyboard-only and screenreader modes
18+
- Docs site QA
19+
- [ ] Added **[documentation](https://github.com/elastic/eui/blob/main/wiki/contributing-to-eui/documenting)**
20+
- [ ] Props have proper **autodocs** (using `@default` if default values are missing) and **[playground toggles](https://github.com/elastic/eui/blob/main/wiki/contributing-to-eui/documenting/playgrounds.md)**
21+
- [ ] Checked **[Code Sandbox](https://codesandbox.io/)** works for any docs examples
22+
- Code quality checklist
23+
- [ ] Added or updated **[jest](https://github.com/elastic/eui/blob/main/wiki/contributing-to-eui/testing/unit-testing.md) and [cypress](https://github.com/elastic/eui/blob/main/wiki/contributing-to-eui/testing/cypress-testing.md) tests**
24+
- Release checklist
25+
- [ ] A **[changelog](https://github.com/elastic/eui/blob/main/wiki/contributing-to-eui/documenting/changelogs.md)** entry exists and is marked appropriately.
26+
- [ ] If applicable, added the **breaking change** issue label (and filled out the breaking change checklist)
27+
- Designer checklist
28+
- [ ] Updated the **[Figma](https://www.figma.com/community/file/964536385682658129)** library counterpart
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: "Community contribution"
2+
on:
3+
pull_request_target:
4+
types: [opened, reopened]
5+
6+
jobs:
7+
community-pr-message:
8+
env:
9+
USER_LOGIN: ${{ github.event.pull_request.user.login }}
10+
IS_ORG_MEMBER: "" # https://github.com/github/vscode-github-actions/issues/47
11+
runs-on: ubuntu-latest
12+
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
13+
permissions:
14+
issues: write
15+
pull-requests: write
16+
steps:
17+
- name: "Check for org membership"
18+
# https://docs.github.com/en/rest/orgs/members?apiVersion=2022-11-28#check-organization-membership-for-a-user
19+
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#example-of-writing-an-environment-variable-to-github_env
20+
run: |
21+
DATA=$(
22+
curl -L -i -w "%{http_code}" \
23+
-H "Accept: application/vnd.github+json" \
24+
-H "Authorization: Bearer ${{ secrets.EUI_COMMUNITY_PR }}" \
25+
-H "X-GitHub-Api-Version: 2022-11-28" \
26+
https://api.github.com/orgs/elastic/members/"$USER_LOGIN"
27+
)
28+
29+
HTTP_CODE=$(echo "$DATA" | awk '/([0-9]{3})$/{print}')
30+
echo "IS_ORG_MEMBER=$HTTP_CODE" >> "$GITHUB_ENV"
31+
- name: "Add comment to community pull requests"
32+
uses: actions/github-script@v6
33+
if: ${{ env.IS_ORG_MEMBER != '204' }}
34+
with:
35+
script: |
36+
github.rest.issues.createComment({
37+
issue_number: context.issue.number,
38+
owner: context.repo.owner,
39+
repo: context.repo.repo,
40+
body: "👋 Since this is a community submitted pull request, a Buildkite build has not been started automatically. Would an Elastic organization member please verify the contents of this pull request and kick off a build manually?",
41+
});
42+
43+
github.rest.issues.addLabels({
44+
issue_number: context.issue.number,
45+
owner: context.repo.owner,
46+
repo: context.repo.repo,
47+
labels: ['community contribution']
48+
});

.github/workflows/label_commenter.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@ name: Auto-respond to issues with comments based on labels
33
on:
44
issues:
55
types: [labeled]
6+
pull_request_target:
7+
types: [labeled]
68

79
permissions:
810
contents: read
911
issues: write
12+
pull-requests: write
1013

1114
jobs:
1215
comment:

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ test/failure-screenshots/**/*.png
77
cypress/screenshots
88
cypress/videos
99

10+
storybook-static/
1011
coverage/
1112
reports/
1213
.nyc_output/
1314
tmp/
15+
docs/
1416
dist/
1517
lib/
1618
es/

.storybook/main.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ const config: StorybookConfig = {
2626
use: [
2727
{
2828
loader: require.resolve('babel-loader'),
29-
options: { plugins: ['@emotion/babel-plugin'] },
3029
},
3130
],
3231
});

.storybook/preview.tsx

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import React from 'react';
1212
import type { Preview } from '@storybook/react';
13+
import { MINIMAL_VIEWPORTS } from '@storybook/addon-viewport';
1314

1415
/*
1516
* Preload all EuiIcons - Storybook does not support dynamic icon loading
@@ -37,10 +38,20 @@ import { writingModeStyles } from './writing_mode.styles';
3738
// once all EUI components are converted to Emotion
3839
import '../dist/eui_theme_light.css';
3940

41+
/**
42+
* Prop controls
43+
*/
44+
45+
import type { CommonProps } from '../src/components/common';
46+
import { hideStorybookControls } from './utils';
47+
4048
const preview: Preview = {
4149
decorators: [
4250
(Story, context) => (
43-
<EuiProvider colorMode={context.globals.colorMode}>
51+
<EuiProvider
52+
colorMode={context.globals.colorMode}
53+
{...(context.componentId === 'euiprovider' && context.args)}
54+
>
4455
<div
4556
css={[
4657
writingModeStyles.writingMode,
@@ -85,6 +96,7 @@ const preview: Preview = {
8596
parameters: {
8697
actions: { argTypesRegex: '^on[A-Z].*' },
8798
backgrounds: { disable: true }, // Use colorMode instead
99+
options: { showPanel: true }, // default to showing the controls panel
88100
controls: {
89101
expanded: true,
90102
sort: 'requiredFirst',
@@ -93,15 +105,19 @@ const preview: Preview = {
93105
date: /Date$/,
94106
},
95107
},
108+
viewport: {
109+
viewports: MINIMAL_VIEWPORTS,
110+
},
96111
},
97112
// Due to CommonProps, these props appear on almost every Story, but generally
98113
// aren't super useful to test - let's disable them by default and (if needed)
99-
// individual stories can re-enable them
100-
argTypes: {
101-
css: { table: { disable: true } },
102-
className: { table: { disable: true } },
103-
'data-test-subj': { table: { disable: true } },
104-
},
114+
// individual stories can re-enable them, e.g. by passing
115+
// `argTypes: { 'data-test-subj': { table: { disable: false } } }`
116+
argTypes: hideStorybookControls<CommonProps>([
117+
'css',
118+
'className',
119+
'data-test-subj',
120+
]),
105121
};
106122

107123
export default preview;

0 commit comments

Comments
 (0)