Skip to content

Commit 30e038b

Browse files
authored
misc: Move CI to GitHub Actions (#1111)
* Feature: Split unit/integration tests * Feature: Stop running MSSQL tests on Circle * Feature: Welcome to GitHub Actions * Feature: 60seconds will be enought to pull yandex/clickhouse-server * Feature(ci): Pull images before running test * Feature(ci): Cache lerna * Fix: 20s are enought to start container, 10s to stop * Feature(@cubejs-backend/query-orchestrator): Improve testing * Fix: Lint issues after eslint upgrade * Feature: Run only unit tests on Circle CI (because they offen fails) * Fix: 20s are enought to start container, 10s to stop * Feature(@cubejs-backend/query-orchestrator): PreAggregations test is integration, not unit
1 parent 48ca5aa commit 30e038b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+396
-167
lines changed

.circleci/config.yml

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,6 @@ jobs:
1010
TEST_CLICKHOUSE_HOST: localhost
1111
TEST_LOCAL: true
1212
TEST_DB_PASSWORD: Test1test
13-
- image: circleci/redis:5.0.5
14-
- image: circleci/mysql:5.7
15-
environment:
16-
MYSQL_ROOT_PASSWORD: Test1test
17-
- image: circleci/postgres:9.6.8
18-
environment:
19-
POSTGRES_USER: root
20-
POSTGRES_DB: model_test
21-
- image: yandex/clickhouse-server:19.10
22-
2313

2414
working_directory: ~/repo
2515

@@ -40,52 +30,7 @@ jobs:
4030
- ~/.cache/yarn
4131
key: yarn-packages-v1-{{ .Branch }}-{{ checksum "packages/cubejs-server-core/yarn.lock" }}
4232

43-
- run: yarn lerna run --concurrency 1 --ignore @cubejs-backend/jdbc-driver test
44-
- run: bash <(curl -s https://codecov.io/bash)
45-
46-
test-mssql:
47-
resource_class: medium
48-
docker:
49-
- image: circleci/node:10.17
50-
environment:
51-
TEST_PG_USER: root
52-
TEST_CLICKHOUSE_HOST: localhost
53-
TEST_LOCAL: true
54-
TEST_DB_PASSWORD: Test1test
55-
- image: mcr.microsoft.com/mssql/server:2017-latest
56-
environment:
57-
ACCEPT_EULA: Y
58-
SA_PASSWORD: Test1test
59-
60-
working_directory: ~/repo
61-
62-
steps:
63-
- checkout
64-
65-
- restore_cache:
66-
keys:
67-
- yarn-packages-v1-{{ .Branch }}-{{ checksum "packages/cubejs-server-core/yarn.lock" }}
68-
- yarn-packages-v1-{{ .Branch }}-
69-
- yarn-packages-v1-
70-
71-
- run: yarn install
72-
- run: yarn lerna bootstrap --ignore @cubejs-backend/jdbc-driver
73-
74-
- save_cache:
75-
paths:
76-
- ~/.cache/yarn
77-
key: yarn-packages-v1-{{ .Branch }}-{{ checksum "packages/cubejs-server-core/yarn.lock" }}
78-
79-
- run:
80-
name: install dockerize
81-
command: wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && sudo tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
82-
environment:
83-
DOCKERIZE_VERSION: v0.3.0
84-
- run:
85-
name: Wait for db
86-
command: dockerize -wait tcp://localhost:1433 -timeout 2m
87-
88-
- run: yarn lerna run --concurrency 1 --ignore @cubejs-backend/jdbc-driver test-mssql
33+
- run: yarn lerna run --concurrency 1 --ignore @cubejs-backend/jdbc-driver unit
8934
- run: bash <(curl -s https://codecov.io/bash)
9035

9136
lint:
@@ -215,7 +160,6 @@ workflows:
215160
test:
216161
jobs:
217162
- test
218-
- test-mssql
219163
- build
220164
lint:
221165
jobs:
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: 'Init CI'
2+
description: 'Boostrap repo for testing'
3+
inputs:
4+
node:
5+
description: 'Node.js version'
6+
runs:
7+
using: "composite"
8+
steps:
9+
- name: Use Node.js ${{ inputs.node }}
10+
uses: actions/setup-node@v1
11+
with:
12+
node-version: ${{ inputs.node }}
13+
- name: Cache node modules
14+
uses: actions/cache@v2
15+
with:
16+
# npm cache files are stored in `~/.npm` on Linux/macOS
17+
path: ~/.npm
18+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
19+
restore-keys: |
20+
${{ runner.os }}-build-${{ env.cache-name }}-
21+
${{ runner.os }}-build-
22+
${{ runner.os }}-
23+
- name: Yarn install
24+
uses: borales/[email protected]
25+
with:
26+
cmd: install
27+
- name: Lerna bootstrap
28+
run: yarn lerna bootstrap --ignore @cubejs-backend/jdbc-driver
29+
- name: Lerna tsc
30+
run: yarn lerna run --concurrency 1 tsc

.github/workflows/push.yml

Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
name: CI
2+
3+
on: [push]
4+
5+
jobs:
6+
unit:
7+
runs-on: ubuntu-latest
8+
9+
strategy:
10+
matrix:
11+
node-version: [10.x, 12.x, 14.x]
12+
fail-fast: false
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v2
17+
- name: Use Node.js ${{ matrix.node-version }}
18+
uses: actions/setup-node@v1
19+
with:
20+
node-version: ${{ matrix.node-version }}
21+
- name: Get yarn cache directory path
22+
id: yarn-cache-dir-path
23+
run: echo "::set-output name=dir::$(yarn cache dir)"
24+
- uses: actions/cache@v2
25+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
26+
with:
27+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
28+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
29+
restore-keys: |
30+
${{ runner.os }}-yarn-
31+
- name: Restore lerna
32+
uses: actions/cache@v2
33+
with:
34+
# npm cache files are stored in `~/.npm` on Linux/macOS
35+
path: |
36+
~/.npm
37+
node_modules
38+
*/*/node_modules
39+
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
40+
- name: Yarn install
41+
uses: borales/[email protected]
42+
with:
43+
cmd: install
44+
- name: Lerna bootstrap
45+
run: yarn lerna bootstrap --ignore @cubejs-backend/jdbc-driver
46+
- name: Lerna tsc
47+
run: yarn lerna run --concurrency 1 tsc
48+
- name: Lerna test
49+
run: yarn lerna run --concurrency 1 --ignore @cubejs-backend/jdbc-driver unit
50+
51+
integration-wrk-1:
52+
runs-on: ubuntu-latest
53+
54+
services:
55+
redis:
56+
image: redis
57+
options: >-
58+
--health-cmd "redis-cli ping"
59+
--health-interval 10s
60+
--health-timeout 5s
61+
--health-retries 5
62+
63+
strategy:
64+
matrix:
65+
node-version: [10.x]
66+
fail-fast: false
67+
68+
steps:
69+
- name: Checkout
70+
uses: actions/checkout@v2
71+
- name: Use Node.js ${{ matrix.node-version }}
72+
uses: actions/setup-node@v1
73+
with:
74+
node-version: ${{ matrix.node-version }}
75+
- name: Get yarn cache directory path
76+
id: yarn-cache-dir-path
77+
run: echo "::set-output name=dir::$(yarn cache dir)"
78+
- uses: actions/cache@v2
79+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
80+
with:
81+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
82+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
83+
restore-keys: |
84+
${{ runner.os }}-yarn-
85+
- name: Restore lerna
86+
uses: actions/cache@v2
87+
with:
88+
# npm cache files are stored in `~/.npm` on Linux/macOS
89+
path: |
90+
~/.npm
91+
node_modules
92+
*/*/node_modules
93+
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
94+
- name: Yarn install
95+
uses: borales/[email protected]
96+
with:
97+
cmd: install
98+
- name: Lerna bootstrap
99+
run: yarn lerna bootstrap --ignore @cubejs-backend/jdbc-driver
100+
- name: Lerna tsc
101+
run: yarn lerna run --concurrency 1 tsc
102+
- name: Run Postgres Integration with 9.6
103+
run: |
104+
docker pull postgres:${TEST_PGSQL_VERSION}
105+
yarn lerna run --concurrency 1 --ignore @cubejs-backend/jdbc-driver integration:postgres
106+
env:
107+
TEST_PGSQL_VERSION: 9.6
108+
- name: Run Postgres Integration with 10
109+
run: |
110+
docker pull postgres:${TEST_PGSQL_VERSION}
111+
yarn lerna run --concurrency 1 --ignore @cubejs-backend/jdbc-driver integration:postgres
112+
env:
113+
TEST_PGSQL_VERSION: 10
114+
- name: Run Postgres Integration with 11
115+
run: |
116+
docker pull postgres:${TEST_PGSQL_VERSION}
117+
yarn lerna run --concurrency 1 --ignore @cubejs-backend/jdbc-driver integration:postgres
118+
env:
119+
TEST_PGSQL_VERSION: 11
120+
- name: Run Postgres Integration with 12
121+
run: |
122+
docker pull postgres:${TEST_PGSQL_VERSION}
123+
yarn lerna run --concurrency 1 --ignore @cubejs-backend/jdbc-driver integration:postgres
124+
env:
125+
TEST_PGSQL_VERSION: 12
126+
- name: Run MS SQL Integration with 2017-latest
127+
run: |
128+
docker pull mcr.microsoft.com/mssql/server:${TEST_MSSQL_VERSION}
129+
yarn lerna run --concurrency 1 --ignore @cubejs-backend/jdbc-driver integration:mssql
130+
env:
131+
TEST_MSSQL_VERSION: 2017-latest
132+
- name: Run MS SQL Integration with 2019-latest
133+
run: |
134+
docker pull mcr.microsoft.com/mssql/server:${TEST_MSSQL_VERSION}
135+
yarn lerna run --concurrency 1 --ignore @cubejs-backend/jdbc-driver integration:mssql
136+
env:
137+
TEST_MSSQL_VERSION: 2019-latest
138+
139+
integration-wrk-2:
140+
runs-on: ubuntu-latest
141+
142+
services:
143+
redis:
144+
image: redis
145+
options: >-
146+
--health-cmd "redis-cli ping"
147+
--health-interval 10s
148+
--health-timeout 5s
149+
--health-retries 5
150+
151+
strategy:
152+
matrix:
153+
node-version: [10.x]
154+
fail-fast: false
155+
156+
steps:
157+
- name: Checkout
158+
uses: actions/checkout@v2
159+
- name: Use Node.js ${{ matrix.node-version }}
160+
uses: actions/setup-node@v1
161+
with:
162+
node-version: ${{ matrix.node-version }}
163+
- name: Get yarn cache directory path
164+
id: yarn-cache-dir-path
165+
run: echo "::set-output name=dir::$(yarn cache dir)"
166+
- uses: actions/cache@v2
167+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
168+
with:
169+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
170+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
171+
restore-keys: |
172+
${{ runner.os }}-yarn-
173+
- name: Restore lerna
174+
uses: actions/cache@v2
175+
with:
176+
# npm cache files are stored in `~/.npm` on Linux/macOS
177+
path: |
178+
~/.npm
179+
node_modules
180+
*/*/node_modules
181+
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
182+
- name: Yarn install
183+
uses: borales/[email protected]
184+
with:
185+
cmd: install
186+
- name: Lerna bootstrap
187+
run: yarn lerna bootstrap --ignore @cubejs-backend/jdbc-driver
188+
- name: Lerna tsc
189+
run: yarn lerna run --concurrency 1 tsc
190+
- name: Run MySQL Integration with 5.6
191+
run: |
192+
docker pull mysql:${TEST_MYSQL_VERSION}
193+
yarn lerna run --concurrency 1 --ignore @cubejs-backend/jdbc-driver integration:mysql
194+
env:
195+
TEST_MYSQL_VERSION: 5.6
196+
- name: Run MySQL Integration with 5.7
197+
run: |
198+
docker pull mysql:${TEST_MYSQL_VERSION}
199+
yarn lerna run --concurrency 1 --ignore @cubejs-backend/jdbc-driver integration:mysql
200+
env:
201+
TEST_MYSQL_VERSION: 5.7
202+
- name: Run Clickhouse Integration with 20.6
203+
run: |
204+
docker pull yandex/clickhouse-server:${TEST_CLICKHOUSE_VERSION}
205+
yarn lerna run --concurrency 1 --ignore @cubejs-backend/jdbc-driver integration:clickhouse
206+
env:
207+
TEST_CLICKHOUSE_VERSION: 20.6
208+
- name: Run Clickhouse Integration with 20
209+
run: |
210+
docker pull yandex/clickhouse-server:${TEST_CLICKHOUSE_VERSION}
211+
yarn lerna run --concurrency 1 --ignore @cubejs-backend/jdbc-driver integration:clickhouse
212+
env:
213+
TEST_CLICKHOUSE_VERSION: 20
214+
- name: Run Clickhouse Integration with 19
215+
run: |
216+
docker pull yandex/clickhouse-server:${TEST_CLICKHOUSE_VERSION}
217+
yarn lerna run --concurrency 1 --ignore @cubejs-backend/jdbc-driver integration:clickhouse
218+
env:
219+
TEST_CLICKHOUSE_VERSION: 19

packages/cubejs-api-gateway/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"node": ">=8.11.1"
1313
},
1414
"scripts": {
15-
"test": "jest",
15+
"test": "npm run unit",
16+
"unit": "jest",
1617
"lint": "eslint *.js"
1718
},
1819
"main": "index.js",

packages/cubejs-cli/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"cubejs": "./index.js"
1616
},
1717
"scripts": {
18-
"test": "jest",
18+
"test": "npm run unit",
19+
"unit": "jest",
1920
"lint": "eslint -c ../../.eslintrc.js *.js"
2021
},
2122
"files": [

packages/cubejs-cli/templates.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,6 @@ exports.serverless = {
217217
dependencies: ['@cubejs-backend/serverless', '@cubejs-backend/serverless-aws']
218218
};
219219

220-
221220
exports['serverless-google'] = {
222221
files: {
223222
'index.js': () => handlerJs,

packages/cubejs-clickhouse-driver/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
},
1414
"main": "driver/ClickHouseDriver.js",
1515
"scripts": {
16-
"test": "mocha",
16+
"integration": "mocha",
17+
"integration:clickhouse": "mocha",
1718
"lint": "eslint **/*.js"
1819
},
1920
"dependencies": {

0 commit comments

Comments
 (0)