Repository navigation
66 lines (66 loc) · 2.66 KB
/
Copy pathvtest-pull-request.yml
File metadata and controls
66 lines (66 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: VisualTest(pull request)
on:
pull_request:
jobs:
VisualTest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: main:Cache node modules(yarn.lock)
id: cache
uses: actions/cache@v1
with:
path: main/node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('main/yarn.lock') }}
restore-keys: ${{ runner.OS }}-build-${{ env.cache-name }}-
- name: main:package-install
if: steps.cache.outputs.cache-hit != 'true'
run: yarn --cwd main
- name: main:build
run: yarn --cwd main build
- name: test:Cache node modules(yarn.lock)
id: test-cache
uses: actions/cache@v1
with:
path: test/node_modules
key: ${{ runner.OS }}-build-test-${{ hashFiles('test/yarn.lock') }}
restore-keys: ${{ runner.OS }}-build-${{ env.cache-name }}-
- name: Install Dependencies
if: steps.test-cache.outputs.cache-hit != 'true'
run: yarn --cwd test
- name: Screnn capture
run: yarn --cwd test capture
- name: Regression test
run: |
mkdir __reg__
mv test/__screenshots__ __reg__/actual/
git clone https://github.com/${GITHUB_REPOSITORY} -b captures/${GITHUB_BASE_REF} __reg__/expected
rm -rf __reg__/expected/.git
yarn --cwd test reg-cli ../__reg__/actual ../__reg__/expected ../__reg__/diff -R ../__reg__/index.html -J ../__reg__/reg.json -I
- name: Create pege
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
run: |
num=`echo ${{ github.ref }} | awk -F'/' '{print $3}'`
git clone https://github.com/${GITHUB_REPOSITORY} -b gh-pages __gh-pages__ || mkdir __gh-pages__
NODE_PATH=test/node_modules node .github/scripts/comment.js
mkdir __gh-pages__/$num || true
mv __reg__ __gh-pages__/$num/$GITHUB_RUN_ID
set $(awk -F/ '{print $1, $2}' <<< $GITHUB_REPOSITORY)
url=https://$1.github.io/$2/$num/$GITHUB_RUN_ID
- name: Save regression
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
run: |
cd __gh-pages__
if [ ! -d .git ]; then
git init
git checkout -b gh-pages
git remote add origin https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/$GITHUB_REPOSITORY
fi
git remote set-url origin https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/$GITHUB_REPOSITORY
git config --global user.name $GITHUB_ACTOR
git config --global user.email ${GITHUB_ACTOR}@git
git add .
git commit -m $GITHUB_REF
git push origin gh-pages