forked from mendersoftware/mender
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
145 lines (124 loc) · 4.97 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
language: go
# Golang version matrix
go:
# use the same version as available in oe-meta-go
- 1.9.7
env:
global:
# Should be encrypted or set as private travis variables (in travis settings):
# - AWS_S3_ACCESS_KEY_ID=''
# - AWS_S3_SECRET_ACCESS_KEY=''
# - GITHUB_RELEASE_TOKEN=''
# AWS S3 bucket name, need to have access setup.
# Can be overridden by travis private variable set in travis settings: AWS_BUCKET_OVERRIDE
- AWS_BUCKET_DEFAULT=mender-buildsystem
# AWS region.
# Can be overridden by travis private variable set in travis settings: AWS_REGION_OVERRIDE
- AWS_REGION_DEFAULT=eu-west-1
# AWS S3 ACL for build artifacts.
# Valid ACL values are: private, public_read, public_read_write, authenticated_read,
# bucket_owner_read, bucket_owner_full_control.
# Can be overridden by travis private variable set in travis settings: AWS_S3_ACL_OVERRIDE
- AWS_S3_ACL_DEFAULT=private
# Perform deployment steps if the build is performed for build: user/repo_name
# $TRAVIS_REPO_SLUG could be used if want to perform deploy on any repo.
# Currently perform deployment steps only of building main repository.
# Can be overridden by travis private variable set in travis settings: DEPLOY_REPO_OVERRIDE
- DEPLOY_REPO_DEFAULT=mendersoftware/mender
# Binary name to be uploaded to github release.
- GITHUB_RELEASE_BINARY=mender
# Build artifacts list, fomat: "file1 file2 ./dir/file3"
# Can be overridden by travis private variable set in travis settings: BUILD_ARTIFACTS_OVERRIDE
- BUILD_ARTIFACTS_DEFAULT="mender"
# INTERNAL VARIABLES (for default/overrite management)
- AWS_BUCKET=${AWS_BUCKET_OVERRIDE:-$AWS_BUCKET_DEFAULT}
- AWS_REGION=${AWS_REGION_OVERRIDE:-$AWS_REGION_DEFAULT}
- AWS_S3_ACL=${AWS_S3_ACL_OVERRIDE:-$AWS_S3_ACL_DEFAULT}
- DEPLOY_REPO=${DEPLOY_REPO_OVERRIDE:-$DEPLOY_REPO_DEFAULT}
- BUILD_ARTIFACTS=${BUILD_ARTIFACTS_OVERRIDE:-$BUILD_ARTIFACTS_DEFAULT}
install:
# Get tools used in Makefile
- make get-tools
before_script:
# Print build info that binary is compiled with.
- echo $TRAVIS_COMMIT
- echo $TRAVIS_TAG
- echo $TRAVIS_BRANCH
- echo $TRAVIS_BUILD_NUMBER
- echo $TRAVIS_REPO_SLUG
# Rename the branch we're on, so that it's not in the way for the
# subsequent fetch. It's ok if this fails, it just means we're not on any
# branch.
- git branch -m temp-branch || true
# Git trick: Fetch directly into our local branches instead of remote
# branches.
- git fetch origin 'refs/heads/*:refs/heads/*'
# Get last remaining tags, if any.
- git fetch --tags origin
# run extra checks. Tests will run as coverage tests.
- make extracheck
script:
- make coverage
# Build
- make build V=1
after_success:
# Integrate with https://codecov.io
- bash <(curl -s https://codecov.io/bash)
# Make build directory and copy all artifacts to this directory.
- mkdir build
- cp $BUILD_ARTIFACTS build/
deploy:
# In case tag is set. Deploy build as github release.
# List of files to be uploaded need to be specified in 'file' field
-
provider: releases
api_key: $GITHUB_RELEASE_TOKEN
file: $GITHUB_RELEASE_BINARY
skip_cleanup: true
on:
repo: $DEPLOY_REPO
tags: true
all_branches: true
# Deploy tag builds to S3 in structure /user/repo/release/tag/os_arch/
-
provider: s3
access_key_id: $AWS_S3_ACCESS_KEY_ID
secret_access_key: $AWS_S3_SECRET_ACCESS_KEY
bucket: $AWS_BUCKET
region: $AWS_REGION
upload-dir: $DEPLOY_REPO/release/$TRAVIS_TAG/`go env GOOS`_`go env GOARCH`
local_dir: build
skip_cleanup: true
acl: $AWS_S3_ACL
on:
repo: $DEPLOY_REPO
tags: true
all_branches: true
# Deploy all development builds to S3 in structure /user/repo/dev/branch/build/os_arch/
-
provider: s3
access_key_id: $AWS_S3_ACCESS_KEY_ID
secret_access_key: $AWS_S3_SECRET_ACCESS_KEY
bucket: $AWS_BUCKET
region: $AWS_REGION
upload-dir: $DEPLOY_REPO/dev/$TRAVIS_BRANCH/$TRAVIS_BUILD_NUMBER/`go env GOOS`_`go env GOARCH`
local_dir: build
skip_cleanup: true
acl: $AWS_S3_ACL
on:
repo: $DEPLOY_REPO
tags: false
all_branches: true
# Deploy all builds to S3 as latest folder /user/repo/latest/branch/os_arch
-
provider: s3
access_key_id: $AWS_S3_ACCESS_KEY_ID
secret_access_key: $AWS_S3_SECRET_ACCESS_KEY
bucket: $AWS_BUCKET
region: $AWS_REGION
upload-dir: $DEPLOY_REPO/latest/$TRAVIS_BRANCH/`go env GOOS`_`go env GOARCH`
local_dir: build
skip_cleanup: true
acl: $AWS_S3_ACL
on:
repo: $DEPLOY_REPO