Skip to content

Commit 3e6528a

Browse files
authored
[Release automation] Setup workflow - unit and e2e tests (#9213)
1 parent 33cc143 commit 3e6528a

File tree

6 files changed

+51
-9
lines changed

6 files changed

+51
-9
lines changed

.github/workflows/release.yml

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,71 @@
11
name: Release packages (Work in Progress, a dry run only)
2+
run-name: "Create ${{ inputs.type }} release from ${{ inputs.release_ref }} by ${{ github.actor }}"
23

34
on:
45
workflow_dispatch:
56
inputs:
7+
release_ref:
8+
description: Upstream git ref to create the release from
9+
required: true
10+
type: string
11+
type:
12+
description: Release type
13+
required: true
14+
type: choice
15+
options:
16+
- snapshot
17+
- official
618
workspaces:
719
description: A comma-separated list of workspaces to release
820
required: false
921
type: string
22+
dry_run:
23+
description: Dry run (do not publish the packages)
24+
required: true
25+
type: boolean
1026

1127
#permissions:
1228
# id-token: write # Required for OIDC
1329
# contents: read
1430

1531
jobs:
16-
checks:
17-
name: Checks
32+
lint_and_unit_tests:
33+
name: Run lint and unit tests
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v4
37+
with:
38+
ref: ${{ inputs.release_ref }}
39+
persist-credentials: false
40+
- uses: actions/setup-node@v6
41+
with:
42+
node-version-file: .nvmrc
43+
cache: yarn
44+
- name: Install dependencies
45+
run: yarn install --immutable
46+
- name: Build local packages
47+
run: yarn workspaces foreach --all --parallel --topological-dev --exclude @elastic/eui-website --exclude @elastic/eui-monorepo --exclude @elastic/eui-docgen run build
48+
# TODO: Uncomment when code formatting is fixed in eui-theme-common and eui-theme-borealis
49+
# This is prepared in the upstream/build/gh-release-action branch
50+
# - name: Lint
51+
# run: yarn workspaces foreach --all --parallel --topological-dev --exclude @elastic/eui-website --exclude @elastic/eui-monorepo --exclude @elastic/eui-docgen run lint
52+
- name: Unit tests
53+
run: yarn workspaces foreach --all --parallel --topological-dev --exclude @elastic/eui-website --exclude @elastic/eui-monorepo --exclude @elastic/eui-docgen run test-unit
54+
cypress_tests:
55+
name: Run cypress tests
1856
runs-on: ubuntu-latest
1957
steps:
2058
- uses: actions/checkout@v4
2159
with:
60+
ref: ${{ inputs.release_ref }}
2261
persist-credentials: false
2362
- uses: actions/setup-node@v6
2463
with:
2564
node-version-file: .nvmrc
2665
cache: yarn
2766
- name: Install dependencies
2867
run: yarn install --immutable
29-
- name: Run tests
30-
run: yarn workspaces foreach -A run test-ci
68+
- name: Build local packages
69+
run: yarn workspaces foreach --all --parallel --topological-dev --exclude @elastic/eui-website --exclude @elastic/eui-monorepo --exclude @elastic/eui-docgen run build
70+
- name: Cypress tests
71+
run: yarn workspaces foreach --all --parallel --topological-dev --exclude @elastic/eui-website --exclude @elastic/eui-monorepo --exclude @elastic/eui-docgen run test-cypress

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
},
1111
"scripts": {
1212
"pre-push": "yarn --cwd packages/eui pre-push",
13-
"preinstall": "printf $'\\x1b[K\\x1b[37;41mWarning: EUI has recently migrated to a monorepo structure. Please run EUI scripts like \\x1b[1;4myarn start\\x1b[0m\\x1b[37;41m or \\x1b[1;4myarn build\\x1b[0m\\x1b[37;41m from the \\x1b[1;4mpackages/eui\\x1b[0m\\x1b[37;41m directory instead!\\n\\nIf this is the first time you\\'re running EUI after the monorepo migration, please run this first from the root repository\\'s directory to clean up your local environment:\\n \\x1b[1;4mrm -rf node_modules .cache-loader dist es lib optimize test-env types .eslintcache .loki reports docs .nyc_output eui.d.ts && yarn\\x1b[0m\\x1b[37;41m\\n\\nInstall process will continue in 10 seconds...\\x1b[0m'; sleep 10",
1413
"start": "printf $'\\x1b[K\\x1b[37;41mPlease run this script from the \\x1b[1;4mpackages/eui\\x1b[0m\\x1b[37;41m directory instead\\x1b[0m\\n'; exit 1",
1514
"build": "printf $'\\x1b[K\\x1b[37;41mPlease run this script from the \\x1b[1;4mpackages/eui\\x1b[0m\\x1b[37;41m directory instead\\x1b[0m\\n'; exit 1",
1615
"release": "node scripts/release",

packages/eslint-plugin/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
"typescript": "^5.8.3"
4444
},
4545
"scripts": {
46-
"test": "jest src",
46+
"test": "yarn test-unit",
47+
"test-unit": "jest src",
4748
"build": "yarn build:clean && yarn build:compile && yarn build:compile:esm && yarn build:types",
4849
"build:clean": "rimraf lib/",
4950
"build:compile:esm": "tsc --project ./tsconfig.esm.json",

packages/eui-theme-borealis/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"lint": "yarn tsc --noEmit && yarn lint-es && yarn lint-sass",
1616
"lint-es": "eslint --cache src/**/*.ts --max-warnings 0",
1717
"lint-sass": "yarn stylelint \"**/*.scss\" --quiet-deprecation-warnings",
18-
"test": "jest ./src",
18+
"test": "yarn test-unit",
19+
"test-unit": "jest ./src --passWithNoTests",
1920
"pre-push": "yarn build:workspaces && yarn lint && yarn test"
2021
},
2122
"repository": {

packages/eui-theme-common/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"lint": "yarn tsc --noEmit && yarn lint-es && yarn lint-sass",
1414
"lint-es": "eslint --cache src/**/*.ts --max-warnings 0",
1515
"lint-sass": "yarn stylelint \"**/*.scss\" --quiet-deprecation-warnings",
16-
"test": "jest ./src",
16+
"test": "yarn test-unit",
17+
"test-unit": "jest ./src --passWithNoTests",
1718
"pre-push": "yarn lint && yarn test"
1819
},
1920
"repository": {

packages/release-cli/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"description": "",
66
"main": "dist/index.js",
77
"scripts": {
8-
"test": "echo \"Error: no test specified\" && exit 1",
98
"build": "tsc"
109
},
1110
"repository": {

0 commit comments

Comments
 (0)