forked from hadolint/hadolint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
147 lines (131 loc) · 5.35 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
146
147
# Build starts faster without `sudo`
sudo: false
language: c
compiler: gcc
cache:
directories:
- $HOME/.stack
timeout: 300
# Increase depth (from default 50) to preserve version from `git describe`
git:
depth: 100
matrix:
include:
# The Stack builds. We can pass in arbitrary Stack arguments via the ARGS
# variable, such as using --stack-yaml to point to a different file.
- env: <s-latest ARGS="--resolver lts"
dist: xenial
- env: <s-fixed ARGS=""
dist: xenial
addons:
artifacts: {paths: [./releases]}
before_deploy:
# Show dynamic libraries `hadolint` depends on
- ldd $(which hadolint) || true
- curl -sSL https://github.com/upx/upx/releases/download/v3.95/upx-3.95-amd64_linux.tar.xz
| tar -x --xz --strip-components=1 -C ~/.local/bin upx-3.95-amd64_linux/upx
# Compress binary
- upx -q --best --ultra-brute "./releases/${BINARY_NAME}"
deploy: &release_deploy
provider: releases
api_key:
secure: bAcEdQB7Hk4yDz58u5oo8aEoitbbobaqW7Dr58asJHnm0KG3g1lJqCrgRP2ldbmG8I9zj1osfw0qGCNc3MZW2sV5AaWqxUGC1Sw2jmz0fqdajk8f0bZXZMECFeryPeXmPRftw0VAKz5dVw5wzjunaAVUEuCC3B4a80v/3+Qj8t2FaslG+uNoTTEEzHPfwgowYPQf+QR1Ob3lWM41g0ORC9mgYAD/PIUi8mnxCVRExUecHwhTM1A8UMo/MDVQuv3cclJ+Xc10O9KTCr7tf9uh4g2ZY4RD/aW5zuUt1tqMVJfcL/BQi5wOrhJd0jwMW8LZg0eBypezXZ70CC1Eb+vwe7OUrDlUroyzPUsOXd7u6LAWe+dBE0zNwvWXFnUF6ls8cJDhrVoSmVV3SFd208/xmemDgMmtBWwcjxyCM3kMyCBx1T6nkXQ4czS5Nvn1dav87sgyowR52W52oiyomJyJtBrmrlP/2qgNAJgQuzah/ltuBBvyGCaiwFQFHzUjUNv/ENCNP06aEVTLdbkLXLNfvlw6NZbn8KIOGFmSncLT3hNtcRhS6XnrCIyOc6hYelzVLXPNhmWFo7Ob3/1GFSvlWVmzHEp5+AeTYAQmsAZMAe/E5ofVSrU/3DhXvxMjzdOq5bZ9FsOMfooxYIPp05kVsW4H6dB8kIUqQcWTntt4ys4=
file: "./releases/${BINARY_NAME}"
skip_cleanup: true
draft: true
tag_name: "${TRAVIS_TAG}"
on:
tags: true
# Nightly builds are allowed to fail
- env: &nightly ARGS="--resolver nightly"
dist: xenial
# Build on OS X in addition to Linux
- env: *lts-latest
os: osx
- env: *lts-fixed
addons:
artifacts: {paths: [./releases]}
homebrew:
packages: upx
before_deploy:
# Show dynamic libraries `hadolint` depends on
- otool -L $(which hadolint) || true
# Compress binary
- upx -q --best --ultra-brute "./releases/${BINARY_NAME}"
deploy:
<<: *release_deploy
os: osx
- env: *nightly
os: osx
- env: Build_Docker_Image
sudo: required
services:
- docker
before_install: true
install:
# Build image
- travis_wait 30 docker build
--tag hadolint:$(git describe --always --tags --dirty)
--file docker/Dockerfile
--target distro .
- docker build
--tag hadolint:$(git describe --always --tags --dirty)-debian
--file docker/Dockerfile
--target debian-distro .
script:
# List images
- docker image ls
# Lint its own Dockerfile
- docker run --rm -i hadolint:$(git describe --always --tags --dirty) <
docker/Dockerfile
# Check that version in hadolint in the same as its `git describe`
- grep $(git describe --dirty) <<<
$(docker run --rm -i hadolint:$(git describe --always --tags --dirty) hadolint --version)
- grep $(git describe --dirty) <<<
$(docker run --rm -i hadolint:$(git describe --always --tags --dirty)-debian hadolint --version)
after_success: true
- env: Version_Check_and_Linting
sudo: required
services:
- docker
before_install: true
install:
# Pull Markdown linting image
- docker pull zemanlx/remark-lint:0.1.4
script:
# Lint Markdown files
- docker run --rm -i -v $PWD:/lint/input:ro zemanlx/remark-lint:0.1.4 --frail .
# Lint Haskell files
- curl -sL https://raw.github.com/ndmitchell/hlint/master/misc/travis.sh | sh -s .
# Hardcoded version check - a version in package.yaml has to higher(before release)
# or same as git tag (after release).
- |
GIT_VERSION=$(git describe | grep -oE "[0-9]+\.[0-9]+\.[0-9]+")
HARDCODED_VERSION=$(grep version package.yaml | grep -oE "[0-9]+\.[0-9]+\.[0-9]+")
echo "${GIT_VERSION}\n${HARDCODED_VERSION}" | sort --check --version-sort \
|| ( echo "Update version in package.yaml and then tag git commit." && false )
after_success: true
allow_failures:
- env: *nightly
before_install:
- export BINARY_NAME="hadolint-$(uname -s)-$(uname -m)"
# Download and unpack the stack executable
- mkdir -p ~/.local/bin
- |
if [[ "${TRAVIS_OS_NAME}" = "osx" ]]
then
travis_retry curl -sSL https://www.stackage.org/stack/${TRAVIS_OS_NAME}-x86_64 \
| tar xz --strip-components=1 -C ~/.local/bin --include '*/stack'
else
travis_retry curl -sSL https://www.stackage.org/stack/${TRAVIS_OS_NAME}-x86_64 \
| tar xz --strip-components=1 -C ~/.local/bin --wildcards '*/stack'
fi
install:
- travis_retry stack --no-terminal --install-ghc $ARGS test --only-dependencies
- stack --no-terminal $ARGS install --ghc-options='-fPIC'
script:
- stack --no-terminal $ARGS test
- hadolint docker/Dockerfile
after_success:
- mkdir -p ./releases/
- cp "$(which hadolint)" "./releases/${BINARY_NAME}"