-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
96 lines (92 loc) · 2.48 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
94
95
96
stages:
- test
- build
- deploy
workflow:
auto_cancel:
on_new_commit: interruptible
test:
image: "python:$PYTHON_VERSION"
services:
- name: postgis/postgis:16-3.4
alias: postgres
command: ["postgres", "-c", "fsync=off"]
before_script:
- python3 -m pip install --upgrade pip --root-user-action=ignore
- python3 -m pip install unittest-xml-reporting --root-user-action=ignore
script:
- python3 -m pip install .[optionals] --root-user-action=ignore
- mkdir -p $WEATHERDB_DATA_BASE_DIR
- mkdir -p test-reports
- python3 -m xmlrunner discover -s tests -p testSuite.py -o test-reports
cache:
key: weatherDB-data
paths:
- /home/data
artifacts:
when: always
reports:
junit: test-reports/*.xml
expire_in: 2 weeks
parallel:
matrix:
- PYTHON_VERSION: "3.8"
- PYTHON_VERSION: "3.9"
- PYTHON_VERSION: "3.10"
- PYTHON_VERSION: "3.11"
interruptible: true
variables:
PYTHON_VERSION: $PYTHON_VERSION
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test_db
POSTGRES_HOST_AUTH_METHOD: trust
WEATHERDB_DB_HOST: postgres
WEATHERDB_DB_PORT: 5432
WEATHERDB_DB_DATABASE: $POSTGRES_DB
WEATHERDB_DB_USER: $POSTGRES_USER
WEATHERDB_DB_PASSWORD: $POSTGRES_PASSWORD
WEATHERDB_USER_CONFIG_FILE: /home/config_user.yaml
WEATHERDB_DATA_BASE_DIR: /home/data
WEATHERDB_HANDLE_NON_EXISTING_CONFIG: create
WEATHERDB_LOGGING_HANDLER: console
WEATHERDB_LOGGING_LEVEL: DEBUG
WEATHERDB_HORIZON_RADIUS: 40000
DOCKER_ENV: test
tags:
- docker
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
build:
rules:
- if: $CI_COMMIT_TAG =~ /^[Vv]\d+\.\d+\.\d+$/
stage: build
image: python:3.11
script:
- python -m pip install --upgrade pip --root-user-action=ignore
- python -m pip install setuptools wheel build --root-user-action=ignore
- python -m build --no-isolation --outdir dist
artifacts:
paths:
- dist/
variables:
PYTHON_VERSION: $PYTHON_VERSION
tags:
- docker
deploy:
rules:
- !reference [build, rules]
dependencies:
- build
stage: deploy
image: python:3.9
script:
- python -m pip install --upgrade pip --root-user-action=ignore
- python -m pip install twine --root-user-action=ignore
- twine upload dist/*
variables:
TWINE_USERNAME: $TWINE_USERNAME
TWINE_PASSWORD: $TWINE_PASSWORD
tags:
- docker