-
Notifications
You must be signed in to change notification settings - Fork 4
181 lines (159 loc) · 6.94 KB
/
tests.yml
File metadata and controls
181 lines (159 loc) · 6.94 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
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: Test
on:
pull_request:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
# Set minimal permissions for security
permissions:
contents: read
actions: read
checks: write
pull-requests: write
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Setup Node.js with cache
uses: actions/setup-node@v4
with:
node-version: '22.14.0'
cache: 'npm'
- name: Install dependencies with npm@11 (for min-release-age support)
run: |
npx npm@11.10.0 ci
cd webview-ui && npx npm@11.10.0 ci
- name: Allow unprivileged user namespace (ubuntu)
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
- name: Setup Chrome browser (Ubuntu)
if: ${{ startsWith(matrix.os, 'ubuntu') }}
uses: browser-actions/setup-chrome@v1
- name: Setup Chrome browser (macOS)
if: ${{ startsWith(matrix.os, 'macos') }}
uses: browser-actions/setup-chrome@v1
- name: Setup Chrome browser (Windows)
if: ${{ startsWith(matrix.os, 'windows') }}
uses: browser-actions/setup-chrome@v1
# install bruin cli for linux, mac and windows
- name: Install Bruin CLI
run: |
if [ "${{ runner.os }}" = "Windows" ]; then
curl -LsSf https://raw.githubusercontent.com/bruin-data/bruin/refs/heads/main/install.sh | sh
else
curl -LsSL https://raw.githubusercontent.com/bruin-data/bruin/refs/heads/main/install.sh | sh
fi
shell: bash
- name: Compile
run: npm run compile
- name: Build Webview
run: npm run build:webview
- name: Run extension tests
run: |
if [ "${{ runner.os }}" = "Linux" ]; then
xvfb-run -a npm run test
else
npm run test
fi
shell: bash
- name: Run webview tests
run: npm run test:webview
- name: Run basic integration tests
run: |
echo "Running connections and ingestr tests..."
echo "Note: This step continues even if tests fail to prevent random CI failures from blocking builds"
if [ "${{ runner.os }}" = "Linux" ]; then
export CHROME_BIN=$(which google-chrome || which chromium-browser || which chromium)
export CHROME_USER_DATA_DIR="/tmp/chrome-user-data-basic-$$"
xvfb-run --auto-servernum --server-args='-screen 0 1920x1080x24' npm run selenium:run-tests:connections
xvfb-run --auto-servernum --server-args='-screen 0 1920x1080x24' npm run selenium:run-tests:ingestr
elif [ "${{ runner.os }}" = "macOS" ]; then
if [ -f "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" ]; then
export CHROME_BIN="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
fi
export CHROME_USER_DATA_DIR="/tmp/chrome-user-data-basic-$$"
npm run selenium:run-tests:connections
npm run selenium:run-tests:ingestr
else
export CHROME_USER_DATA_DIR="C:\\temp\\chrome-user-data-basic-$$"
npm run selenium:run-tests:connections
npm run selenium:run-tests:ingestr
fi
shell: bash
- name: Run webview integration tests
run: |
echo "Running webview tests..."
echo "Note: This step continues even if tests fail to prevent random CI failures from blocking builds"
if [ "${{ runner.os }}" = "Linux" ]; then
export CHROME_BIN=$(which google-chrome || which chromium-browser || which chromium)
export CHROME_USER_DATA_DIR="/tmp/chrome-user-data-webview-$$"
xvfb-run --auto-servernum --server-args='-screen 0 1920x1080x24' npm run selenium:run-tests:webview
elif [ "${{ runner.os }}" = "macOS" ]; then
if [ -f "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" ]; then
export CHROME_BIN="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
fi
export CHROME_USER_DATA_DIR="/tmp/chrome-user-data-webview-$$"
npm run selenium:run-tests:webview
else
export CHROME_USER_DATA_DIR="C:\\temp\\chrome-user-data-webview-$$"
npm run selenium:run-tests:webview
fi
shell: bash
- name: Run lineage integration tests
run: |
echo "Running lineage tests..."
echo "Note: This step continues even if tests fail to prevent random CI failures from blocking builds"
if [ "${{ runner.os }}" = "Linux" ]; then
export CHROME_BIN=$(which google-chrome || which chromium-browser || which chromium)
export CHROME_USER_DATA_DIR="/tmp/chrome-user-data-lineage-$$"
xvfb-run --auto-servernum --server-args='-screen 0 1920x1080x24' npm run selenium:run-tests:lineage
elif [ "${{ runner.os }}" = "macOS" ]; then
if [ -f "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" ]; then
export CHROME_BIN="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
fi
export CHROME_USER_DATA_DIR="/tmp/chrome-user-data-lineage-$$"
npm run selenium:run-tests:lineage
else
export CHROME_USER_DATA_DIR="C:\\temp\\chrome-user-data-lineage-$$"
npm run selenium:run-tests:lineage
fi
shell: bash
- name: Run query preview integration tests
run: |
echo "Running query preview tests..."
echo "Note: This step continues even if tests fail to prevent random CI failures from blocking builds"
if [ "${{ runner.os }}" = "Linux" ]; then
export CHROME_BIN=$(which google-chrome || which chromium-browser || which chromium)
export CHROME_USER_DATA_DIR="/tmp/chrome-user-data-query-preview-$$"
xvfb-run --auto-servernum --server-args='-screen 0 1920x1080x24' npm run selenium:run-tests:query-preview
elif [ "${{ runner.os }}" = "macOS" ]; then
if [ -f "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" ]; then
export CHROME_BIN="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
fi
export CHROME_USER_DATA_DIR="/tmp/chrome-user-data-query-preview-$$"
npm run selenium:run-tests:query-preview
else
export CHROME_USER_DATA_DIR="C:\\temp\\chrome-user-data-query-preview-$$"
npm run selenium:run-tests:query-preview
fi
shell: bash
- name: Store UI test logs
uses: actions/upload-artifact@v4
if: failure() || cancelled()
with:
name: logs-${{ matrix.os }}
path: test-resources/settings/logs/*
- name: Store UI Test screenshots
uses: actions/upload-artifact@v4
if: failure() || cancelled()
with:
name: screenshots-${{ matrix.os }}
path: test-resources/screenshots/*.png