forked from LedgerHQ/ledger-live-desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
159 lines (156 loc) · 5.74 KB
/
checks.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: CI
on:
pull_request:
branches:
- develop
- master
push:
branches:
- develop
- master
jobs:
start-runner:
name: start self-hosted EC2 runner
runs-on: [ledger-live-desktop]
outputs:
label: ${{ steps.start-ec2-runner.outputs.label }}
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: get latest LLD runner AMI id
id: get-ami-id
run: |
echo "::set-output name=ami-id::$(aws ec2 describe-images --filters 'Name=name,Values=ledger-live-desktop-runner' --query 'Images[*].ImageId' --output text)"
- name: start EC2 runner
id: start-ec2-runner
uses: machulav/ec2-github-runner@v2
with:
mode: start
github-token: ${{ secrets.CI_BOT_TOKEN }}
ec2-image-id: ${{ steps.get-ami-id.outputs.ami-id }}
ec2-instance-type: c5.4xlarge
subnet-id: subnet-03b7b4dff904e0142 # production-shared-private-eu-west-1a
security-group-id: sg-010daba499648d1e7 # infra-gha-runner-sg
- name: get volume-id
id: get-volume-id
run: |
echo "::set-output name=volume-id::$(aws ec2 describe-instances --instance-ids ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} --query 'Reservations[*].Instances[*].BlockDeviceMappings[*].Ebs.VolumeId' --output text)"
- name: resize rootfs
env:
VOLUME_ID: ${{ steps.get-volume-id.outputs.volume-id }}
run: |
aws ec2 modify-volume --size 30 --volume-id $VOLUME_ID
test:
name: run UI tests
runs-on: ${{ needs.start-runner.outputs.label }}
needs: start-runner
steps:
- name: prepare runner
run: |
sudo growpart /dev/nvme0n1 1
sudo resize2fs /dev/nvme0n1p1
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- uses: actions/setup-node@main
with:
node-version: 14.x
- name: install yarn
if: always()
run: npm install --global yarn
- name: install and switch to GCC 5.4
if: always()
run: ./tools/g++-5.4/install.sh
- name: install dependencies
if: always()
env:
JOBS: max
run: yarn --frozen-lockfile
- name: run code checks
if: always()
run: yarn ci 2> >(tee lint.txt)
- name: check build
if: always()
env:
INSTRUMENT_BUILD: true
run: yarn build
- name: Tests
if: always()
run: yarn test 2> >(tee jest.txt)
- name: start electron webdriver
if: always()
env:
DISPLAY: :99.0
TZ: America/New_York
run: |
xvfb-run -a --server-args="-screen 0 1024x788x24 -ac +extension RANDR" node_modules/electron-chromedriver/chromedriver.js --port=9515 --whitelisted-ips="" --url-base=/ &
- name: wait for webdriver
if: always()
run: bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9515)" != "404" ]]; do sleep 5; done'
- name: run spectron
if: always()
run: yarn spectron --no-color 2> >(tee output.txt)
- name: run coverage generation
if: always() && github.event_name == 'push'
run: yarn spectron-coverage
env:
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
- name: upload diffs to imgur
if: always()
uses: ./.github/actions/upload-images
id: imgur
with:
path: tests/specs/__image_snapshots__/__diff_output__
- name: clean diff
if: always()
run: rm -f tests/specs/__image_snapshots__/__diff_output__/*.png
- name: upload ci suggested screenshots
uses: actions/upload-artifact@v2
if: always()
with:
name: ci-suggested-screenshots
path: tests/specs/__image_snapshots__/__diff_output__/
- name: generate imgChanged
run: |
git remote add ledger https://github.com/LedgerHQ/ledger-live-desktop.git
git fetch ledger
git diff --name-only ledger/${{github.base_ref}}..${{github.event.pull_request.head.sha}} -- tests/specs/__image_snapshots__ >imgChanged.txt
if: always() && github.event_name == 'pull_request'
- name: send comment
if: always()
id: comment
uses: ./.github/actions/comment
with:
images: ${{ steps.imgur.outputs.images }}
fullrepo: ${{ github.repository }}
runId: ${{ github.run_id }}
testoutput: ./output.txt
lintoutput: ./lint.txt
jestoutput: ./jest.txt
imgChanged: ./imgChanged.txt
author: ${{github.event.sender.login}}
pullId: ${{github.event.number}}
from: ${{github.base_ref}}
to: ${{github.event.pull_request.head.sha}}
sha: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Send message to Slack channel
uses: archive/[email protected]
if: always() && github.event_name == 'push'
id: notify
with:
slack-bot-user-oauth-access-token: ${{ secrets.SLACK_BOT_USER_OAUTH_ACCESS_TOKEN }}
slack-channel: live-ui-tests
slack-text: ${{ steps.comment.outputs.bodySlack }}
stop-runner:
name: Stop self-hosted EC2 runner
needs: [start-runner, test]
runs-on: [ledger-live-desktop]
if: ${{ always() }}
steps:
- name: Stop EC2 runner
uses: machulav/ec2-github-runner@v2
with:
mode: stop
github-token: ${{ secrets.CI_BOT_TOKEN }}
label: ${{ needs.start-runner.outputs.label }}
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }}