forked from cardano-foundation/cardano-wallet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
145 lines (125 loc) · 6.66 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
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
# Use small container and not VM:
sudo: false
# Choose a build environment:
dist: xenial
# Only clone the repository tip & track all branches
git:
depth: false
notifications:
slack:
rooms:
secure: VYkYJktT9Cu/aRGQccZrFdjqgFZKq65k5CIMF3i2QmMfwXVzgFojY2XyRP+VB/idopI3iAtMz81dHXUBNyX50JtftFRL4R3ic+7eqDJu30E9kerjDbFeveISVLLTTTvuG13sME6UclgKycF9Cma68Q9+MqSxCMNnu1X8LvqKofZLG2xy9UMUzJx39a9D/+oyQUtpNRopxxvG9bpyOoOp9H+lJLlDiiBpNea07l0r+9XlgfbM1UiqdxBuZMzbWoOE2QKv+JBj1PrHyS0LNwnbM6k6VNx0BWMa3C9NSnvKp7vF0aOSR9UslCjAcE/eg8xzNu/A/xNhgxF30Uc4rzH99E7f4z+G4/Qure2p+Y+jz0IBtsmLDfHWwEL2BPyaqTbMwEJz8oYKYYrb9UtjYLvn4LtbgtwAqqDgbdpMlS5pB5P/klblDsR3YsKkLwYPfZeAKXyLfMMuVpEILE7nS9ntyjw5I6tCK23PryeuJQad34C7iFQXeC42WvgYV5x+F+ZbFaY58GdVWER5X66yp4Jxgo2uo0tCdjpN8PlgQOjDSl7tgMBFcLu+TXhpYZQ1Kr/nV2f2Nb2+MDs5Eb/05yTeZzNBMzMLbKNZcAJgP3kyAAgnkUuDaVYLUcZ2q5CJkokWLWTg6fLzcoNZ1kdmtU14FwOuj0sczO42AiAqYP4EOls=
on_pull_requests: false
on_success: change # Send a Slack notification when the build goes from failed to success (and vice-versa)
on_error: always # Send a Slack notification when the build is failing on master
email: false
env:
global:
- WALLET_CLI_JORMUNGANDR=$HOME/.local/bin/cardano-wallet-jormungandr
- STACK_WORK_CACHE=$HOME/.stack/stack-work.tar.gz
- PATH=$PATH:$HOME/.local/bin
- LOCAL_MIX_DIR=.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/hpc/
# We use a hybrid setup with Rust and Haskell, so we handle the compilation ourselves
language: generic
# Deactivate builds on branches but `master` and the bors branches.
# CI is still triggered by PRs).
# We do also CI to kick in when pushing a tag `git push --tags` for releases.
if: "(branch = master) OR (tag =~ /^v(2019|2020|2021)-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/)"
# Caching so the next build will be fast too:
cache:
timeout: 1337
directories:
- $HOME/.stack
before_cache:
# Remove extra unused and heavy stuff from stack directory to avoid caching useless files
- rm -rf $HOME/.stack/programs/x86_64-linux/ghc-*.tar.*
- rm -rf $HOME/.stack/indices/Hackage/00-index.tar $HOME/.stack/indices/Hackage/00-index.tar.gz
- find $HOME/.stack/programs/x86_64-linux/ghc-*/lib/ghc-* -type f -name *_p.a -delete
before_install:
- mkdir -p $HOME/.local/bin
- tar xzf $STACK_WORK_CACHE || echo "no .stack-work yet"
- travis_retry curl -L https://github.com/commercialhaskell/stack/releases/download/v1.9.3/stack-1.9.3-linux-x86_64.tar.gz | tar xz --wildcards --strip-components=1 -C $HOME/.local/bin '*/stack'
- travis_retry stack --no-terminal setup
# Ensure necessary system libraries are present:
addons:
apt:
packages:
- libgmp-dev
- librocksdb-dev
- libsystemd-dev
# Define custom set of stages
stages:
- cache 💾
- build project 🔨
- documentation 📚
- deploy 🚀
jobs:
fast_finish: true
include:
- stage: cache 💾
if: type != pull_request AND (branch = master OR tag =~ ^v)
name: "Caching Dependencies"
script:
- stack --no-terminal build --only-snapshot
- stack --no-terminal build --only-dependencies
- tar czf $STACK_WORK_CACHE .stack-work
- stage: build project 🔨
if: type != pull_request AND (branch = master OR tag =~ ^v)
name: "Compiling Project"
script:
- stack --no-terminal build --haddock --no-haddock-deps --skip cardano-wallet-core-integration
- tar czf $STACK_WORK_CACHE .stack-work lib/**/.stack-work
- stage: documentation 📚
if: type != pull_request AND (branch = master OR tag =~ ^v)
name: "Haddock"
script:
- mkdir -p haddock/edge api/edge
- cp -Rv specifications/api/* api/edge
- mv $(stack path --local-doc-root)/* haddock/edge
- git checkout --orphan gh-pages-deploy && git reset
- git add api haddock && git commit -m $TRAVIS_COMMIT
- git fetch origin
- git checkout gh-pages && git merge -X theirs --no-commit --no-ff --allow-unrelated-histories - && git commit --allow-empty --no-edit
- git push -f -q https://WilliamKingNoel-Bot:[email protected]/input-output-hk/cardano-wallet gh-pages &>/dev/null
- stage: deploy 🚀
if: type != pull_request AND (tag =~ ^v OR commit_message =~ "TRAVIS_TRIGGER_RELEASE")
name: "Executables"
script:
# Create optimized binaries and checksums
- stack --no-terminal install
# Bundle cardano-wallet-jormungandr-linux
- cp $WALLET_CLI_JORMUNGANDR cardano-wallet
- tar czf cardano-wallet-jormungandr-linux64-$TRAVIS_TAG.tar.gz cardano-wallet
# Fetch the MacOS archive
- travis_retry curl -L https://hydra.iohk.io/job/Cardano/cardano-wallet/cardano-wallet-jormungandr-macos64/latest/download/1 | tar xz
- find . -maxdepth 1 -type d -name "cardano-wallet-jormungandr-*" -exec mv \{} cardano-wallet-jormungandr-macos64 \;
- mv cardano-wallet-jormungandr-macos64/cardano-wallet-jormungandr cardano-wallet-jormungandr-macos64/cardano-wallet
- tar czf cardano-wallet-jormungandr-macos64-$TRAVIS_TAG.tar.gz cardano-wallet-jormungandr-macos64
- rm -r cardano-wallet-jormungandr-macos64
# Fetch the Windows archive
- travis_retry curl -L https://hydra.iohk.io/job/Cardano/cardano-wallet/cardano-wallet-jormungandr-win64/latest/download/1 --output cardano-wallet-jormungandr-win64.zip
- unzip -d cardano-wallet-jormungandr-win64 cardano-wallet-jormungandr-win64.zip
- mv cardano-wallet-jormungandr-win64/cardano-wallet-jormungandr.exe cardano-wallet-jormungandr-win64/cardano-wallet.exe
- zip -r cardano-wallet-jormungandr-win64-$TRAVIS_TAG.zip cardano-wallet-jormungandr-win64
- rm -r cardano-wallet-jormungandr-win64
# Deploy documentation snapshot
- mkdir -p haddock/$TRAVIS_TAG api/$TRAVIS_TAG
- cp -Rv specifications/api/* api/$TRAVIS_TAG
- mv $(stack path --local-doc-root)/* haddock/$TRAVIS_TAG
- git checkout --orphan gh-pages-deploy && git reset
- git add api haddock && git commit -m $TRAVIS_COMMIT
- git checkout gh-pages && git merge -X theirs --no-commit --no-ff --allow-unrelated-histories - && git commit --allow-empty --no-edit
- travis_retry git push -f -q https://WilliamKingNoel-Bot:[email protected]/input-output-hk/cardano-wallet gh-pages &>/dev/null
deploy:
provider: releases
api_key: $GITHUB_ACCESS_TOKEN
draft: true # Allow editing the release before publishing it officially on GitHub
skip_cleanup: true # Make sure that files from the previous stages aren't cleaned up
file:
- cardano-wallet-jormungandr-linux64-$TRAVIS_TAG.tar.gz
- cardano-wallet-jormungandr-macos64-$TRAVIS_TAG.tar.gz
- cardano-wallet-jormungandr-win64-$TRAVIS_TAG.zip
on:
repo: input-output-hk/cardano-wallet
branch: master
tags: true # Only release when a tag is pushed