-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
65 lines (60 loc) · 2.18 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
---
include:
- remote: "https://gitlab.esss.lu.se/ics-infrastructure/gitlab-ci-yml/raw/master/PreCommit.gitlab-ci.yml"
- remote: "https://gitlab.esss.lu.se/ics-infrastructure/gitlab-ci-yml/raw/master/SonarScanner.gitlab-ci.yml"
- remote: "https://gitlab.esss.lu.se/ics-infrastructure/gitlab-ci-yml/raw/master/ArtifactoryPyPI.gitlab-ci.yml"
variables:
CONTAINER_TEST_IMAGE: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME"
default:
tags:
- docker
build_test:
stage: build
image: docker:latest
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- docker pull "$CONTAINER_TEST_IMAGE" || true
- docker build -t sds .
- docker build -t "$CONTAINER_TEST_IMAGE" tests
- docker push "$CONTAINER_TEST_IMAGE"
test:
stage: test
image: "$CONTAINER_TEST_IMAGE"
services:
- name: docker.elastic.co/elasticsearch/elasticsearch:8.15.2
alias: elasticsearch
command:
[
"bin/elasticsearch",
"-Expack.security.enabled=false",
"-Expack.security.http.ssl.enabled=false",
"-Ediscovery.type=single-node",
]
variables:
INDEXER_URL: "http://0.0.0.0:8000"
COLLECTOR_DEFINITIONS: "collectors.json"
STORAGE_PATH: /data
ELASTIC_URL: "http://elasticsearch:9200"
before_script:
- mkdir src/static
- wget -O src/static/swagger-ui-bundle.js https://cdn.jsdelivr.net/npm/swagger-ui-dist@4/swagger-ui-bundle.js
- wget -O src/static/swagger-ui.css https://cdn.jsdelivr.net/npm/swagger-ui-dist@4/swagger-ui.css
- wget -O src/static/redoc.standalone.js https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js
script:
- cp -R tests src/
- cp -R tests/test_ioc src/
- cp tests/collectors.json src/
- cd src
- python -m pytest --ignore tests/performance --junitxml=junit.xml --cov-config tests/.coveragerc --cov-report term --cov-report xml --cov '.'
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
artifacts:
paths:
- src/junit.xml
- src/coverage.xml
reports:
junit: src/junit.xml
coverage_report:
coverage_format: cobertura
path: src/coverage.xml
expire_in: 1 hour