-
Notifications
You must be signed in to change notification settings - Fork 26
/
.travis.yml
81 lines (81 loc) · 3.63 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
language: elixir
cache:
directories:
- deps
- _build
services:
- docker
- postgresql
addons:
postgresql: "9.6"
hosts:
- httpbin.org
apt:
packages:
- docker-ce
elixir:
- 1.6.4
otp_release:
- 20.2
env:
global:
- MIX_ENV=test
- REQUIRE_VERSION_TAGS="true"
- TRUNK_BRANCH="master"
# Docker Hub token
- DOCKER_HUB_ACCOUNT=nebo15
- secure: "IOwjJ6tE9bdfOB5KPw1HFkwGHS8Rfl6n9+WF98sLqwL+H9fwUzUrudiaJXrmlhK7dza/kxUO5Cr0XipE66Lkv0sUnbjDTYHtG1tih5T/2TcZsQ2GAtgwSdgrOb57cJ341XTGtUxITe/wgNPhHqQDyp8U1U7JG1UBKNxxl8sYwbEq6PlILwkwTCsfJKExNpp/awVOG0hkA8BuFVaSvMvrYRJou3uGePQ4fP+KrKXD3/Vr9z+1uurFs7Ix8Bs/LQf7SY0Sb3e69g8VLkU/7tA40u0Vl6wEEUClG02zjTzjstI4V7CDxUda6yBl8ClMckoJkM/XMIwL7YXP9Qux6lofwbgWtd3TPk3fKAyefRqtCmq2o74iIZ0JtvDcVQzOH6yHqvZVkzMLZqcOFNQkOHvxKavlGCEQSlHUK2MVMS2+3mg54JqzEjumvBwIHneVkKrtabAAM3gUlnOSwHUs8Tv1T0/XvZoF7do8BoCKblgEgMsSYKaXrOU5s3JyF3iF/3Zgz0tsKMJL+XqphzL53m6Q8baeZ+xzdUjGQo1/OoAo/RckvoHXj0nbjyso80EFId3IdLSreg2EBzmWSNfeewxioywfCXKG2aaLOGW4Kknzkh0QwXNYYRCPJBazmY8AXj4gwyY9XFzNz6XyeZa78EGry0bwMfH/RQ2ijRozrdcXOUA="
# GitHub token
- secure: "gmTS+DuyJ18k6kcWDOrzCFbBe05VZA5DzQqLzjnHYxNSZA+y4+vpIUH4xkN+JjEuYo2Jreg4Kz8NO0wP3gNROQrn3gYTdYXKQ8twJLsZ50IASnZQRLsDmuNIJsZcSgK8b27QNJYmfK3frDGlUubEws3POW3lo/uBfi4AzydoPhzo7HNNACMqFt7p1e5ndHaXmO2W3/DNkW/4NnpTA7SRcqMcykTIj7IzPOG+WVbGKxfUMuDCuabfMxeC5n5vROnbtoPoPrTR+7DPC/tKYnItwo4jvA08noMVrE7ziHrwyb7bPZs+ncfdwdS6LwIPwxGI7d+cUO9WOFdRzFH44xvY9lvRo3liMN800XZPJT6HFxf4GkQQuYW/trHjTYL7woHQmtwpGfBa1WFfDbSMSApk0YBUj0n0q0nMoV/9o7W8WIT0kjiCPbve0KUQYTHyqY5jcZS8hpZfno0+aVDTlq1jkEYdRb2wxBJXL/nDg5Z2reXsfEuAG4CTnzRkA8vv5otJXZrPmutNhHKg/+AdMsZAO5OsiCosqK9ouAypKoHhnYEigXD+kfMeWKpq4weDSfK6pYNoziMKYdsKKXnMg5/rWM9E3TpTUYgeiLFaHzgw7ll7fS8ra7jntC9Me2E5qqu3MjoEIErLE+k1IXw0EueQzX1BTVG2XqgUxTqYOIcuvYQ="
branches:
# Releases are generated automatically, stop infinite build loop
except:
- /^[0-9]*\.[0-9]*\.[0-9]*/
before_install:
# Expose DB to Docker container
- sudo /bin/bash ./bin/ci/init-db.sh
# Run HTTPBin locally
- docker pull citizenstig/httpbin:latest
- docker run -d -p 80:8000 --name httpbin citizenstig/httpbin:latest
before_script:
# Extract project name and version from mix.exs
- source ./bin/ci/release/fetch-project-environment.sh
# Load information about new version
- source ./bin/ci/release/fetch-source-version.sh
# Load information about changelog
- source ./bin/ci/release/fetch-changelog.sh
script:
# Increment version in mix.exs
- ./bin/ci/release/put-source-version.sh
# Run all tests except pending ones
- mix test --exclude pending --trace
# Submit code coverage report to Coveralls
- mix coveralls.travis --exclude pending
# Run static code analysis
# - mix credo -a
# Check code style
# - mix dogma
# Build Docker container
- ./bin/ci/release/build-container.sh
# Initialize DB for Docker container
- source .env; PGPASSWORD="${DB_PASSWORD}"; psql -U ${DB_USER} -w -c"CREATE DATABASE ${DB_NAME}"
# Run Docker container
- sudo ./bin/ci/release/start-container.sh -a '--add-host=httpbin.org:$HOST_IP'
- sleep 10
- docker ps
- RUNNING_CONTAINERS=`docker ps | wc -l`;
if [ "${RUNNING_CONTAINERS//[[:space:]]/}" == "2" ]; then
echo "[E] Container is not started\!";
docker logs annon_api --details --since 5h;
exit 1;
fi;
# Run acceptance tests on Docker container
- ./test/sanity-test.sh
after_failure:
- docker logs httpbin --details --since 5h
- docker logs annon_api --details --since 5h
after_success:
# Rebuild docs
- "mix docs --output docs"
# Submit Docker container to Docker Hub and create GitHub Release by pushing tag with changelog
- ./bin/ci/release/push-changes.sh