forked from nodejs/docker-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
travis.yml.template
113 lines (98 loc) · 3.04 KB
/
travis.yml.template
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
---
dist: xenial
language: minimal
services:
- docker
.before_script: &auto_skip
- |
if [ "false" != "$TRAVIS_PULL_REQUEST" ]; then
TRAVIS_COMMIT_RANGE="$TRAVIS_BRANCH..$TRAVIS_PULL_REQUEST_SHA"
fi
if [ "default" = "$VARIANT" ]; then
Dockerfile="$NODE_VERSION/Dockerfile"
else
Dockerfile="$NODE_VERSION/$VARIANT/Dockerfile"
fi
if [ "" = "$TRAVIS_COMMIT_RANGE" ]; then
echo "This is a new branch"
elif ! git diff --name-only "$TRAVIS_COMMIT_RANGE" -- &> /dev/null; then
echo "Change range not recognized: '$TRAVIS_COMMIT_RANGE'"
elif git diff --name-only "$TRAVIS_COMMIT_RANGE" -- | grep -Eq "^$Dockerfile$"; then
echo "Change of $Dockerfile detected."
else
echo "Skip build of $Dockerfile as it's not changed."
exit
fi
script: ./test-build.sh $NODE_VERSION $VARIANT
stages:
- Test
- Build
- name: Deploy
if: branch = master AND type IN (push)
jobs:
fast_finish: true
allow_failures:
- env:
- TEST=mardown_lint
include:
- stage: Test
name: Markdown link check
env:
- TEST=mardown_lint
language: node_js
node_js:
- lts/*
install:
- npm i -g markdown-link-check
script:
- find . -name "*.md" | xargs -n 1 markdown-link-check
- stage: Test
name: Editor Config check
language: node_js
node_js:
- lts/*
install:
- npm i -g eclint
script:
- eclint check
- stage: Test
name: Doc Toc Check
language: node_js
node_js:
- lts/*
install: npm i -g doctoc
script:
- cp README.md README.md.tmp &&
doctoc --title='## Table of Contents' --github README.md &&
diff -q README.md README.md.tmp
- stage: Test
name: shfmt check
script:
- docker run -it --rm -v "$(pwd)":/sh -w /sh peterdavehello/shfmt:2.6.3 shfmt -sr -i 2 -l -w -ci .
- git diff --color
- git diff --stat=220 --color --exit-code
- stage: Test
name: Shell Check
script: shellcheck *.sh
- stage: Test
name: .travis.yml and travis.yml.template consistency
script:
- ./update.sh -t
- git diff --stat --exit-code .travis.yml
- stage: Deploy
before_script:
- |
if ! git diff --name-only "$TRAVIS_COMMIT_RANGE" -- | grep -Eq "Dockerfile$"; then
if git diff --name-only "$TRAVIS_COMMIT_RANGE" -- | grep -Eq "^generate-stackbrew-library.sh$"; then
if ! git diff "$TRAVIS_COMMIT_RANGE" -- generate-stackbrew-library.sh | grep -Eq '^[-+]array_[0-9]'; then
echo "Skip deployment as none of the Dockerfiles and version tag array in generate-stackbrew-library.sh has been changed."
exit
fi
else
echo "Skip deployment as none of the Dockerfiles and generate-stackbrew-library.sh has been changed."
exit
fi
fi
script:
- ./generate-stackbrew-pr.sh "$TRAVIS_COMMIT_RANGE"
# Docker Build #