Skip to content

Commit 2fe6376

Browse files
reuse built frontend in ci, merge compose files
1 parent 24dec19 commit 2fe6376

18 files changed

+346
-322
lines changed

.ci/compose.ci.yaml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.ci/compose.cypress.yaml

Lines changed: 0 additions & 73 deletions
This file was deleted.

.ci/docker_build

Lines changed: 0 additions & 39 deletions
This file was deleted.

.ci/pack

Lines changed: 0 additions & 9 deletions
This file was deleted.

.ci/update_version

Lines changed: 0 additions & 6 deletions
This file was deleted.

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
client/.tmp/
2-
client/dist/
32
node_modules/
43
viz-lib/node_modules/
54
.tmp/

.github/workflows/ci.yml

Lines changed: 49 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,28 @@ on:
33
push:
44
branches:
55
- master
6+
tags:
7+
- '*'
68
pull_request_target:
79
branches:
810
- master
911
env:
1012
NODE_VERSION: 18
1113
YARN_VERSION: 1.22.22
14+
REDASH_COOKIE_SECRET: "2H9gNG9obnAQ9qnR9BDTQUph6CbXKCzF"
15+
COMPOSE_DOCKER_CLI_BUILD: 1
16+
DOCKER_BUILDKIT: 1
17+
FRONTEND_BUILD_MODE: 1
18+
INSTALL_GROUPS: main,all_ds,dev
19+
SERVER_MOUNT: /ignore
20+
PERCY_BRANCH: ${{github.head_ref || github.ref_name}}
21+
PERCY_COMMIT: ${{github.sha}}
22+
PERCY_PULL_REQUEST: ${{github.event.number}}
23+
COMMIT_INFO_BRANCH: ${{github.head_ref || github.ref_name}}
24+
COMMIT_INFO_MESSAGE: ${{github.event.head_commit.message}}
25+
COMMIT_INFO_AUTHOR: ${{github.event.pull_request.user.login}}
26+
COMMIT_INFO_SHA: ${{github.sha}}
27+
COMMIT_INFO_REMOTE: ${{github.server_url}}/${{github.repository}}
1228
jobs:
1329
backend-lint:
1430
runs-on: ubuntu-22.04
@@ -23,18 +39,15 @@ jobs:
2339
- uses: actions/setup-python@v5
2440
with:
2541
python-version: '3.8'
26-
- run: sudo pip install black==23.1.0 ruff==0.0.287
42+
- run: sudo pip install black==23.12.1 ruff==0.1.9
2743
- run: ruff check .
2844
- run: black --check .
2945

3046
backend-unit-tests:
3147
runs-on: ubuntu-22.04
3248
needs: backend-lint
3349
env:
34-
COMPOSE_FILE: .ci/compose.ci.yaml
35-
COMPOSE_PROJECT_NAME: redash
36-
COMPOSE_DOCKER_CLI_BUILD: 1
37-
DOCKER_BUILDKIT: 1
50+
FRONTEND_BUILD_MODE: 0
3851
steps:
3952
- if: github.event.pull_request.mergeable == 'false'
4053
name: Exit if PR is not mergeable
@@ -46,31 +59,31 @@ jobs:
4659
- name: Build Docker Images
4760
run: |
4861
set -x
49-
docker compose build --build-arg install_groups="main,all_ds,dev" --build-arg skip_frontend_build=true
62+
docker compose build
5063
docker compose up -d
5164
sleep 10
5265
- name: Create Test Database
53-
run: docker compose -p redash run --rm postgres psql -h postgres -U postgres -c "create database tests;"
66+
run: docker compose run --rm postgres psql -h postgres -U postgres -c "create database tests;"
5467
- name: List Enabled Query Runners
55-
run: docker compose -p redash run --rm redash manage ds list_types
68+
run: docker compose run --rm server manage ds list_types
5669
- name: Run Tests
57-
run: docker compose -p redash run --name tests redash tests --junitxml=junit.xml --cov-report=xml --cov=redash --cov-config=.coveragerc tests/
70+
run: docker compose run --name tests server tests --junitxml=junit.xml --cov-report=xml --cov=redash --cov-config=.coveragerc tests/
5871
- name: Copy Test Results
5972
run: |
6073
mkdir -p /tmp/test-results/unit-tests
6174
docker cp tests:/app/coverage.xml ./coverage.xml
6275
docker cp tests:/app/junit.xml /tmp/test-results/unit-tests/results.xml
6376
- name: Upload coverage reports to Codecov
64-
uses: codecov/codecov-action@v3
77+
uses: codecov/codecov-action@v4
6578
- name: Store Test Results
66-
uses: actions/upload-artifact@v3
79+
uses: actions/upload-artifact@v4
6780
with:
68-
name: test-results
81+
name: backend-test-results
6982
path: /tmp/test-results
7083
- name: Store Coverage Results
71-
uses: actions/upload-artifact@v3
84+
uses: actions/upload-artifact@v4
7285
with:
73-
name: coverage
86+
name: backend-coverage
7487
path: coverage.xml
7588

7689
frontend-lint:
@@ -90,13 +103,14 @@ jobs:
90103
- name: Install Dependencies
91104
run: |
92105
npm install --global --force yarn@$YARN_VERSION
93-
yarn cache clean && yarn --frozen-lockfile --network-concurrency 1
106+
yarn cache clean
107+
yarn --frozen-lockfile --network-concurrency 1
94108
- name: Run Lint
95109
run: yarn lint:ci
96110
- name: Store Test Results
97-
uses: actions/upload-artifact@v3
111+
uses: actions/upload-artifact@v4
98112
with:
99-
name: test-results
113+
name: frontend-test-results
100114
path: /tmp/test-results
101115

102116
frontend-unit-tests:
@@ -117,24 +131,25 @@ jobs:
117131
- name: Install Dependencies
118132
run: |
119133
npm install --global --force yarn@$YARN_VERSION
120-
yarn cache clean && yarn --frozen-lockfile --network-concurrency 1
134+
yarn cache clean
135+
yarn --frozen-lockfile --network-concurrency 1
121136
- name: Run App Tests
122137
run: yarn test
123138
- name: Run Visualizations Tests
124-
run: cd viz-lib && yarn test
139+
run: |
140+
cd viz-lib
141+
yarn test
125142
- run: yarn lint
126143

127144
frontend-e2e-tests:
128145
runs-on: ubuntu-22.04
129146
needs: frontend-lint
130147
env:
131-
COMPOSE_FILE: .ci/compose.cypress.yaml
132-
COMPOSE_PROJECT_NAME: cypress
133148
CYPRESS_INSTALL_BINARY: 0
134149
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1
135-
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
136-
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
137-
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
150+
INSTALL_GROUPS: main
151+
COMPOSE_PROFILES: e2e
152+
REDASH_PRODUCTION: "true"
138153
steps:
139154
- if: github.event.pull_request.mergeable == 'false'
140155
name: Exit if PR is not mergeable
@@ -154,10 +169,12 @@ jobs:
154169
- name: Install Dependencies
155170
run: |
156171
npm install --global --force yarn@$YARN_VERSION
157-
yarn cache clean && yarn --frozen-lockfile --network-concurrency 1
172+
yarn cache clean
173+
yarn --frozen-lockfile --network-concurrency 1
158174
- name: Setup Redash Server
159175
run: |
160176
set -x
177+
yarn build
161178
yarn cypress build
162179
yarn cypress start -- --skip-db-seed
163180
docker compose run cypress yarn cypress db-seed
@@ -169,7 +186,12 @@ jobs:
169186
- name: Copy Code Coverage Results
170187
run: docker cp cypress:/usr/src/app/coverage ./coverage || true
171188
- name: Store Coverage Results
172-
uses: actions/upload-artifact@v3
189+
uses: actions/upload-artifact@v4
173190
with:
174-
name: coverage
191+
name: frontend-coverage
175192
path: coverage
193+
- uses: actions/upload-artifact@v4
194+
with:
195+
name: frontend
196+
path: client/dist
197+
retention-days: 1

0 commit comments

Comments
 (0)