mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-27 20:49:53 +08:00
ci: make puppeteer works when reusing node_modules (#46107)
* feat: update * feat: add options as root user * chore: update * chore: update * feat: move puppeteer into node_modules cache * chore: update * fix: update * fix: typo for push * chore: cleanup * fix: make persist finish works * chore: test tar speed * chore: debug tar files * fix: clone firstly * fix: clone with token * chore: local passed * fix: commit not cm * fix: git config --local * chore: clean up * chore: update * fix: replace token to user_id
This commit is contained in:
parent
082975e9c4
commit
32eccfdd88
@ -1,10 +1,10 @@
|
|||||||
# Each `push on master` will persist image-snapshots that used as compare target in visual regression.
|
# Each `push on master` will persist image-snapshots that used as compare target in visual regression.
|
||||||
|
|
||||||
name: Visual Regression Persist Finish
|
name: 👁️ Visual Regression Persist Finish
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_run:
|
workflow_run:
|
||||||
workflows: ["name: Visual Regression Persist Start"]
|
workflows: ["👁️ Visual Regression Persist Start"]
|
||||||
types:
|
types:
|
||||||
- completed
|
- completed
|
||||||
|
|
||||||
@ -76,10 +76,10 @@ jobs:
|
|||||||
workflow: ${{ github.event.workflow_run.workflow_id }}
|
workflow: ${{ github.event.workflow_run.workflow_id }}
|
||||||
run_id: ${{ github.event.workflow_run.id }}
|
run_id: ${{ github.event.workflow_run.id }}
|
||||||
name: image-snapshots
|
name: image-snapshots
|
||||||
path: imageSnapshots
|
path: ./
|
||||||
|
|
||||||
- name: Persist to Snapshot Repo
|
- name: Persist to Snapshot Repo
|
||||||
if: github.event.pull_request.head.ref == 'master'
|
if: github.ref_name == 'master'
|
||||||
id: persist
|
id: persist
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
env:
|
env:
|
||||||
@ -87,21 +87,27 @@ jobs:
|
|||||||
# should push to snapshot repo firstly
|
# should push to snapshot repo firstly
|
||||||
# push the single folder to the repo
|
# push the single folder to the repo
|
||||||
run: |
|
run: |
|
||||||
git config user.name "Antd Visual-Regression Bot"
|
git clone https://$GITHUB_TOKEN@github.com/ant-design/antd-image-snapshots.git
|
||||||
git config user.email "<>"
|
|
||||||
|
echo "✅ Clone Finished"
|
||||||
|
|
||||||
git clone git@github.com:ant-design/antd-image-snapshots.git
|
|
||||||
rm antd-image-snapshots/*.txt
|
rm antd-image-snapshots/*.txt
|
||||||
rm -rf antd-image-snapshots/imageSnapshots
|
|
||||||
|
|
||||||
mv visual-regression-ref.txt antd-image-snapshots/
|
mv visual-regression-ref.txt antd-image-snapshots/
|
||||||
mv ./imageSnapshots antd-image-snapshots/
|
|
||||||
|
rm -rf antd-image-snapshots/imageSnapshots/*
|
||||||
|
tar -xzvf imageSnapshots.tar.gz -C antd-image-snapshots/imageSnapshots
|
||||||
|
|
||||||
|
echo "✅ Changes Finished"
|
||||||
|
|
||||||
cd 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 | \
|
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
xargs -L1 git config --unset-all
|
git config --local user.name "github-actions[bot]"
|
||||||
|
|
||||||
git push --prune https://token:$GITHUB_TOKEN@github.com/ant-design/antd-image-snapshots.git +refs/remotes/origin/*:refs/heads/* +refs/tags/*:refs/tags/*
|
git commit -a -m 'feat: update snapshot from ${{steps.visuall-regression.outputs.id}}'
|
||||||
|
|
||||||
|
echo "✅ Commit Finished"
|
||||||
|
|
||||||
|
git push --prune https://vaugsX:$GITHUB_TOKEN@github.com/ant-design/antd-image-snapshots.git +refs/remotes/origin/*:refs/heads/*
|
||||||
|
|
||||||
|
echo "✅ Push Finished"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Each `push on master` will persist image-snapshots that used as compare target in visual regression.
|
# Each `push on master` will persist image-snapshots that used as compare target in visual regression.
|
||||||
|
|
||||||
name: Visual Regression Persist Start
|
name: 👁️ Visual Regression Persist Start
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -15,7 +15,6 @@ jobs:
|
|||||||
setup:
|
setup:
|
||||||
name: prepare node_modules
|
name: prepare node_modules
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ghcr.io/puppeteer/puppeteer:21.5.2
|
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@ -67,12 +66,12 @@ jobs:
|
|||||||
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
|
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
|
||||||
|
|
||||||
- name: generate image snapshots
|
- name: generate image snapshots
|
||||||
id: site
|
|
||||||
run: |
|
run: |
|
||||||
|
node node_modules/puppeteer/install.mjs
|
||||||
npm run version
|
npm run version
|
||||||
npm run test-image
|
npm run test-image
|
||||||
|
tar -czvf imageSnapshots.tar.gz imageSnapshots/*
|
||||||
env:
|
env:
|
||||||
SITE_ENV: development
|
|
||||||
NODE_OPTIONS: "--max_old_space_size=4096"
|
NODE_OPTIONS: "--max_old_space_size=4096"
|
||||||
|
|
||||||
# Upload `imageSnapshots` on master
|
# Upload `imageSnapshots` on master
|
||||||
@ -80,7 +79,7 @@ jobs:
|
|||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: image-snapshots
|
name: image-snapshots
|
||||||
path: imageSnapshots/
|
path: imageSnapshots.tar.gz
|
||||||
|
|
||||||
# Upload git ref for next workflow `visual-regression-persist-finish` use
|
# Upload git ref for next workflow `visual-regression-persist-finish` use
|
||||||
- name: Save persist key
|
- name: Save persist key
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// jest-puppeteer.config.js
|
// jest-puppeteer.config.js
|
||||||
module.exports = {
|
module.exports = {
|
||||||
launch: {
|
launch: {
|
||||||
|
ignoreDefaultArgs: ['--disable-extensions'],
|
||||||
args: [
|
args: [
|
||||||
// Required for Docker version of Puppeteer
|
// Required for Docker version of Puppeteer
|
||||||
'--no-sandbox',
|
'--no-sandbox',
|
||||||
|
@ -274,7 +274,7 @@
|
|||||||
"pretty-format": "^29.0.0",
|
"pretty-format": "^29.0.0",
|
||||||
"prismjs": "^1.29.0",
|
"prismjs": "^1.29.0",
|
||||||
"progress": "^2.0.3",
|
"progress": "^2.0.3",
|
||||||
"puppeteer": "^21.1.1",
|
"puppeteer": "^21.5.2",
|
||||||
"qs": "^6.10.1",
|
"qs": "^6.10.1",
|
||||||
"rc-footer": "^0.6.8",
|
"rc-footer": "^0.6.8",
|
||||||
"rc-tween-one": "^3.0.3",
|
"rc-tween-one": "^3.0.3",
|
||||||
|
Loading…
Reference in New Issue
Block a user