-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
68 lines (68 loc) · 2.54 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
language: generic
services:
- docker
cache:
directories:
- $HOME/.stack
addons:
apt:
packages:
- libgmp-dev
- upx-ucl
before_install:
- mkdir -p ~/.local/bin
- export PATH=$HOME/.local/bin:$PATH
- travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
install:
- stack --no-terminal --install-ghc test --only-dependencies
script:
- |
[[ "$TRAVIS_TAG" = "" || \
"$(stack query locals checkmate version)" == "'$TRAVIS_TAG'" ]]
- '[[ "$TRAVIS_TAG" = "" ]] || ! grep -i "to be released" CHANGELOG.md'
- '[[ "$TRAVIS_TAG" = "" ]] || grep "$TRAVIS_TAG" README.md'
- stack --no-terminal test --haddock --no-haddock-deps
- stack exec -- checkmate github-travis --token "$CHECKMATE_GITHUB_ACCESS_TOKEN"
before_deploy:
- mkdir -p /tmp/checkmate-build
- docker build -t checkmate-binary-build .
- docker run checkmate-binary-build cat /root/.local/bin/checkmate > /tmp/checkmate-build/checkmate-"$(docker run checkmate-binary-build bash -c 'echo $(uname -s | tr "[A-Z]" "[a-z]")-$(uname -m)')"
- chmod +x /tmp/checkmate-build/checkmate-*
- upx-ucl -9 /tmp/checkmate-build/checkmate-*
deploy:
- provider: releases
api_key: "$GITHUB_ACCESS_TOKEN"
file_glob: true
file: /tmp/checkmate-build/checkmate-*
skip_cleanup: true
on:
tags: true
after_deploy:
# More metadata
- |
pushd /tmp
curl -OL https://github.com/aktau/github-release/releases/download/v0.7.2/linux-amd64-github-release.tar.bz2
tar xvfj linux-amd64-github-release.tar.bz2
mkdir -p ~/bin/
mv bin/linux/amd64/github-release ~/bin/
chmod +x ~/bin/github-release
popd
- curl -L -o ~/bin/submark https://github.com/dahlia/submark/releases/download/0.2.0/submark-linux-x86_64
- chmod +x ~/bin/submark
- submark -o /tmp/release-note -i --h2 "Version $TRAVIS_TAG" -O CHANGELOG.md
- cat /tmp/release-note
- |
GITHUB_TOKEN="$GITHUB_ACCESS_TOKEN" \
github-release edit \
--user "${TRAVIS_REPO_SLUG%%/[^/]*}" \
--repo "${TRAVIS_REPO_SLUG#[^/]*/}" \
--tag "$TRAVIS_TAG" \
--name "checkmate $TRAVIS_TAG" \
--description "$(cat /tmp/release-note)"
# We don't use Travis' Hackage provider since we shouldn't build dists twice
- mkdir -p ~/.stack/upload
- |
python -c 'import json, os; print(json.dumps({"username": os.environ["HACKAGE_USERNAME"], "password": os.environ["HACKAGE_PASSWORD"]}))' > ~/.stack/upload/credentials.json
- sed -i -E 's/\s-Werror$/ -Wwarn/g' package.yaml # Hackage disallows -Werror
- stack --no-terminal sdist --ignore-check
- stack --no-terminal upload --ignore-check --no-signature .