-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
87 lines (80 loc) · 1.64 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
stages:
- setup
- format
- build
- test
- report
- cleanup
variables:
TEST_REPORT_DIR: test_results
TEST_REPORT: ${TEST_REPORT_DIR}/test_result_report.xml
TEST_OUTPUT: ${TEST_REPORT_DIR}/test_output.txt
VENV_DIR: venv
setup:
stage: setup
image: golang:1.19
before_script:
- apt-get update
- apt-get install -y python3 python3-pip python3-venv
- python3 -m venv ${VENV_DIR}
- . ${VENV_DIR}/bin/activate
- pip install -r project_utils/requirements.txt
script:
- go mod tidy
- go mod vendor
- mkdir -p ${TEST_REPORT_DIR}
artifacts:
paths:
- vendor/
- ${TEST_REPORT_DIR}/
- ${VENV_DIR}/
format:
stage: format
image: golang:1.19
script:
- make fmt
artifacts:
paths:
- .
build:
stage: build
image: golang:1.19
script:
- make build
artifacts:
paths:
- dht_node
- bootstrap_node
test:
stage: test
image: golang:1.19
before_script:
- go install github.com/jstemmer/go-junit-report@latest
- . ${VENV_DIR}/bin/activate
script:
- make test
artifacts:
paths:
- ${TEST_REPORT_DIR}/
reports:
junit: ${TEST_REPORT}
report:
stage: report
image: python:3.9
before_script:
- apt-get update && apt-get install -y xsltproc
- . ${VENV_DIR}/bin/activate
script:
- xsltproc ./project_utils/junit-xml-to-html.xsl ${TEST_REPORT} > ${TEST_REPORT_DIR}/test_result_report.html
artifacts:
paths:
- ${TEST_REPORT_DIR}/test_result_report.html
cleanup:
stage: cleanup
image: alpine
before_script:
- apk add --no-cache make
script:
- make clean
artifacts:
expire_in: 1 week