forked from angeld29/mvdsv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
115 lines (105 loc) · 3.9 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
dist: bionic
os:
- linux
compiler:
- gcc
language: c
env:
global:
DATETIME=$(date +%Y%m%d-%H%M%S)
DATE=${DATETIME%%-*}
TIME=${DATETIME##*-}
jobs:
include:
- os: linux
env:
OS=linux
ARCH=amd64
EXTENSION=
- os: linux
env:
OS=linux
ARCH=i686
EXTENSION=
- os: linux
env:
OS=linux
ARCH=armhf
EXTENSION=
- os: linux
env:
OS=linux
ARCH=aarch64
EXTENSION=
- os: linux
env:
OS=windows
ARCH=x64
EXTENSION=.exe
addons:
apt:
packages:
- mingw-w64
- os: linux
env:
OS=windows
ARCH=x86
EXTENSION=.exe
addons:
apt:
packages:
- mingw-w64
addons:
apt:
update: true
packages:
build-essential
python-virtualenv
python3-dev
python3-pip
ninja-build
cmake
gcc-multilib
before_install:
# install cross compiler tools if we are going to compile binares for arm (notice it will remove gcc-multilib and creates a dependency issue if we try to install those packages with the others)
- if [ -z "${ARCH##armhf}" ]; then sudo apt-get -y install gcc-arm-linux-gnueabihf libc6-dev-armhf-armel-cross ;fi
- if [ -z "${ARCH##aarch64}" ]; then sudo apt-get -y install gcc-aarch64-linux-gnu libc6-dev-arm64-cross ;fi
# activate virtualenv with python3, meson requires python3
- virtualenv .venv --python=python3
- . .venv/bin/activate
- pip3 install --upgrade pip
# install python packages like meson, ninja etc...
- pip3 install -r requirements.txt
before_script:
# add current commit ref to include files for debugging ease
- sed -i "s/#define GIT_COMMIT.*$/$(git log -n 1 --format=format:"#define GIT_COMMIT \"%h\"" HEAD)/" src/version.h
script:
# build binary
- meson build --buildtype=release --cross-file tools/cross-compilation/${OS}-${ARCH}.txt
- ninja -v -C build
after_success:
- export BINARY=mvdsv${EXTENSION}
- export CHECKSUM=mvdsv.md5
# print basic info about compiled files
- file build/${BINARY}
# create hash for download verification
- md5sum build/${BINARY} > build/${CHECKSUM}
# update snapshots links
- if [ -z "${TRAVIS_TAG}" ]; then mkdir -p upload/snapshots/${OS}/${ARCH} ;fi
- if [ -z "${TRAVIS_TAG}" ]; then mkdir -p upload/snapshots/latest/${OS}/${ARCH} ;fi
- if [ -z "${TRAVIS_TAG}" ]; then cp build/${BINARY} upload/snapshots/${OS}/${ARCH}/${DATETIME}_${TRAVIS_COMMIT:0:7}_${BINARY} ;fi
- if [ -z "${TRAVIS_TAG}" ]; then cp build/${CHECKSUM} upload/snapshots/${OS}/${ARCH}/${DATETIME}_${TRAVIS_COMMIT:0:7}_${CHECKSUM} ;fi
- if [ -z "${TRAVIS_TAG}" ]; then cp build/${BINARY} upload/snapshots/latest/${OS}/${ARCH}/${BINARY} ;fi
- if [ -z "${TRAVIS_TAG}" ]; then cp build/${CHECKSUM} upload/snapshots/latest/${OS}/${ARCH}/${CHECKSUM} ;fi
# update releases links
- if [ -n "${TRAVIS_TAG}" ]; then mkdir -p upload/releases/{latest,${TRAVIS_TAG}}/${OS}/${ARCH} ;fi
- if [ -n "${TRAVIS_TAG}" ]; then cp build/${BINARY} upload/releases/${TRAVIS_TAG}/${OS}/${ARCH}/${BINARY} ;fi
- if [ -n "${TRAVIS_TAG}" ]; then cp build/${CHECKSUM} upload/releases/${TRAVIS_TAG}/${OS}/${ARCH}/${CHECKSUM} ;fi
- if [ -n "${TRAVIS_TAG}" ]; then cp build/${BINARY} upload/releases/latest/${OS}/${ARCH}/${BINARY} ;fi
- if [ -n "${TRAVIS_TAG}" ]; then cp build/${CHECKSUM} upload/releases/latest/${OS}/${ARCH}/${CHECKSUM} ;fi
# add SFTP authentication key to the build environment
- openssl aes-256-cbc -K $encrypted_1e5406d6c11a_key -iv $encrypted_1e5406d6c11a_iv -in mvdsv_builds.key.enc -out mvdsv_builds.key -d
# set correct permissions on private key
- chmod 600 mvdsv_builds.key
# push built items to SFTP storage
- sftp -q -i mvdsv_builds.key -rp -o 'StrictHostKeyChecking no' -o 'UserKnownHostsFile /dev/null' -P ${SFTP_PORT} ${SFTP_USERNAME}@${SFTP_HOST}:/ <<< $'put -rp upload/*'