forked from flameshot-org/flameshot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
192 lines (162 loc) · 5.48 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
os: linux
sudo: false
dist: trusty
stages:
- Build & Test
- Packaging
- name: Deploy
# if: branch = master
env:
global:
#### Destination binary path
- BUILD_DST_PATH=build
#### Destination packaging path. If we use one by job they doesn't need to wait until the others end
- APPIMAGE_DST_PATH=build-appimage
- DEB_DST_PATH=build-deb
jobs:
include:
############## Build & Test ##############
- stage: Build & Test
#language: cpp -> Not necessary because we use specific versions
#compiler: gcc -> Not necessary because we use specific versions
cache:
- ccache: true
- apt: true
- directories:
### > Save the build directory to reuse in other jobs
- &build_dst_path build
addons: &build_apt
apt:
sources:
# qt5 >= 5.3
- sourceline: 'ppa:beineri/opt-qt532-trusty'
# g++ & gcc >= 4.9
- ubuntu-toolchain-r-test
packages:
- git
- build-essential
#### Replacement of: qt5-qmake, qt5-default, qttools5-dev-tools
- qt53base
- qt53tools
#### Using g++ >= 4.9
- g++-4.9
- gcc-4.9
before_install:
##### Clean cache folder
- rm -rf $BUILD_DST_PATH/*
before_script: &build_before_script
#### Use qt5 == 5.3 instead other version
- source /opt/qt53/bin/qt53-env.sh && qmake --version
##### Use gcc y cpp == 4.9 instead other version
- export CC=gcc-4.9 CXX=g++-4.9
script:
- qmake QMAKE_CXX=$CXX QMAKE_CC=$CC QMAKE_LINK=$CXX DESTDIR=$BUILD_DST_PATH
# Building flameshot
- make -j$(nproc)
# Running flameshot tests
- make check -j$(nproc)
- ls -alhR
after_script:
#### Wait for the cache to update
- sleep 10
############## Packaging AppImage ##############
- stage: Packaging
#language: cpp
#compiler: gcc
cache:
- directories:
- *build_dst_path
### > Save the appimage directory to reuse in other jobs
- &appimage_dst_path build-appimage
addons:
apt:
sources:
# qt5 >= 5.3
- sourceline: 'ppa:beineri/opt-qt532-trusty'
packages:
#### Replacement of: qt5-qmake, qt5-default, qttools5-dev-tools
- qt53base
# - qt53tools
before_install:
##### Clean cache folder
- rm -rf $APPIMAGE_DST_PATH/*
before_script:
#### Use qt5 == 5.3 instead other version
- source /opt/qt53/bin/qt53-env.sh && qmake --version
##### Download and install linuxdeployqt
- wget -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" -O linuxdeployqt
- chmod +x linuxdeployqt
## Extract linuxdeployqt in 'squashfs-root/'
- ./linuxdeployqt --appimage-extract
# - ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'
#|-squashfs-root
#|---usr
#|-----bin
#|-----lib
#|-----share
#|-------doc
#|---------libicu52
#|---------libpcre3
#|---------qt59base
#|-----translations
script:
#### Prepare packing
- mkdir appdir
- cp $BUILD_DST_PATH/flameshot appdir/
- cp docs/desktopEntry/package/* appdir/
- cp img/flameshot.png appdir/
- ls -alhR appdir/
#### Configure env vars
- unset QTDIR QT_PLUGIN_PATH LD_LIBRARY_PATH
- export VERSION=$(git rev-parse --short HEAD) # linuxdeployqt uses this for naming the file
#### Packaging
- ./squashfs-root/usr/bin/linuxdeployqt appdir/flameshot -verbose=2 -bundle-non-qt-libs
- ln -sf plugins/platforms/ appdir/platforms # An unknown bug
- ./squashfs-root/usr/bin/linuxdeployqt appdir/flameshot -verbose=2 -appimage
- ls -alhR ./*.AppImage
- cp *.AppImage $APPIMAGE_DST_PATH/
after_script:
#### Wait for the cache to update
- sleep 10
############## Packaging Deb ##############
#- stage: Packaging
#cache:
#- directories:
#- *build_dst_path
#### > Save the deb directory to reuse in other jobs
#- &deb_dst_path build-deb
#before_install:
###### Clean cache folder
#- rm -rf $DEB_DST_PATH/*
#script:
#- ls -alhR $BUILD_DST_PATH
#- echo "Do .deb" > $DEB_DST_PATH/dev.txt
#- ls -alhR $DEB_DST_PATH
#after_script:
##### Wait for the cache to update
#- sleep 10
############## Deploy ##############
- stage: Deploy
cache:
- directories:
- *build_dst_path
- *appimage_dst_path
#- *deb_dst_path
script:
# - ls -alhR $BUILD_DST_PATH
- ls -alhR ./build*
#### Upload all files to transfer.sh
- WHERE_FIND="$BUILD_DST_PATH $APPIMAGE_DST_PATH $DEB_DST_PATH"
- |
for file_path in $(find $WHERE_FIND -maxdepth 1 -mindepth 1 -type f)
do
curl --upload-file "$file_path" "https://transfer.sh/$(basename $file_path)"
printf "\n\n"
done
before_cache:
#### Clean cache to optimize future builds
- find . -type f -delete
notifications:
email:
on_success: change
on_failure: always