blob: 223ae76cf046981e52718366d9e879ca3692283d (
plain)
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
references:
- &defaults
docker:
- image: circleci/ruby:latest
- &workspace_root
~/
- &capture_coverage_data
run:
name: Capturing coverage data
command: |
set -e
sudo apt-get install -qq lcov
gem install coveralls-lcov
lcov --no-external -b ../project -d ../project -c --output-file coverage.${CIRCLE_JOB}.info
- &restore_coverage_data
restore_cache:
keys:
- coverage-{{ .Environment.CIRCLE_WORKFLOW_ID }}
- &merge_and_upload_coverage_data
run:
name: Merging and uploading coverage data
command: |
set -e
if [ -f ~/project/coverage.rspamd-test.info ] && [ -f ~/project/coverage.functional.info ]; then
sudo apt-get install -qq lcov
lcov -a ~/project/coverage.rspamd-test.info -t rspamd-test -a ~/project/coverage.functional.info -t functional -o coverage.info
gem install coveralls-lcov
if [ ! -z $COVERALLS_REPO_TOKEN ]; then coveralls-lcov -t ${COVERALLS_REPO_TOKEN} coverage.info || true; fi
fi
version: 2
jobs:
build:
<<: *defaults
steps:
- checkout
- run: sudo apt-get update -qq || true
- run: sudo apt-get install -qq cmake libevent-dev libglib2.0-dev libicu-dev libluajit-5.1-dev libmagic-dev libsqlite3-dev libssl-dev ragel
- run: mkdir ../build ; mkdir ../install ; cd ../build
- run: cmake ../project -DDBDIR=/nana -DENABLE_COVERAGE=ON -DCMAKE_INSTALL_PREFIX=../install
- run: make install -j`nproc`
- persist_to_workspace:
root: *workspace_root
paths:
- project
- build
- install
rspamd-test:
<<: *defaults
steps:
- attach_workspace:
at: *workspace_root
- run: sudo apt-get update -qq || true
- run: sudo apt-get install -qq cmake libluajit-5.1-dev libmagic-dev
- run: cd ../build
- run: make rspamd-test -j`nproc`
- run: set +e; test/rspamd-test -p /rspamd/lua; echo "export RETURN_CODE=$?" >> $BASH_ENV
- *capture_coverage_data
# Share coverage data between jobs
- save_cache:
key: coverage-{{ .Environment.CIRCLE_WORKFLOW_ID }}
paths:
- coverage.rspamd-test.info
- *restore_coverage_data
- *merge_and_upload_coverage_data
- run: (exit $RETURN_CODE)
functional:
<<: *defaults
steps:
- attach_workspace:
at: *workspace_root
- run: sudo apt-get update -qq || true
- run: sudo apt-get install -qq libluajit-5.1-dev libpcre3-dev luarocks opendkim-tools python-pip redis-server
- run: sudo pip install demjson psutil robotframework
- run: sudo luarocks install luacheck
- run: cd ../build
- run: set +e; RSPAMD_INSTALLROOT=../install sudo -E robot -x xunit.xml --exclude isbroken ../project/test/functional/cases; echo "export RETURN_CODE=$?" >> $BASH_ENV
- *capture_coverage_data
# Share coverage data between jobs
- save_cache:
key: coverage-{{ .Environment.CIRCLE_WORKFLOW_ID }}
paths:
- coverage.functional.info
- *restore_coverage_data
- *merge_and_upload_coverage_data
- store_artifacts:
path: output.xml
- store_artifacts:
path: log.html
- store_artifacts:
path: report.html
- run: mkdir -p test-results; mv xunit.xml test-results
- store_test_results:
path: test-results
- run: (exit $RETURN_CODE)
eslint:
docker:
- image: circleci/node:latest
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run: npm install
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
- run: ./node_modules/.bin/eslint -v && ./node_modules/.bin/eslint ./
workflows:
version: 2
build-and-test:
jobs:
- build
- eslint
- rspamd-test:
requires:
- build
- functional:
requires:
- build
|