diff --git a/.github/workflows/visual-regression-persist-finish.yml b/.github/workflows/visual-regression-persist-finish.yml index af7a76ecff..45539c11c0 100644 --- a/.github/workflows/visual-regression-persist-finish.yml +++ b/.github/workflows/visual-regression-persist-finish.yml @@ -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" diff --git a/.github/workflows/visual-regression-persist-start.yml b/.github/workflows/visual-regression-persist-start.yml index 946c3213e3..82e0f6c54e 100644 --- a/.github/workflows/visual-regression-persist-start.yml +++ b/.github/workflows/visual-regression-persist-start.yml @@ -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 diff --git a/jest-puppeteer.config.js b/jest-puppeteer.config.js index fb644512ed..ae97f22bd9 100644 --- a/jest-puppeteer.config.js +++ b/jest-puppeteer.config.js @@ -1,6 +1,7 @@ // jest-puppeteer.config.js module.exports = { launch: { + ignoreDefaultArgs: ['--disable-extensions'], args: [ // Required for Docker version of Puppeteer '--no-sandbox', diff --git a/package.json b/package.json index 109d706c43..c50c5f51b5 100644 --- a/package.json +++ b/package.json @@ -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",