forked from beekeeper-studio/beekeeper-studio
-
Notifications
You must be signed in to change notification settings - Fork 0
189 lines (158 loc) · 5.66 KB
/
studio-test.yml
File metadata and controls
189 lines (158 loc) · 5.66 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
182
183
184
185
186
187
188
189
name: Studio Tests
on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- main
- master
paths-ignore:
- apps/sqltools/**
pull_request:
paths-ignore:
- apps/sqltools/**
jobs:
setup:
runs-on: ubuntu-24.04
outputs:
test-chunks: ${{ steps['set-test-chunks'].outputs['test-chunks'] }}
steps:
- name: 'Setup jq'
uses: dcarbone/install-jq-action@v2
with:
version: "1.7"
force: true
- uses: actions/checkout@v2
- id: set-test-chunks
name: Set Chunks
run: echo "::set-output name=test-chunks::$(./bin/get-db-files-as-json.sh)"
unit:
name: Unit tests
runs-on: ubuntu-24.04
steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile
env:
npm_config_node_gyp: ${{ github.workspace }}${{ runner.os == 'Windows' && '\node_modules\node-gyp\bin\node-gyp.js' || '/node_modules/node-gyp/bin/node-gyp.js' }}
- name: Lint
run: yarn workspace beekeeper-studio run lint
- name: Check for bad files
run: bin/check-for-only-tests.sh
- name: Check for license-breaking includes
run: bin/check-for-src-commercial.sh
- name: Check for bad log imports
run: bin/check-for-electron-log-imports.sh
- name: Check for missing lodash imports
run: bin/check-lodash.sh
- name: Unit Tests
run: yarn workspace beekeeper-studio run test:unit --ci --silent
- name: Non-DB Integration Tests
run: yarn workspace beekeeper-studio run test:ci --ci --silent
- name: Unit Tests (UI Kit)
run: yarn workspace @beekeeperstudio/ui-kit run test --silent
integration:
name: 🥞 ${{ matrix.chunk[0] }}
runs-on: ubuntu-24.04
needs:
- setup
strategy:
fail-fast: false
matrix:
chunk: ${{ fromJson(needs.setup.outputs['test-chunks']) }}
steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: yarn
- name: Install libaio (for oracle)
run: sudo apt install libaio-dev
- name: Symlink libaio v1 (for oracle)
run: sudo ln -s /usr/lib/x86_64-linux-gnu/libaio.so.1t64 /usr/lib/x86_64-linux-gnu/libaio.so.1
- name: yarn install (with retry)
uses: nick-fields/retry@v2
with:
timeout_minutes: 20
max_attempts: 3
command: "yarn install --frozen-lockfile --network-timeout 100000"
env:
npm_config_node_gyp: ${{ github.workspace }}${{ runner.os == 'Windows' && '\node_modules\node-gyp\bin\node-gyp.js' || '/node_modules/node-gyp/bin/node-gyp.js' }}
- name: Test
uses: nick-fields/retry@v2
with:
timeout_minutes: 20
max_attempts: 2
on_retry_command: "docker ps -aq | xargs docker stop | xargs docker rm"
command: yarn workspace beekeeper-studio run test:integration --runInBand --ci ${{ matrix.chunk[1] }}
env:
TESTCONTAINERS_RYUK_DISABLED: true
# codemirror:
# name: CodeMirror tests
# runs-on: ubuntu-latest
# steps:
# - name: Check out Git repository
# uses: actions/checkout@v2
# - name: Install Node.js, NPM and Yarn
# uses: actions/setup-node@v3
# with:
# node-version-file: '.nvmrc'
# cache: yarn
# - name: Install dependencies
# run: yarn install --frozen-lockfile
# env:
# npm_config_node_gyp: ${{ github.workspace }}${{ runner.os == 'Windows' && '\node_modules\node-gyp\bin\node-gyp.js' || '/node_modules/node-gyp/bin/node-gyp.js' }}
# - name: Test
# uses: nick-fields/retry@v2
# with:
# timeout_minutes: 20
# max_attempts: 2
# on_retry_command: "docker ps -aq | xargs docker stop | xargs docker rm"
# command: yarn workspace beekeeper-studio run test:codemirror --runInBand --ci
e2e:
name: E2E tests
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile
env:
npm_config_node_gyp: ${{ github.workspace }}${{ runner.os == 'Windows' && '\node_modules\node-gyp\bin\node-gyp.js' || '/node_modules/node-gyp/bin/node-gyp.js' }}
- name: Start postgres container
run: docker compose up psql15 -d
- name: Serve + Run Tests
run: |
xvfb-run --auto-servernum --server-args="-screen 0 1024x768x24" bash -c '
yarn run electron:serve > server.log 2>&1 &
sleep 15
cat server.log # (Optional: see if it launched correctly)
yarn workspace beekeeper-studio test:e2e:ci
'
env:
ELECTRON_ENABLE_LOGGING: 1
ELECTRON_DISABLE_SANDBOX: 1
ELECTRON_EXTRA_LAUNCH_ARGS: "--disable-gpu"
# - name: Run E2E Tests
# run: yarn test:e2e:ci
# continue-on-error: true
- name: Upload test results
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: test-results
path: apps/studio/test-results
retention-days: 30