-
Notifications
You must be signed in to change notification settings - Fork 5
81 lines (69 loc) · 2.79 KB
/
screenshot-testing.yml
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Screenshot test
# push:
# paths:
# - ".github/workflows/figma-export.yml"
on:
workflow_dispatch:
inputs:
fileID:
description: "Put Figma FileID to generate screenshot testing"
required: true
default: "WCkDDzlXE16R6yXaljxddj"
draft:
type: boolean
default: true
description: Draft PR
env:
FIGMA_TOKEN: ${{ secrets.FIGMA_TOKEN}}
jobs:
generate-screenshots:
name: Acceptance tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Instalar Homebrew
run: |
git checkout -b acceptance-tests
sudo apt-get update -y
sudo apt-get install -y librsvg2-2
sudo apt-get install librsvg2-bin
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- name: Update master to last version
run: |
export FIGMA_TOKEN=figd_6Zp3HkWokqz7z7sFS5h4WPn6PSVkdbkhMNr5iaS-
npx -p @figma-export/cli -p @figma-export/output-components-as-svg figma-export components WCkDDzlXE16R6yXaljxddj -O @figma-export/output-components-as-svg
- name: convert-svg2png
run: |
find output -type f -name "*.svg" -exec rsvg-convert {} -o {}.png \;
find output -type f -name "*.svg" -exec rm -f {} \;
- name: Commit & Push
run: |
git pull origin acceptance-tests
git config user.name "github-actions"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Screenshot tests from master"
git push origin acceptance-tests
- name: Screenshot testing!
run: |
export FIGMA_TOKEN=figd_6Zp3HkWokqz7z7sFS5h4WPn6PSVkdbkhMNr5iaS-
npx -p @figma-export/cli -p @figma-export/output-components-as-svg figma-export components ${{ github.event.inputs.fileID }} -O @figma-export/output-components-as-svg
- name: convert-svg2png
run: |
find output -type f -name "*.svg" -exec rsvg-convert {} -o {}.png \;
find output -type f -name "*.svg" -exec rm -f {} \;
- name: Commit & Push
run: |
git config user.name "github-actions"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Screenshot tests"
git push origin ${{ github.event.inputs.fileID }}
# - name: Create Pull-Request
# uses: repo-sync/pull-request@v2
# with:
# source_branch: ${{ github.event.inputs.fileID }}
# destination_branch: "acceptance-tests"
# pr_title: "Acceptance tests for ${{ github.event.inputs.fileID }} file"
# pr_draft: ${{ github.event.inputs.draft }}
# github_token: ${{ secrets.GITHUB_TOKEN }}