forked from metacall/core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
101 lines (90 loc) · 3.71 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
#
# MetaCall Library by Parra Studios
# Travis CD/CI infrastructure for MetaCall.
#
# Copyright (C) 2016 - 2021 Vicente Eduardo Ferrer Garcia <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
language: cpp
branches:
only:
- master # TODO: Change to master or tags
sudo: required
services:
- docker
dist: xenial
# Global environment variables
env:
global:
- DOCKER_VERSION: 18.06.1
- DOCKER_COMPOSE_VERSION: 1.22.0
- GHR_VERSION: 0.12.0
- GIT_SUBMODULE_STRATEGY: recursive
- IMAGE_REGISTRY: registry.gitlab.com
- IMAGE_NAME: registry.gitlab.com/$TRAVIS_REPO_SLUG
- ARTIFACTS_PATH: $TRAVIS_BUILD_DIR/artifacts
# Update Docker & Docker Compose
before_script:
- sudo rm /usr/local/bin/docker-compose || true
- curl -sL https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
- chmod +x docker-compose
- sudo mv docker-compose /usr/local/bin
- sudo sh -c 'echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list'
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- sudo apt-key fingerprint 0EBFCD88
- sudo apt-get update
- sudo apt-get -y install docker-ce=${DOCKER_VERSION}~ce~3-0~ubuntu # -$(lsb_release -cs)
# Run the build and packaging steps with cache
script:
# Try to pull the image from docker or build it (if the rate limit was hit)
- $TRAVIS_BUILD_DIR/docker-compose.sh pull || $TRAVIS_BUILD_DIR/docker-compose.sh cache
- $TRAVIS_BUILD_DIR/docker-compose.sh pack
# Custom script for deploying to GitHub the artifacts
after_script:
- curl -sL https://github.com/tcnksm/ghr/releases/download/v${GHR_VERSION}/ghr_v${GHR_VERSION}_linux_amd64.tar.gz | tar zx
- chmod +x ghr_v${GHR_VERSION}_linux_amd64/ghr
- sudo mv ghr_v${GHR_VERSION}_linux_amd64/ghr /usr/local/bin
- TRAVIS_REPO_OWNER=${TRAVIS_REPO_SLUG%/*}
- TRAVIS_REPO_NAME=${TRAVIS_REPO_SLUG#*/}
- PREVIOUS_TAG=`git describe HEAD^1 --abbrev=0 --tags`
- GIT_HISTORY=`git log --no-merges --format="- %s" ${PREVIOUS_TAG}..HEAD`
- if [[ $PREVIOUS_TAG == "" ]]; then GIT_HISTORY=`git log --no-merges --format="- %s"`; fi
- if [[ $TRAVIS_TAG == "" ]]; then TRAVIS_TAG=${PREVIOUS_TAG}; fi
- RELEASE_DATE=`date '+%Y-%m-%d'`
- echo "MetaCall ${TRAVIS_TAG} [${RELEASE_DATE}]"
- |
ghr -t $GITHUB_TOKEN -u $TRAVIS_REPO_OWNER -r $TRAVIS_REPO_NAME -c $TRAVIS_COMMIT \
-n "MetaCall ${TRAVIS_TAG} [${RELEASE_DATE}]" -b "${GIT_HISTORY}" -replace \
$TRAVIS_TAG $ARTIFACTS_PATH/packages/
# Install NPM for deploy
before_deploy:
- sudo apt-get -y install curl
- curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
- sudo apt-get -y install nodejs
- echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > $HOME/.npmrc
# Deploy artifacts to bintray and npm
deploy:
- provider: bintray
file: "$TRAVIS_BUILD_DIR/deploy/packages/descriptor-metacall.json"
user: "${BINTRAY_USER}"
key: "${BINTRAY_KEY}"
skip_cleanup: true
on:
tags: true
- provider: script
script:
- npm publish $TRAVIS_BUILD_DIR/source/ports/node_port --access public # TODO: --tag <tag>
skip_cleanup: true
on:
tags: true