-
-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy path.travis.yml
130 lines (121 loc) · 4.93 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
language: python
sudo: required
services:
- docker
matrix:
fast_finish: true
include:
- env: ARCH=linux/amd64 TAG_SUFFIX=amd64
- env: ARCH=linux/arm/v7 TAG_SUFFIX=arm32v7
before_install:
- python --version
# command to install dependencies
# update docker to edge
- sudo apt-get update -y
- sudo apt-get install --only-upgrade docker-ce -y
- echo '{"experimental":true}' | sudo tee /etc/docker/daemon.json
- export DOCKER_CLI_EXPERIMENTAL=enabled
- sudo service docker restart
- docker --version
install:
# - docker buildx --help
#- cd ${TRAVIS_BUILD_DIR}/build
# - ./ambianic-build.sh
- pip3 install -U codecov
# command to run tests
script:
# fail fast
# - set -e
# Raspberry PI section
# prepare qemu
- DEV_TAG=dev-${TAG_SUFFIX}
- PROD_TAG=latest-${TAG_SUFFIX}
- docker run --rm --privileged docker/binfmt:66f9012c56a8316f9244ffd7622d7c21c1f6f28d
- cat /proc/sys/fs/binfmt_misc/qemu-aarch64
# - docker buildx create --name mybuilder
# - docker buildx use mybuilder
# - docker buildx inspect --bootstrap
# setup ARM CPU (raspberry pi) build support
# - >
# if [[ $ARCH =~ "arm" ]]; then
# if [ -z "${ARCH##*arm*}"]; then
# sudo apt-get --yes --no-install-recommends install binfmt-support qemu-user-static
# docker run --rm --privileged multiarch/qemu-user-static:register --reset
# fi
# # build image
- cd ${TRAVIS_BUILD_DIR}/build
- docker build -f Dev.Dockerfile --platform ${ARCH} -t "ambianic/ambianic-edge:${DEV_TAG}" .
- docker tag ambianic/ambianic-edge:${DEV_TAG} "ambianic/ambianic-edge:dev"
# - docker buildx build -f Dev.Dockerfile --platform ${ARCH} -t ambianic/ambianic:dev .
# - sudo docker build -f Dev.Dockerfile --platform $ARCH -t ambianic/ambianic:dev --build-arg ARCH=$ARCH .
# test image
# - sudo docker run ambianic/ambianic --version
# docker tag ambianic/ambianic ambianic/ambianic:$TAG
# docker push ambianic/ambianic:$TAG
# docker push ambianic/ambianic
- docker images
- cd $TRAVIS_BUILD_DIR/build
- ./ambianic-test.sh
# publish binaries
- >
if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
echo "ARCH=$ARCH"
echo "DEV_TAG=$DEV_TAG"
echo "PROD_TAG=$PROD_TAG"
pwd
ls -al
docker login -u="$DOCKER_USER" -p="$DOCKER_PASS"
docker push "ambianic/ambianic-edge:${DEV_TAG}"
docker manifest create "ambianic/ambianic-edge:dev" "ambianic/ambianic-edge:dev-amd64" "ambianic/ambianic-edge:dev-arm32v7"
docker manifest annotate "ambianic/ambianic-edge:dev" "ambianic/ambianic-edge:dev-arm32v7" --os=linux --arch=arm --variant=v7
docker manifest annotate "ambianic/ambianic-edge:dev" "ambianic/ambianic-edge:dev-amd64" --os=linux --arch=amd64
docker manifest push "ambianic/ambianic-edge:dev"
cd ${TRAVIS_BUILD_DIR}
pwd
ls -al
cp README.md ./src
docker build -f ./build/Prod.Dockerfile --platform ${ARCH} -t "ambianic/ambianic-edge:${PROD_TAG}" ./src
docker tag "ambianic/ambianic-edge:${PROD_TAG}" "ambianic/ambianic-edge:latest"
docker push "ambianic/ambianic-edge:${PROD_TAG}"
docker manifest create "ambianic/ambianic-edge:latest" "ambianic/ambianic-edge:latest-amd64" "ambianic/ambianic-edge:latest-arm32v7"
docker manifest annotate "ambianic/ambianic-edge:latest" "ambianic/ambianic-edge:latest-arm32v7" --os=linux --arch=arm --variant=v7
docker manifest annotate "ambianic/ambianic-edge:latest" "ambianic/ambianic-edge:latest-amd64" --os=linux --arch=amd64
docker manifest push "ambianic/ambianic-edge:latest"
fi
# cmd=./semantic-release.sh
# $cmd
# status=$?
# [ $status -eq 0 ] && echo "$cmd command was successful" || echo "$cmd failed"
# echo "Semantic Release completed"
- echo $PWD
- cd $TRAVIS_BUILD_DIR
- ls -al
after_success:
- codecov # submit code coverage
jobs:
include:
- if: branch = master AND env(TRAVIS_PULL_REQUEST) = false
- stage: test
env: ARCH=linux/amd64 TAG_SUFFIX=amd64
- stage: test
env: ARCH=linux/arm/v7 TAG_SUFFIX=arm32v7
- stage: release
before_install: skip
install: skip
script:
- >
if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
set -x
nvm install lts/*
npm install --save-dev @semantic-release/commit-analyzer
npm install --save-dev @semantic-release/git
npm install --save-dev semantic-release
npm install --save-dev semantic-release-docker
npm install --save-dev @semantic-release/release-notes-generator
npm install --save-dev @semantic-release/github
npm install --save-dev @semantic-release/changelog
npm install --save-dev @semantic-release/exec
echo "Running semantic release..."
npx semantic-release
fi
after_success: skip