This repository has been archived by the owner on Feb 13, 2019. It is now read-only.
forked from Internet-of-People/mercury-rust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
48 lines (42 loc) · 1.86 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
# Thanks to the following blog post we are caching cargo
# http://blog.wjlr.org.uk/2016/08/16/fast-rust-gitlab-ci.html
# This file is a template, and might need editing before it works on your project.
# Unofficial language image. Look for the different tagged releases at:
# https://hub.docker.com/r/scorpil/rust/tags/
# image: "scorpil/rust:stable"
image: "rust"
# Optional: Pick zero or more services to be used on all builds.
# Only needed when using a docker container to run your tests in.
# Check out: http://docs.gitlab.com/ce/ci/docker/using_docker_images.html#what-is-a-service
services:
- postgres:alpine
- jbenet/go-ipfs:latest
# - mysql:latest
# - redis:latest
# Optional: Install a C compiler, cmake and git into the container.
# You will often need this when you (or any of your dependencies) depends on C code.
before_script:
- apt-get update -yqq
- apt-get install -yqq --no-install-recommends postgresql-client-9.6 capnproto
# To ensure that dependencies are cached correctly
variables:
CARGO_HOME: $CI_PROJECT_DIR/cargo
POSTGRES_DB: testdb
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
# Use cargo to test the project
test:cargo:
script:
- du -hs target || true
- du -hs cargo || true
- rustc --version && cargo --version # Print version info for debugging
# official way to provide password to psql: http://www.postgresql.org/docs/9.3/static/libpq-envars.html
- export PGPASSWORD=$POSTGRES_PASSWORD
- psql -h "postgres" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -f "test/testdb.sql"
- export RUST_BACKTRACE=1
- time cargo build --all --all-targets --verbose --release # --all builds whole workspace, --all-targets builds bin,lib,examples,tests,benchmarks
- time cargo test --all --verbose --jobs 1 --release || true # Don't parallelize to make errors more readable
cache:
paths:
- target/
- cargo/