Skip to content

Commit d55b3f9

Browse files
author
Cezary Statkiewicz
committed
Merge branch '2613_run_lint_first_in_ci' into 'develop'
#2613 add lint ci stage, run before tests Closes #2613 See merge request baserow/baserow!3293
2 parents 9c014d5 + a240250 commit d55b3f9

File tree

2 files changed

+39
-11
lines changed

2 files changed

+39
-11
lines changed

Diff for: .gitlab-ci.yml

+29-11
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ include: '/.gitlab/ci_includes/jobs.yml'
44

55
stages:
66
- build
7+
- lint
78
- test
89
- build-final
910
- publish
@@ -193,6 +194,7 @@ build-backend-image:
193194
# If pipeline not triggered by tag:
194195
# - Runs the backend lint if changes to the backend, otherwise skips.
195196
backend-lint:
197+
stage: lint
196198
extends:
197199
- .docker-image-test-stage
198200
- .skippable-job
@@ -207,6 +209,7 @@ backend-check-startup-python:
207209
extends:
208210
- .docker-image-test-stage
209211
- .skippable-job
212+
- .requires-lint
210213
services:
211214
- name: $CI_DIND_IMAGE
212215
alias: docker
@@ -222,8 +225,6 @@ backend-check-startup-python:
222225
FF_NETWORK_PER_BUILD: 1
223226
script:
224227
- docker run --rm --network=host $BACKEND_CI_DEV_IMAGE ci-check-startup
225-
needs:
226-
- job: build-backend-image
227228

228229
# If pipeline not triggered by tag:
229230
# - Runs the backend tests (the first 1/3) if changes to the backend, otherwise skips.
@@ -232,6 +233,7 @@ backend-test-group-1:
232233
extends:
233234
- .docker-image-test-stage
234235
- .skippable-job
236+
- .requires-lint
235237
services:
236238
- name: $CI_DIND_IMAGE
237239
alias: docker
@@ -261,8 +263,7 @@ backend-test-group-1:
261263
$BACKEND_CI_DEV_IMAGE $TEST_TYPE $PYTEST_EXTRA_ARGS;
262264
- docker cp baserow_backend_test_container:/baserow/backend/reports .
263265
- docker rm baserow_backend_test_container
264-
needs:
265-
- job: build-backend-image
266+
266267
artifacts:
267268
name: "$CI_JOB_NAME-reports"
268269
paths:
@@ -345,6 +346,16 @@ collect-backend-coverage:
345346
artifacts: true
346347
- job: backend-test-group-5
347348
artifacts: true
349+
- job: backend-test-group-6
350+
artifacts: true
351+
- job: backend-test-group-7
352+
artifacts: true
353+
- job: backend-test-group-8
354+
artifacts: true
355+
- job: backend-test-group-9
356+
artifacts: true
357+
- job: backend-test-group-10
358+
artifacts: true
348359
script:
349360
- . /baserow/venv/bin/activate
350361
# The reports artifacts will be extracted before the script runs into reports by
@@ -361,6 +372,7 @@ collect-backend-coverage:
361372
path: coverage.xml
362373
coverage: '/^TOTAL.+?(\d+\%)$/'
363374

375+
364376
# If pipeline not triggered by tag:
365377
# - Build and store non-dev images in CI repo under the `ci-tested` tag so we know
366378
# those images have passed the tests.
@@ -414,6 +426,7 @@ build-web-frontend-image:
414426
# If pipeline not triggered by tag:
415427
# - Runs eslint and stylelint if the web-frontend code has changed, otherwise skips.
416428
web-frontend-lint:
429+
stage: lint
417430
extends:
418431
- .docker-image-test-stage
419432
- .skippable-job
@@ -431,11 +444,10 @@ web-frontend-test:
431444
extends:
432445
- .docker-image-test-stage
433446
- .skippable-job
447+
- .requires-lint
434448
variables:
435449
RUN_WHEN_CHANGES_MADE_IN: "web-frontend/ premium/web-frontend/ enterprise/web-frontend/"
436450
DOWNLOAD_AND_UNPACK_ARTIFACTS_ON_SKIP: 'true'
437-
needs:
438-
- job: build-web-frontend-image
439451
script:
440452
- mkdir reports/ -p
441453
- TEST_TYPE=$([[ "$ENABLE_COVERAGE" = "true" ]] && echo "ci-test" || echo "test")
@@ -458,6 +470,7 @@ zapier-integration-test:
458470
extends:
459471
- .docker-image-test-stage
460472
- .skippable-job
473+
- .requires-lint
461474
variables:
462475
RUN_WHEN_CHANGES_MADE_IN: "integrations/zapier"
463476
script:
@@ -469,15 +482,14 @@ zapier-integration-test:
469482
# - Build and store non-dev images in CI repo under the `ci-tested` tag so we know
470483
# those images have passed the tests.
471484
build-final-web-frontend-image:
472-
extends: .build-final-baserow-image
473-
needs:
474-
- job: web-frontend-test
475-
- job: web-frontend-lint
485+
extends:
486+
- .build-final-baserow-image
476487
variables:
477488
IMAGE_NAME: $WEBFRONTEND_IMAGE_NAME
478489
DEV_IMAGE_NAME: $WEBFRONTEND_DEV_IMAGE_NAME
479490
DOCKERFILE_PATH: $WEBFRONTEND_DOCKERFILE_PATH
480-
491+
needs:
492+
- job: web-frontend-test
481493

482494
# Allow to manually build the image from any branch
483495
build-final-web-frontend-image-manual:
@@ -503,6 +515,7 @@ build-final-web-frontend-image-manual:
503515
e2e-tests:
504516
extends:
505517
- .docker-image-test-stage
518+
- .requires-lint
506519
script:
507520
- cd e2e-tests
508521
- E2E_TEST_YARN_RUN_CMD=test-ci docker compose up --no-build --exit-code-from e2e-tests
@@ -790,6 +803,7 @@ publish-cloudron-release-tagged-image:
790803
# ================================ MISC LINTS ===============================
791804

792805
docker-file-hadolint:
806+
stage: lint
793807
extends:
794808
- .docker-image-test-stage
795809
- .skippable-job
@@ -817,11 +831,15 @@ docker-file-hadolint:
817831
- "reports/*"
818832
paths:
819833
- "reports/*"
834+
needs:
835+
- job: backend-lint
836+
820837

821838
mjml-compiled-check:
822839
extends:
823840
- .docker-image-test-stage
824841
- .skippable-job
842+
- .requires-lint
825843
variables:
826844
RUN_WHEN_CHANGES_MADE_IN: ".eta"
827845
dependencies: []

Diff for: .gitlab/ci_includes/jobs.yml

+10
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@
163163
# and a tested tag for it will be pushed at the end.
164164
# You can also set EXTRA_BUILD_ARGS to pass any extra args to the docker build call.
165165
.build-final-baserow-image:
166+
extends:
167+
- .requires-lint
166168
image: $CI_UTIL_IMAGE
167169
stage: build-final
168170
interruptible: true
@@ -365,6 +367,7 @@
365367
docker push $TARGET_DEV_IMAGE_PATH
366368
fi
367369
370+
368371
# A simple docker based test job which does not run for a TAG pipeline and does not
369372
# check out git.
370373
.docker-image-test-stage:
@@ -594,3 +597,10 @@
594597
fi
595598
596599
echo -e "$GREEN ================================ $CLEAR"
600+
601+
602+
.requires-lint:
603+
needs:
604+
- job: web-frontend-lint
605+
- job: backend-lint
606+
- job: docker-file-hadolint

0 commit comments

Comments
 (0)