Skip to content

Commit

Permalink
Merge branch master into master-merge-feature
Browse files Browse the repository at this point in the history
  • Loading branch information
li-jia-nan committed Nov 27, 2023
2 parents e087b07 + 5012049 commit cc57244
Show file tree
Hide file tree
Showing 17 changed files with 266 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .dumi/theme/builtins/Previewer/CodePreviewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ const CodePreviewer: React.FC<AntdPreviewerProps> = (props) => {
'react@18/umd/react.development.js',
'react-dom@18/umd/react-dom.development.js',
'dayjs@1/dayjs.min.js',
`antd@${pkg.version}/dist/antd-with-locales.js`,
`antd@${pkg.version}/dist/antd-with-locales.min.js`,
`@ant-design/icons/dist/index.umd.js`,
'react-router-dom/dist/umd/react-router-dom.production.min.js',
'react-router/dist/umd/react-router.production.min.js',
Expand Down
15 changes: 0 additions & 15 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,3 @@ Describe changes from the user side, and list all potential break changes or oth
- [ ] Demo is updated/provided or not needed
- [ ] TypeScript definition is updated/provided or not needed
- [ ] Changelog is provided or not needed

---

<!--
Below are template for copilot to generate CR message.
Please DO NOT modify it.
-->

### 🚀 Summary

copilot:summary

### 🔍 Walkthrough

copilot:walkthrough
14 changes: 0 additions & 14 deletions .github/PULL_REQUEST_TEMPLATE/pr_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,3 @@
- [ ] 代码演示已提供或无须提供
- [ ] TypeScript 定义已补充或无须补充
- [ ] Changelog 已提供或无须提供

---

<!--
以下为 copilot 自动生成的 CR 结果,请勿修改
-->

### 🚀 概述

copilot:summary

### 🔍 实现细节

copilot:walkthrough
11 changes: 9 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ jobs:
strategy:
matrix:
react: ['16', '17', '18']
module: ['dom', 'node', 'dist']
module: ['dom', 'node', 'dist', 'dist-min']
shard: ['1/2', '2/2']
env:
REACT: ${{ matrix.react }}
Expand Down Expand Up @@ -179,7 +179,7 @@ jobs:
run: npm run install-react-18

- name: restore cache from dist
if: ${{ matrix.module == 'dist' }}
if: ${{ matrix.module == 'dist' || matrix.module == 'dist-min' }}
uses: actions/cache@v3
with:
path: dist
Expand Down Expand Up @@ -224,6 +224,13 @@ jobs:
run: npm test
env:
LIB_DIR: dist

# dist min test
- name: dist-min test
if: ${{ matrix.module == 'dist-min' }}
run: npm test
env:
LIB_DIR: dist-min
needs: [setup, dist]

############################ Test Coverage ###########################
Expand Down
107 changes: 107 additions & 0 deletions .github/workflows/visual-regression-persist-finish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Each `push on master` will persist image-snapshots that used as compare target in visual regression.

name: Visual Regression Persist Finish

on:
workflow_run:
workflows: ["name: Visual Regression Persist Start"]
types:
- completed

permissions:
contents: read

jobs:
upstream-workflow-summary:
name: upstream workflow summary
runs-on: ubuntu-latest
outputs:
jobs: ${{ steps.persist_start_job_status.outputs.result }}
build-success: ${{ steps.persist_start_job_status.outputs.build-success }}
build-failure: ${{ steps.persist_start_job_status.outputs.build-failure }}
steps:
- name: summary jobs status
uses: actions/github-script@v6
id: persist_start_job_status
with:
# todo: split it out as github actions
script: |
const response = await github.rest.actions.listJobsForWorkflowRun({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ github.event.workflow_run.id }},
});
// { [name]: [conclusion] }, e.g. { 'test image': 'success' }
const jobs = (response.data?.jobs ?? []).reduce((acc, job) => {
if(job?.status === 'completed' && 'name' in job && 'conclusion' in job) {
acc[job.name] = job.conclusion;
}
return acc;
}, {});
const total = Object.keys(jobs).length;
if(total === 0) core.setFailed('no jobs found');
// the name here must be the same as `jobs.xxx.{name}` in preview-build.yml
// set output
core.setOutput('build-success', jobs['test image'] === 'success');
core.setOutput('build-failure', jobs['test image'] === 'failure');
return jobs;
persist-image-snapshots:
name: persist image-snapshots
permissions:
actions: read # for dawidd6/action-download-artifact to query and download artifacts
runs-on: ubuntu-latest
needs: upstream-workflow-summary
steps:
# We need get persist key first
- name: Download Visual Regression Ref
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
run_id: ${{ github.event.workflow_run.id }}
name: visual-regression-persist-ref

# Save visual-regression ref to output
- name: Extra Visual Regression Ref
id: visuall-regression
run: echo "id=$(<visual-regression-ref.txt)" >> $GITHUB_OUTPUT

- name: Download Visual-Regression Artifact
if: ${{ fromJSON(needs.upstream-workflow-summary.outputs.build-success) }}
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
run_id: ${{ github.event.workflow_run.id }}
name: image-snapshots
path: imageSnapshots

- name: Persist to Snapshot Repo
if: github.event.pull_request.head.ref == 'master'
id: persist
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.ANTD_IMAGE_SNAP_REPO_TOKEN }}
# should push to snapshot repo firstly
# push the single folder to the repo
run: |
git config user.name "Antd Visual-Regression Bot"
git config user.email "<>"
git clone [email protected]:ant-design/antd-image-snapshots.git
rm antd-image-snapshots/*.txt
rm -rf antd-image-snapshots/imageSnapshots
mv visual-regression-ref.txt antd-image-snapshots/
mv ./imageSnapshots antd-image-snapshots/
cd antd-image-snapshots
git add .
git cm -m 'feat: update snapshot from ${{steps.visuall-regression.outputs.id}}'
git config -l | grep 'http\..*\.extraheader' | cut -d= -f1 | \
xargs -L1 git config --unset-all
git push --prune https://token:[email protected]/ant-design/antd-image-snapshots.git +refs/remotes/origin/*:refs/heads/* +refs/tags/*:refs/tags/*
95 changes: 95 additions & 0 deletions .github/workflows/visual-regression-persist-start.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Each `push on master` will persist image-snapshots that used as compare target in visual regression.

name: Visual Regression Persist Start

on:
push:
branches:
- master

permissions:
contents: read

jobs:
# Prepare node modules. Reuse cache if available
setup:
name: prepare node_modules
runs-on: ubuntu-latest
container: ghcr.io/puppeteer/puppeteer:21.5.2
steps:
- name: checkout
uses: actions/checkout@v4

- name: cache package-lock.json
uses: actions/cache@v3
with:
path: package-temp-dir
key: lock-${{ github.sha }}

- name: create package-lock.json
run: npm i --package-lock-only --ignore-scripts

- name: hack for single file
run: |
if [ ! -d "package-temp-dir" ]; then
mkdir package-temp-dir
fi
cp package-lock.json package-temp-dir
- name: cache node_modules
id: node_modules_cache_id
uses: actions/cache@v3
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}

- name: install
if: steps.node_modules_cache_id.outputs.cache-hit != 'true'
run: npm ci

test-image:
name: test image
runs-on: ubuntu-latest
needs: setup
steps:
- name: checkout
uses: actions/checkout@v4

- name: restore cache from package-lock.json
uses: actions/cache@v3
with:
path: package-temp-dir
key: lock-${{ github.sha }}

- name: restore cache from node_modules
uses: actions/cache@v3
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}

- name: generate image snapshots
id: site
run: |
npm run version
npm run test-image
env:
SITE_ENV: development
NODE_OPTIONS: "--max_old_space_size=4096"

# Upload `imageSnapshots` on master
- name: upload report artifact
uses: actions/upload-artifact@v3
with:
name: image-snapshots
path: imageSnapshots/

# Upload git ref for next workflow `visual-regression-persist-finish` use
- name: Save persist key
if: ${{ always() }}
run: echo ${{ github.sha }} > ./visual-regression-ref.txt

- name: Upload persist key
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: visual-regression-persist-ref
path: ./visual-regression-ref.txt
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ components/version/token-meta.json
__diff_output__/
__image_snapshots__/
/jest-stare
/imageSnapshots
/imageSnapshots*
/imageDiffSnapshots

.devcontainer*
Expand Down
2 changes: 1 addition & 1 deletion .jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const transformIgnorePatterns = [
];

function getTestRegex(libDir) {
if (['dist', 'lib', 'es'].includes(libDir)) {
if (['dist', 'lib', 'es', 'dist-min'].includes(libDir)) {
return 'demo\\.test\\.(j|t)sx?$';
}
return '.*\\.test\\.(j|t)sx?$';
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ tag: vVERSION

---

## 5.11.5

`2023-11-27`

- 🐞 MISC: Fix error in `dist` artifact. [#46103](https://github.com/ant-design/ant-design/pull/46103) [@MadCcc](https://github.com/MadCcc)
- 💄 Fix DatePicker style when disabled and hovered. [#45940](https://github.com/ant-design/ant-design/pull/45940) [@crazyair](https://github.com/crazyair)

## 5.11.4

`2023-11-24`
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ tag: vVERSION

---

## 5.11.5

`2023-11-27`

- 🐞 MISC: 修复打包 `dist` 产物错误。[#46103](https://github.com/ant-design/ant-design/pull/46103) [@MadCcc](https://github.com/MadCcc)
- 💄 修复 DatePicker 禁用状态下悬浮样式。[#45940](https://github.com/ant-design/ant-design/pull/45940) [@crazyair](https://github.com/crazyair)

## 5.11.4

`2023-11-24`
Expand Down
2 changes: 1 addition & 1 deletion components/input/style/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export const genDisabledStyle = (token: InputToken): CSSObject => ({
cursor: 'not-allowed',
opacity: 1,

'&:hover': {
'&:hover:not([disabled])': {
...genHoverStyle(
mergeToken<InputToken>(token, {
hoverBorderColor: token.colorBorder,
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "antd",
"version": "5.11.4",
"version": "5.11.5",
"description": "An enterprise-class UI design language and React components implementation",
"keywords": [
"ant",
Expand Down Expand Up @@ -164,7 +164,7 @@
"devDependencies": {
"@ant-design/compatible": "^5.1.2",
"@ant-design/happy-work-theme": "^1.0.0",
"@ant-design/tools": "^18.0.0",
"@ant-design/tools": "^18.0.2",
"@antv/g6": "^4.8.23",
"@argos-ci/core": "^1.3.0",
"@babel/eslint-plugin": "^7.22.10",
Expand Down Expand Up @@ -258,7 +258,7 @@
"jest-image-snapshot": "^6.2.0",
"jest-puppeteer": "^9.0.1",
"jquery": "^3.7.1",
"jsdom": "^22.1.0",
"jsdom": "^23.0.0",
"jsonml-to-react-element": "^1.1.11",
"jsonml.js": "^0.1.0",
"lint-staged": "^15.1.0",
Expand Down Expand Up @@ -306,9 +306,9 @@
"stylelint-prettier": "^4.1.0",
"sylvanas": "^0.6.1",
"terser": "^5.24.0",
"tsx": "^4.4.0",
"typedoc": "^0.25.3",
"typescript": "~5.2.2",
"tsx": "^4.6.0",
"typedoc": "^0.25.4",
"typescript": "~5.3.0",
"vanilla-jsoneditor": "^0.19.0",
"vanilla-tilt": "^1.8.1",
"webpack": "^5.89.0",
Expand Down
1 change: 1 addition & 0 deletions scripts/post-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const DEPRECIATED_VERSION = {
'5.11.0': ['https://github.com/ant-design/ant-design/issues/45742'],
'5.11.1': ['https://github.com/ant-design/ant-design/issues/45883'],
'5.11.2': ['https://github.com/ant-design/ant-design/issues/46005'],
'5.11.4': ['https://github.com/ant-design/ant-design/pull/46103'],
} as const;

function matchDeprecated(v: string) {
Expand Down
8 changes: 8 additions & 0 deletions scripts/test-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ else
echo "[TEST ALL] dist test...skip"
fi

if ! has_arg '--skip-dist' "$@"; then
echo "[TEST ALL] dist-min test"
echo "[TEST ALL] dist-min test" > ~test-all.txt
LIB_DIR=dist-min npm test -- --bail
else
echo "[TEST ALL] dist test...skip"
fi

if ! has_arg '--skip-es' "$@"; then
echo "[TEST ALL] test es"
echo "[TEST ALL] test es" > ~test-all.txt
Expand Down
Loading

0 comments on commit cc57244

Please sign in to comment.