forked from aws/jsii
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
38 lines (34 loc) · 1.45 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
language: minimal
branches:
only:
- master
- release
- /^v\d+\.\d+.\d+$/
cache:
yarn: true
directories: node_modules
services:
- docker
script:
- set -eo pipefail
# Building the Docker image
- docker build --pull --build-arg BUILD_TIMESTAMP=$(date -u +'%Y-%m-%dT%H:%M:%SZ') --build-arg COMMIT_ID="${TRAVIS_COMMIT}" -t "jsii/superchain:nightly" ./superchain
# Building jsii itself within the Docker image
- docker run --rm -it --network=host -v ${PWD}:${PWD} -w ${PWD} jsii/superchain:nightly bash -c "yarn install --frozen-lockfile && yarn build && yarn test"
# Make sure the build did not change the source tree
- git update-index --refresh
- git diff-index --exit-code --stat HEAD
- untracked=$(git ls-files --others --exclude-standard) && echo "${untracked}" && test -z "${untracked}"
# Publish the image to DockerHub when relevant
- echo "TRAVIS_PULL_REQUEST = ${TRAVIS_PULL_REQUEST:-}"
- echo "TRAVIS_TAG = ${TRAVIS_TAG:-}"
- echo "TRAVIS_BRANCH = ${TRAVIS_BRANCH:-}"
- >-
if [ ${TRAVIS_PULL_REQUEST} = false ] && [ ! -z "${DOCKER_USERNAME+SET}" ] && [ ! -z "${DOCKER_PASSWORD+SET}" ]; then
echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin
docker push jsii/superchain:nightly
if [ "${TRAVIS_TAG:-}" = "${TRAVIS_BRANCH}" ]; then
docker tag jsii/superchain:nightly jsii/superchain:latest
docker push jsii/superchain:latest
fi
fi