-
Notifications
You must be signed in to change notification settings - Fork 7
149 lines (125 loc) · 4.52 KB
/
integration-tests.yaml
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
name: Integration tests
on:
push:
branches:
- "**"
pull_request:
branches:
- main
workflow_dispatch: {}
permissions:
contents: read
jobs:
test-integration:
name: integration tests on ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
arch: x64
targets: AppImage deb rpm
- os: macos-14
arch: arm64
targets: dmg pkg
- os: windows-2022
arch: x64
targets: msi nsis
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Get npm cache directory
shell: bash
run: echo "npm_cache_dir=$(npm config get cache)" >> ${GITHUB_ENV}
- name: Use npm cache
uses: actions/cache@v4
with:
path: ${{ env.npm_cache_dir }}
key: ${{ matrix.os }}-${{ matrix.arch }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ matrix.os }}-${{ matrix.arch }}-node-
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
uses: nick-fields/retry@v3
with:
timeout_minutes: 20
max_attempts: 3
retry_on: any
command: brew install python-setuptools
- name: Install minikube (Linux)
if: runner.os == 'Linux'
uses: medyagh/setup-minikube@master
with:
kubernetes-version: v1.31.0
- name: Install npm dependencies
uses: nick-fields/retry@v3
with:
timeout_minutes: 20
max_attempts: 3
retry_on: any
command: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1"
- name: Detect Playwright version
shell: bash
run: echo "PLAYWRIGHT_VERSION=$(npm ll -p --depth=0 playwright | cut -d@ -f2)" >> $GITHUB_ENV
- name: Put $HOME in env (Windows)
if: runner.os == 'windows'
run: echo "HOME=$HOME" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Use Playwright cache
uses: actions/cache@v4
id: playwright-cache
with:
path: ${{ runner.os == 'Windows' && format('{0}{1}', env.HOME, '\AppData\Local\ms-playwright') || runner.os == 'Linux' && '~/.cache/ms-playwright' || '~/Library/Caches/ms-playwright' }}
key: ${{ matrix.os }}-${{ matrix.arch }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
restore-keys: |
${{ matrix.os }}-${{ matrix.arch }}-playwright-
- name: Install Playwright with dependencies
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: npx playwright install --with-deps
- name: Install Playwright's dependencies
if: steps.playwright-cache.outputs.cache-hit == 'true'
run: npx playwright install-deps
- name: Build NPM packages (macOS x64, Linux arm64)
if: runner.os == 'macOS' && matrix.arch == 'x64' || runner.os == 'Linux' && matrix.arch == 'arm64'
run: npm run build
env:
DOWNLOAD_ALL_ARCHITECTURES: "true"
- name: Build NPM packages (macOS arm64, Linux x64, Windows)
if: runner.os == 'macOS' && matrix.arch == 'arm64' || runner.os == 'Linux' && matrix.arch == 'x64' || runner.os == 'Windows'
run: npm run build
- name: Build Electron app
run: npm run build:app -- -- -- dir ${{ matrix.targets }} --publish=never --${{ matrix.arch }}
- name: Run integration tests (Linux)
if: runner.os == 'Linux'
uses: nick-fields/retry@v3
with:
timeout_minutes: 15
max_attempts: 3
retry_on: timeout
command: |
sudo chown root:root freelens/dist/linux-unpacked/chrome-sandbox
sudo chmod 4755 freelens/dist/linux-unpacked/chrome-sandbox
xvfb-run -a npm run test:integration
env:
DEBUG: pw:browser
- name: Run integration tests (macOS, Windows)
if: runner.os != 'Linux'
uses: nick-fields/retry@v3
with:
timeout_minutes: 15
max_attempts: 3
retry_on: timeout
command: npm run test:integration
env:
DEBUG: pw:browser
- name: Clean after tests
run: npm run clean
- name: Check untracked files
shell: bash
run: for f in $(git ls-files --others --exclude-standard); do git diff --no-index --stat --exit-code /dev/null $f; done