forked from nodejs/docker-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtravis.yml.template
66 lines (56 loc) · 1.94 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
---
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
include:
- 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 #