-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
93 lines (77 loc) · 2.01 KB
/
.gitlab-ci.yml
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
stages:
- check
workflow:
rules:
# 1. Don't run pipelines for MR drafts.
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TITLE =~ /^Draft:/
when: never
# 2. Don't run branch pipelines when there's an open MR for the branch (run the MR pipeline instead).
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
when: never
# 3. Run all other MR pipelines
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
when: always
# 4. Run branch pipelines for dev and master
- if: $CI_COMMIT_BRANCH == "dev" || $CI_COMMIT_BRANCH == "master"
when: always
# 5. Else, don't run it
- when: never
variables:
MYSQL_DATABASE: carbure_mysql_test_db
MYSQL_ROOT_PASSWORD: carbure_mysql_ci_db_password
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
PIPENV_VENV_IN_PROJECT: true
# job: run linting and tests for backend
check-backend:
stage: check
extends: .backend
services:
- mysql:8.0
- redis:latest
script:
- export CARBURE_HOME=$(pwd)
- export DATABASE_URL=mysql://root:$MYSQL_ROOT_PASSWORD@mysql:3306/$MYSQL_DATABASE
- export REDIS_URL=redis://redis:6379
- pipenv run ruff check
- pipenv run ruff format --check
- TEST=1 pipenv run python web/manage.py test web
# job: run linting and tests for frontend
check-frontend:
stage: check
extends: .frontend
script:
- npm run lint
- npm run build
- npm run chromatic
interruptible: true
.backend:
image: python:3.12
cache:
- key:
files:
- Pipfile.lock
paths:
- .cache/pip/
- .venv/
before_script:
- pip install pipenv
- pipenv install --dev --deploy --ignore-pipfile
rules:
- changes:
- web/**/*
- .gitlab-ci.yml
.frontend:
image: node:latest
cache:
- key:
files:
- front/package-lock.json
paths:
- front/.npm/
before_script:
- cd front
- npm ci --cache .npm --prefer-offline
rules:
- changes:
- front/**/*
- .gitlab-ci.yml