ant-design/.github/workflows/visual-regression-persist-start.yml
afc163 0a18e5ba41
chore: improve publish process (#48264)
* chore: improve publish process by skipping test command (#48230)

* chore: speed up publishing

* chore: check runs

* chore: check runs

* chore: check runs

* chore: check runs

* chore: check runs

* chore: check runs

* chore: check runs

* chore: check runs

* chore: check runs

* chore: check runs

* chore: check runs

* chore: skip test

* fix: types

* revert demo change

* fix: script

* chore: fix duplicate parts

* chore: fix duplicate parts

* chore: fix duplicate parts

* improve code

* use latest.hash

chore: download build artifacts from remote

chore: skip build when publish

chore: improve cli log

chore: fix something

chore: fix something

chore: fix something

chore: fix something

chore: fix something

chore: fix upload-build-artifacts

chore: fix needs

chore: fix needs

* chore: check map files

* chore: check package diff before publish

* chore Please use `npm publish` instead

* chore: sort-package-json

* chore: fix needs

* chore: import download process

* fix types

* fix types

* chore: update scripts

* chore: codesandbox ci

* fix token:statistic

* fix token:statistic

* fix ci

* fix ci

* chore: codesandbox ci

* fix ci

* chore: only upload when push to master
2024-04-07 19:14:44 +08:00

96 lines
2.6 KiB
YAML

# 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
- feature
permissions:
contents: read
jobs:
# Prepare node modules. Reuse cache if available
setup:
name: prepare node_modules
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: cache package-lock.json
uses: actions/cache@v4
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@v4
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@v4
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
- name: generate image snapshots
run: |
node node_modules/puppeteer/install.mjs
npm run version
npm run test:image
tar -czvf imageSnapshots.tar.gz imageSnapshots/*
env:
NODE_OPTIONS: "--max_old_space_size=4096"
# Upload `imageSnapshots` on master
- name: upload report artifact
uses: actions/upload-artifact@v4
with:
name: image-snapshots
path: imageSnapshots.tar.gz
# 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@v4
with:
name: visual-regression-ref
path: ./visual-regression-ref.txt