forked from P403n1x87/austin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
208 lines (167 loc) · 4.96 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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
language: c
python:
- 2.7
- 3.3
- 3.4
- 3.5
- 3.6
- 3.8
- 3.9
compiler:
- gcc
git:
depth: false
osx_image: xcode11.4
os: linux
dist: bionic
jobs:
include:
# Linux
- env: TARGET=x86_64-unknown-linux-gnu
arch: amd64
- env: TARGET=powerpc64le-unknown-linux-gnu
arch: ppc64le
# - env: TARGET=arm64-unknown-linux-gnueabi
# arch: arm64
# OSX
- env: TARGET=x86_64-apple-darwin
os: osx
# Windows
- env: TARGET=x86_64-pc-windows-gnu
os: windows
before_script:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]];
then
sudo add-apt-repository ppa:deadsnakes/ppa -y;
sudo add-apt-repository ppa:duggan/bats -y;
sudo apt-get install -y bats valgrind python2.{3..7} python3.{3..10};
autoreconf --install;
fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]];
then
git clone --depth=1 https://github.com/bats-core/bats-core.git;
fi
# brew install --HEAD valgrind || true;
- if [[ "$TRAVIS_OS_NAME" == "windows" ]];
then
powershell Install-WindowsFeature Net-Framework-Core;
cinst -y wixtoolset;
fi
script:
- echo $TRAVIS_OS_NAME -- $TARGET
- if [[ "$TARGET" == "x86_64-unknown-linux-gnu" ]];
then
./configure &&
make &&
sudo make check;
test -f /tmp/austin_tests.log && cat /tmp/austin_tests.log;
fi
# - if [[ "$TARGET" == "arm64-unknown-linux-gnueabi" ]];
# then
# gcc -O3 -Os -Wall -pthread src/*.c -o src/austin;
# which bats && sudo bats test/test.bats || src/austin -V;
# fi
- if [[ "$TARGET" == "powerpc64le-unknown-linux-gnu" ]];
then
./configure &&
make;
which bats && sudo bats test/test.bats || src/austin -V;
fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]];
then
gcc -Wall -O3 -Os -o src/austin src/*.c &&
sudo bats-core/bin/bats test/macos/test.bats;
test -f /tmp/austin_tests.log && cat /tmp/austin_tests.log;
fi
- if [[ "$TRAVIS_OS_NAME" == "windows" ]];
then
gcc -s -Wall -O3 -Os -o src/austin src/*.c -lpsapi -lntdll;
fi
after_success:
./src/austin -V;
./src/austin --usage
after_failure:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]];
then
test -f /var/log/syslog.log && cat /var/log/syslog.log | grep austin;
test -f test-suite.log && cat test-suite.log;
fi
before_deploy:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]];
then
SED_FLAGS="-n -E";
else
SED_FLAGS="-r -n";
fi;
export VERSION=$(cat src/austin.h | sed $SED_FLAGS "s/.*VERSION[ ]+\"(.+)\"/\1/p");
# - export TRAVIS_TAG=v$VERSION
- echo "==== Preparing to create GitHub Release for version $VERSION ===="
- if [[ "$TRAVIS_OS_NAME" == "linux" ]];
then
export ZIP_CMD="tar -Jcf";
export ZIP_SUFFIX="linux-${TARGET%%-*}.tar.xz";
export AUSTIN_EXE=austin;
fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]];
then
export ZIP_CMD="zip -r";
export ZIP_SUFFIX="mac-${TARGET%%-*}.zip";
export AUSTIN_EXE=austin;
fi
- if [[ "$TRAVIS_OS_NAME" == "windows" ]];
then
export ZIP_CMD="7z a -tzip";
export ZIP_SUFFIX="win-${TARGET%%-*}.zip";
export AUSTIN_EXE=austin.exe;
export WIN_MSI="austin-$VERSION-win64.msi";
git checkout "packaging/msi";
git checkout master;
git checkout "packaging/msi" -- wix;
sed -i "s/%VERSION%/$VERSION/g" wix/Austin.wxs;
export PATH="/c/Program Files (x86)/`ls /c/Program\ Files\ \(x86\) | grep \"[wW]i[xX] [tT]oolset\"`/bin:$PATH";
cd wix;
candle Austin.wxs -out Austin.wixobj;
light -ext WixUIExtension Austin.wixobj -out $WIN_MSI;
cd .. ;
mv wix/$WIN_MSI src/$WIN_MSI;
test -f src/$WIN_MSI && echo ">> Windows MSI installer at src/$WIN_MSI" || echo ">> ERROR No Windows MSI installer generated.";
fi
- export ARTEFACT="austin-${VERSION}-${ZIP_SUFFIX}"
- echo ">> Using command $ZIP_CMD to create artefact $ARTEFACT"
- cd src
- $ZIP_CMD $ARTEFACT $AUSTIN_EXE
- echo ">> Generated artefact" $(ls $ARTEFACT)
- git config --local user.name "Gabriele N. Tornetta"
- git config --local user.email ${GITHUB_EMAIL}
- git tag -a -f -m "Release $VERSION" $TRAVIS_TAG
deploy:
- provider: releases
edge: true
token: $GITHUB_TOKEN
file:
- $ARTEFACT
- $WIN_MSI
overwrite: true
on:
tags: true
# - provider: releases
# edge: true
# token: $GITHUB_TOKEN
# file: $WIN_MSI
# overwrite: true
# on:
# condition: "$TRAVIS_OS_NAME = windows"
after_deploy:
- cd ..
- if [[ "$TRAVIS_OS_NAME" == "windows" ]];
then
export WIN_MSI_HASH=$( sha256sum src/$WIN_MSI | head -c 64 );
git checkout "packaging/msi" -- choco;
cd choco;
sed -i "s/%WIN_MSI_HASH%/$WIN_MSI_HASH/g" tools/chocolateyinstall.ps1;
/bin/find . -type f -exec sed -i "s/%VERSION%/$VERSION/g" {} \; ;
choco apikey --key $CHOCO_APIKEY --source https://push.chocolatey.org/;
choco pack;
choco push;
cd .. ;
fi