-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitlab-ci.yml
173 lines (161 loc) · 4.7 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
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
stages:
- vet
- test
- build
.diesel:
- &diesel
if [ ! -d ".diesel" ]; then
mkdir .diesel;
make setup:tool;
cp /usr/local/cargo/bin/diesel .diesel/diesel;
else
cp .diesel/diesel /usr/local/cargo/bin/diesel;
fi
.postgresql:
- &postgresql
# /usr/include/postgresql is symlink to postgresql-11
if [ ! -d ".postgresql" ]; then
mkdir .postgresql;
USE="readline ssl zlib uuid -perl -python"
emerge --quiet-build=y --nospinner --oneshot dev-db/postgresql:11;
cp -R /usr/include/postgresql-11/ .postgresql/include;
cp -R /usr/lib64/postgresql-11/ .postgresql/lib;
cp -R /usr/share/postgresql-11/ .postgresql/share;
cp /usr/lib64/postgresql-11/bin/psql .postgresql/psql;
else
cp .postgresql/psql /usr/bin/psql;
cp -R .postgresql/share/ /usr/share/postgresql-11;
cp -R .postgresql/include/ /usr/include/postgresql-11;
ln -s /usr/include/postgresql /usr/include/postgresql-11;
ln -s /usr/include/libpq /usr/include/postgresql-11/libpq;
cp -R .postgresql/lib/ /usr/lib64/postgresql-11;
ln -s /usr/lib64/postgresql /usr/lib64/postgresql-11/lib64;
ln -s /usr/lib64/postgresql-11/lib64/libecpg_compat.so /usr/lib64/libecpg_compat.so;
ln -s /usr/lib64/postgresql-11/lib64/libecpg.so /usr/lib64/libecpg.so;
ln -s /usr/lib64/postgresql-11/lib64/libpgtypes.so /usr/lib64/libpgtypes.so;
ln -s /usr/lib64/postgresql-11/lib64/libpq.so /usr/lib64/libpq.so;
ln -s /usr/lib64/postgresql-11/lib64/libpq.so.5 /usr/lib64/libpq.so.5;
fi;
rm -fr /etc/ld.so.cache;
ldconfig;
.vendor:
- &vendor
if [ ! -d "vendor" ]; then
make setup:vendor;
fi
.cache: &cache
cache:
key:
files:
- Cargo.lock
prefix: "${CI_PROJECT_NAME}-cache-${CI_CACHE_VERSION}"
paths:
- .diesel
- .cargo
- .postgresql
- vendor
.vet-tools: &vet-tools
image: registry.gitlab.com/grauwoelfchen/portolan/rust-vet-tools:nightly-2021-05-22
except:
- tags
.rust: &rust
image: registry.gitlab.com/grauwoelfchen/portolan/rust:nightly-2021-05-22
before_script:
- *postgresql
- rustc --version
- cargo --version
- *vendor
<<: *cache
check:
stage: vet
<<: *vet-tools
before_script:
- rustc --version
- cargo --version
script:
- make vet:check
format:
stage: vet
<<: *vet-tools
before_script:
- rustc --version
- cargo --version
- cargo fmt --version
script:
- make vet:format
lint:
stage: vet
<<: *vet-tools
before_script:
- *postgresql
- rustc --version
- cargo --version
- cargo clippy --version
- *vendor
- mkdir .git/hooks
script:
- make vet:lint
<<: *cache
test:
stage: test
<<: *vet-tools
services:
- postgres:11
- redis:5
variables:
ENV: test
# superuser
POSTGRES_DB: eloquentlog_test
POSTGRES_USER: eloquentlog
POSTGRES_PASSWORD: eloquentlog
TEST_APPLICATION_URL: "http://127.0.0.1:3000"
TEST_AUTHENTICATION_TOKEN_ISSUER: "test-authentication-token-issuer"
TEST_AUTHENTICATION_TOKEN_KEY_ID: "test-authentication-token-key_id"
TEST_AUTHENTICATION_TOKEN_SECRET: "test-authentication-token-secret"
TEST_COOKIE_DOMAIN: "127.0.0.1"
TEST_COOKIE_SECURE: "false"
TEST_DATABASE_URL: "postgresql://eloquentlog:eloquentlog@postgres:5432/eloquentlog_test"
TEST_MAILER_DOMAIN: "example.com"
TEST_MAILER_FROM_EMAIL: "[email protected]"
TEST_MAILER_FROM_ALIAS: "Eloquentlog - Testing"
TEST_MAILER_SMTP_HOST: "server.tld"
TEST_MAILER_SMTP_PORT: "587"
TEST_MAILER_SMTP_PASSWORD: "username"
TEST_MAILER_SMTP_USERNAME: "password"
TEST_MESSAGE_QUEUE_URL: "redis://redis:6379/0"
TEST_SESSION_STORE_URL: "redis://redis:6379/2"
TEST_VERIFICATION_TOKEN_ISSUER: "test-verification-token-issuer"
TEST_VERIFICATION_TOKEN_KEY_ID: "test-verification-token-key_id"
TEST_VERIFICATION_TOKEN_SECRET: "test-verification-token-secret"
before_script:
- *postgresql
- rustc --version
- cargo --version
- kcov --version
- *diesel
- *vendor
- psql $TEST_DATABASE_URL -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\""
- DATABASE_URL=$TEST_DATABASE_URL make schema:migration:commit
- DATABASE_URL=$TEST_DATABASE_URL make schema:migration:status
- mkdir -p .git/hooks
script:
- make coverage:all
after_script:
- cat target/coverage/index.js
coverage: /"covered":"(\d+(?:\.\d+)?)",/
<<: *cache
build-debug:
stage: build
<<: *rust
script:
- make build:debug
only:
- master
build-release:
stage: build
<<: *rust
script:
- make build:release
only:
- release@eloquentlog/eloquentlog-console-api
- tags@eloquentlog/eloquentlog-console-api