mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-23 18:50:06 +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.
|
||||
|
||||
name: Visual Regression Persist Finish
|
||||
name: 👁️ Visual Regression Persist Finish
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["name: Visual Regression Persist Start"]
|
||||
workflows: ["👁️ Visual Regression Persist Start"]
|
||||
types:
|
||||
- completed
|
||||
|
||||
@ -76,10 +76,10 @@ jobs:
|
||||
workflow: ${{ github.event.workflow_run.workflow_id }}
|
||||
run_id: ${{ github.event.workflow_run.id }}
|
||||
name: image-snapshots
|
||||
path: imageSnapshots
|
||||
path: ./
|
||||
|
||||
- name: Persist to Snapshot Repo
|
||||
if: github.event.pull_request.head.ref == 'master'
|
||||
if: github.ref_name == 'master'
|
||||
id: persist
|
||||
continue-on-error: true
|
||||
env:
|
||||
@ -87,21 +87,27 @@ jobs:
|
||||
# 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 https://$GITHUB_TOKEN@github.com/ant-design/antd-image-snapshots.git
|
||||
|
||||
echo "✅ Clone Finished"
|
||||
|
||||
git clone git@github.com: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/
|
||||
|
||||
rm -rf antd-image-snapshots/imageSnapshots/*
|
||||
tar -xzvf imageSnapshots.tar.gz -C antd-image-snapshots/imageSnapshots
|
||||
|
||||
echo "✅ Changes Finished"
|
||||
|
||||
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 config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
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.
|
||||
|
||||
name: Visual Regression Persist Start
|
||||
name: 👁️ Visual Regression Persist Start
|
||||
|
||||
on:
|
||||
push:
|
||||
@ -15,7 +15,6 @@ jobs:
|
||||
setup:
|
||||
name: prepare node_modules
|
||||
runs-on: ubuntu-latest
|
||||
container: ghcr.io/puppeteer/puppeteer:21.5.2
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
@ -67,12 +66,12 @@ jobs:
|
||||
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
|
||||
|
||||
- name: generate image snapshots
|
||||
id: site
|
||||
run: |
|
||||
node node_modules/puppeteer/install.mjs
|
||||
npm run version
|
||||
npm run test-image
|
||||
tar -czvf imageSnapshots.tar.gz imageSnapshots/*
|
||||
env:
|
||||
SITE_ENV: development
|
||||
NODE_OPTIONS: "--max_old_space_size=4096"
|
||||
|
||||
# Upload `imageSnapshots` on master
|
||||
@ -80,7 +79,7 @@ jobs:
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: image-snapshots
|
||||
path: imageSnapshots/
|
||||
path: imageSnapshots.tar.gz
|
||||
|
||||
# Upload git ref for next workflow `visual-regression-persist-finish` use
|
||||
- name: Save persist key
|
||||
|
@ -1,6 +1,7 @@
|
||||
// jest-puppeteer.config.js
|
||||
module.exports = {
|
||||
launch: {
|
||||
ignoreDefaultArgs: ['--disable-extensions'],
|
||||
args: [
|
||||
// Required for Docker version of Puppeteer
|
||||
'--no-sandbox',
|
||||
|
@ -274,7 +274,7 @@
|
||||
"pretty-format": "^29.0.0",
|
||||
"prismjs": "^1.29.0",
|
||||
"progress": "^2.0.3",
|
||||
"puppeteer": "^21.1.1",
|
||||
"puppeteer": "^21.5.2",
|
||||
"qs": "^6.10.1",
|
||||
"rc-footer": "^0.6.8",
|
||||
"rc-tween-one": "^3.0.3",
|
||||
|
Loading…
Reference in New Issue
Block a user