-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
73 lines (68 loc) · 2.28 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
73 lines (68 loc) · 2.28 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
# based on https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Django.gitlab-ci.yml
variables:
HYDROAPPS_SECRET_KEY: 'very_long_secret_key123'
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_PORT: 5432
HYDROAPPS_DB_HOST: hydroapps
HYDROAPPS_DB_DATABASE: hydroapps
WEATHERDB_DB_HOST: weatherdb
WEATHERDB_DB_DATABASE: weatherdb
WEATHERDB_DB_PORT: $POSTGRES_PORT
WEATHERDB_DB_USER: $POSTGRES_USER
WEATHERDB_DB_PASSWORD: $POSTGRES_PASSWORD
WEATHERDB_LOGGING_HANDLER: console
WEATHERDB_LOGGING_LEVEL: DEBUG
workflow:
auto_cancel:
on_new_commit: interruptible
stages:
- build_test_image
- test
build_test_image:
stage: build_test_image
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_COMMIT_BRANCH == "master"
script:
- unset DOCKER_HOST
- echo "$CI_REGISTRY_PASSWORD" | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_BRANCH || true
- docker build --cache-from $CI_REGISTRY_IMAGE:$CI_COMMIT_BRANCH
-t $CI_REGISTRY_IMAGE:$CI_COMMIT_BRANCH -f Dockerfile.test .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_BRANCH
tags:
- shell
django-tests:
stage: test
image: $CI_REGISTRY_IMAGE:$CI_COMMIT_BRANCH
rules: !reference [build_test_image, rules]
dependencies:
- build_test_image
services:
- name: postgis/postgis
alias: hydroapps
variables:
POSTGRES_DB: $HYDROAPPS_DB_DATABASE
- name: postgis/postgis
alias: weatherdb
variables:
POSTGRES_DB: $WEATHERDB_DB_DATABASE
before_script:
- cp secretSettings_HydroApps.py.test secretSettings_HydroApps.py
- mkdir static_data
- cd front-end && npm ci && npm run build && cd ../
- uv sync
- uv run weatherdb create-db-schema
- uv run python3 manage.py migrate
- uv run python3 manage.py collectstatic --noinput
script:
- uv run python3 manage.py test my_auth weatherdb RheiKlim kombstra sri_bw sfi_demo
interruptible: true
cache:
paths:
- ~/.cache/pip/
- front-end/node_modules/
- .venv/
tags:
- docker