forked from gnosis/dex-services
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.travis.yml
112 lines (107 loc) · 5.51 KB
/
.travis.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
notifications:
email:
- oncall-dfusion@gnosis.io
if: (branch = master) OR (tag IS present)
if: (branch = master) OR (type = pull_request) OR (tag IS present)
os: linux
dist: bionic
language: rust
env:
global:
- OPEN_SOLVER_VERSION=v0.2.1
- PRIVATE_SOLVER_VERSION=v0.8.8
jobs:
fast_finish: true
allow_failures:
- rust: nightly
include:
- name: "Build and Local Testing"
if: type = pull_request
rust: 1.49.0
cache:
directories:
- $HOME/.cargo/bin
before_cache:
- rm -rf "$TRAVIS_HOME/.cargo/registry/src"
env: CARGO_INCREMENTAL=0
before_script:
- rustup component add clippy rustfmt
- sudo apt-get update && sudo apt-get install -y python3-pip python3-setuptools && pip3 install --upgrade --user awscli
- $(aws ecr get-login --no-include-email --region $AWS_REGION)
- ci/setup_contracts.sh
script:
- cargo fmt --all -- --check
- cargo clippy --locked --workspace --all-targets --all-features -- -D warnings
- cargo build --locked --workspace --all-targets
# Unit Tests and Linting
- cargo test
# Make sure README is up to date
- diff --ignore-trailing-space <(sed -n '/^driver /,/^```/p' README.md | head -n -1) <(cargo run --bin driver -- --help)
# Build image with compiled binary
- docker build --tag stablex-binary-public --build-arg SOLVER_BASE=gnosispm/dex-open-solver:$OPEN_SOLVER_VERSION -f driver/docker/rust/Dockerfile .
# StableX e2e Tests (Ganache) - open solver
- docker-compose -f docker-compose.yml -f driver/docker-compose.open-solver.yml up -d stablex
- cargo test -p e2e ganache -- --nocapture
- docker-compose logs
# Build image with compiled binary
- docker build --tag stablex-binary-private --build-arg SOLVER_BASE=163030813197.dkr.ecr.eu-central-1.amazonaws.com/dex-solver:$PRIVATE_SOLVER_VERSION -f driver/docker/rust/Dockerfile .
# StableX e2e Tests (Ganache) - private solver
- docker-compose down
- ci/setup_contracts.sh
- docker-compose -f docker-compose.yml -f driver/docker-compose.private-solver.yml up -d stablex
- cargo test -p e2e ganache -- --nocapture
- docker-compose logs
# StableX e2e Tests (Ganache) - private best-ring solver
- docker-compose down
- ci/setup_contracts.sh
- docker-compose -f docker-compose.yml -f driver/docker-compose.best-ring-solver.yml up -d stablex
- cargo test -p e2e ganache -- --nocapture
- docker-compose logs
- name: Coverage
rust: nightly
script:
- curl --location https://github.com/mozilla/grcov/releases/latest/download/grcov-linux-x86_64.tar.bz2 | tar jxf -
# These flags are recommended by https://github.com/mozilla/grcov#grcov-with-travis .
# vk: I had to remove `-Zpanic_abort_tests -Cpanic=abort` because this would cause compilation
# to fail but I haven't investigated more into why.
# I added `-Awarnings` which allows all warnings. This was necessary because nightly can
# introduce some new warnings and when testing one such warning appeared in the ethcontract
# generated contract code which caused the whole file to be printed as part of the warning
# message which made the build fail (probably travis related).
- env CARGO_INCREMENTAL=0 RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Awarnings" cargo +nightly test
# Ignore untested cargo files in travis root and auto-generated eth-contract code
- ./grcov --branch --ignore-not-existing --llvm --excl-start "mod test" --excl-line "#\[cfg_attr\(test, mockall::automock\)\]|#\[derive" --ignore "/*" --ignore "target/debug/build/**" target/debug/ --output-path coveralls.json --output-type "coveralls+" --source-dir . --service-name travis-pro --service-job-id $TRAVIS_JOB_ID
- curl --form json_file=@coveralls.json https://coveralls.io/api/v1/jobs
- name: "Deploy Driver"
if: (type != pull_request) AND (tag is present OR branch = master)
rust: 1.49.0
before_install:
- sudo apt-get update && sudo apt-get install -y python3-pip python3-setuptools && pip3 install --upgrade --user awscli
- $(aws ecr get-login --no-include-email --region $AWS_REGION)
script:
- cargo build --locked -p driver --release
- docker build --tag stablex-binary-public --build-arg SOLVER_BASE=gnosispm/dex-open-solver:$OPEN_SOLVER_VERSION --build-arg BINARY_PATH=target/release/driver -f driver/docker/rust/Dockerfile .
- docker build --tag stablex-binary-private --build-arg SOLVER_BASE=163030813197.dkr.ecr.eu-central-1.amazonaws.com/dex-solver:$PRIVATE_SOLVER_VERSION --build-arg BINARY_PATH=target/release/driver -f driver/docker/rust/Dockerfile .
deploy:
- provider: script
script: ./driver/docker/deploy.sh $TRAVIS_BRANCH
on:
branch: master
- provider: script
script: ./driver/docker/deploy.sh $TRAVIS_TAG
on:
tags: true
- name: "Deploy Price Estimator"
if: (type != pull_request) AND (tag is present OR branch = master)
rust: 1.49.0
script:
- true
deploy:
- provider: script
script: ./price-estimator/docker/deploy.sh $TRAVIS_BRANCH
on:
branch: master
- provider: script
script: ./price-estimator/docker/deploy.sh $TRAVIS_TAG
on:
tags: true