-
Notifications
You must be signed in to change notification settings - Fork 17
/
.travis.yml
163 lines (150 loc) · 5.02 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
language: c
branches:
only:
- master
- /^v[0-9]+\.[0-9]+\.[0-9]+$/
env:
global:
- DISABLE_VALGRIND="false"
- TRAVIS_REPO_OWNER=${TRAVIS_REPO_SLUG%/*}
- TRAVIS_REPO_NAME=${TRAVIS_REPO_SLUG#*/}
before_install:
install:
script:
- mkdir build
- pushd build
- cmake .. -DDISABLE_VALGRIND:BOOL=${DISABLE_VALGRIND}
- build-wrapper-linux-x86-64 --out-dir bw-output make all test
- popd
after_success:
- find . -type f -name '*.gcda' -exec gcov -p {} +
- sonar-scanner -Dproject.settings=.sonar-project.properties
- bash <(curl -s https://codecov.io/bash) -F unittests || echo "Codecov did not collect coverage reports"
stages:
- test
- coverity
- tag
- release
jobs:
include:
- stage: test
name: "Trusty gcc build"
os: linux
dist: trusty
compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- libcunit1
- libcunit1-doc
- libcunit1-dev
- libtool
- valgrind
- lcov
sonarcloud:
organization: "xmidt-org"
token: "$SONAR_TOKEN"
- stage: test
name: "Trusty clang build"
os: linux
dist: trusty
compiler: clang
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- libcunit1
- libcunit1-doc
- libcunit1-dev
- libtool
- valgrind
- lcov
sonarcloud:
organization: "xmidt-org"
token: "$SONAR_TOKEN"
after_success: skip
# How the tag and release targets work
#
# Each time a build is run on the main branch the CHANGELOG.md file is
# checked To see if there is a new version tag with details under it. If a
# version with details is found then **tag** creates a new tag with the
# proper version.
#
# The creation of the tag branch triggers the **release** stage.
#
# The release stage builds tar.gz and zip artificts as well as creates a
# SHA256 checksum of the files. The process then pushes these files up to
# Github for hosting.
#
# Why do this? Yocto and other build systems depend on the artifacts being
# consistent each time they are downloaded, but there is an issue with the
# way Github generates the artifacts on the fly where on occasion the
# checksum changes. By explicitly producing our own artifacts we eliminate
# this issue for systems that rely on the checksum being constant
- stage: tag
name: "Tag For Release"
if: branch = master && type = push
before_script:
- echo -e "machine github.com\n login $GH_TOKEN" > ~/.netrc
script:
- export OLD_VERSION=$(git describe --tags `git rev-list --tags --max-count=1` | tail -1 | sed 's/v\(.*\)/\1/')
- git config --global user.name "xmidt-bot"
- git config --global user.email "$BOT_EMAIL"
- export TAG=$(cat CHANGELOG.md | perl -0777 -ne 'print "$1" if /.*## \[Unreleased\]\s+## \[(v\d+.\d+.\d+)\].*/s')
- export TODAY=`date +'%m/%d/%Y'`
- export NOTES=$(cat CHANGELOG.md | perl -0777 -ne 'print "$ENV{TODAY}\n\n$1\n" if /.*## \[$ENV{TAG}\]\s(.*?)\s+## \[(v\d+.\d+.\d+)\].*/s')
- if [[ "$TAG" != "" && "$TAG" != "$OLD_VERSION" ]]; then git tag -a "$TAG" -m "$NOTES"; git push origin --tags; echo $?; fi
addons:
before_install: skip
after_success: skip
- stage: release
name: "Make a Release"
if: branch != master
script:
- export VERSION=${TRAVIS_TAG##*v}
- git archive --format=tar.gz --prefix=${TRAVIS_REPO_NAME}-${VERSION}/ -o ${TRAVIS_REPO_NAME}-${VERSION}.tar.gz ${TRAVIS_TAG}
- git archive --format=zip --prefix=${TRAVIS_REPO_NAME}-${VERSION}/ -o ${TRAVIS_REPO_NAME}-${VERSION}.zip ${TRAVIS_TAG}
- sha256sum ${TRAVIS_REPO_NAME}-${VERSION}.tar.gz ${TRAVIS_REPO_NAME}-${VERSION}.zip > sha256sum.txt
deploy:
cleanup: false
on:
all_branches: true
tags: true
provider: releases
api_key: "$GH_TOKEN"
file:
- "${TRAVIS_REPO_NAME}-${VERSION}.tar.gz"
- "${TRAVIS_REPO_NAME}-${VERSION}.zip"
- "sha256sum.txt"
addons:
before_install: skip
- stage: coverity
name: "Coverity build"
if: branch = master
os: linux
dist: trusty
compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- libcunit1
- libcunit1-doc
- libcunit1-dev
- libtool
- valgrind
- lcov
coverity_scan:
project:
name: ${TRAVIS_REPO_SLUG}
notification_email: weston_schmidt@alumni.purdue.edu
build_command_prepend: "mkdir coverity_build && cd coverity_build && cmake .."
build_command: "make"
branch_pattern: master
after_success: skip
allow_failures:
- stage: coverity