-
Notifications
You must be signed in to change notification settings - Fork 289
109 lines (105 loc) · 3.53 KB
/
generate-screenshots.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Desktop App - Generate Screenshots
on:
workflow_dispatch:
inputs:
ref:
description: The branch to generate screenshots for.
required: false
number:
description: The pull request number.
required: false
login:
description: The GitHub username that triggered the workflow
required: true
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
is-org-member:
name: "Check Org Member"
uses: ledgerhq/ledger-live/.github/workflows/is-org-member.yml@develop
with:
username: ${{ github.event.inputs.login }}
organisation: ledgerhq
secrets:
token: ${{ secrets.COMMON_READ_ORG }}
generate_screenshots:
needs: [is-org-member]
if: ${{ needs.is-org-member.outputs.is-org-member }}
env:
NODE_OPTIONS: "--max-old-space-size=7168"
INSTRUMENT_BUILD: true
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
# - macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
if: ${{ github.event.inputs.ref != null }}
with:
fetch-depth: 0
- uses: actions/checkout@v3
if: ${{ !github.event.inputs.ref }}
with:
fetch-depth: 0
- uses: pnpm/action-setup@v2.1.0
with:
version: latest
- uses: actions/setup-node@v3
with:
node-version: 16
cache: pnpm
cache-dependency-path: "**/pnpm-lock.yaml"
- uses: actions/setup-python@v2
with:
python-version: "2.7.x"
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
bundler-cache: true
- name: Checkout PR
if: ${{ github.event.inputs.number != null && github.event.inputs.ref == null }}
run: gh pr checkout ${{ github.event.inputs.number }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set git user
run: |
git config user.email "team-live@ledger.fr"
git config user.name "Team Live"
- name: Bump npm to latest
run: npm i -g npm@8.12.2
- name: TurboRepo local server
uses: felixmosh/turborepo-gh-artifacts@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
server-token: "yolo"
- name: Install dependencies
run: pnpm i --filter="ledger-live-desktop..." --filter="ledger-live" --frozen-lockfile --unsafe-perm
- name: Install playwright dependencies
run: npx playwright install-deps
- name: Build dependencies
run: pnpm turbo run ledger-live-desktop#build:testing --api="http://127.0.0.1:9080" --token="yolo" --team="foo"
- name: Run playwright tests [Linux => xvfb-run]
if: matrix.os == 'ubuntu-latest'
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- pnpm desktop test:playwright:update-snapshots
shell: bash
- name: Run playwright tests
if: matrix.os != 'ubuntu-latest'
run: pnpm desktop test:playwright:update-snapshots
shell: bash
- name: status
id: status
run: echo "::set-output name=status::$(git status --porcelain | wc -l)"
- name: Commit snapshots
if: steps.status.outputs.status != 0
run: >
git add ./apps/ledger-live-desktop/tests/specs &&
git commit -m 'update screenshots (${{ matrix.os }})' &&
git restore . &&
git pull --rebase &&
git push ||
echo ""