-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
62 lines (56 loc) · 2.95 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
sudo: required
language: python
env:
global:
- TERM=dumb
- DOCKER_IMAGE="quay.io/abn/rpmbuilder"
- COPR_REPOSITORY=todo
- OS_ARCH=x86_64
- SVN_REPO_URL="https://svn.code.sf.net/p/doublecmd/code/trunk"
- BASE_SVN_REVISION=8901
- BASE_PACKAGE_VERSION=1.0.0
- BASE_PACKAGE_DATE="Thu Aug 15 2019"
- COPR_PROJECT=vondruch/doublecmd
- PRODUCTION_BRANCH=master
matrix:
- OS_TYPE=fedora OS_DIST=fedora OS_VERSION=32
services:
- docker
before_install:
# - export SVN_REVISION=`svn info ${SVN_REPO_URL} --show-item revision`
# Workaround as --shot-item is not available in SVN 1.8.8
- export SVN_REVISION=`svn info ${SVN_REPO_URL} | grep "Revision" | cut -d" " -f2`
- echo "Building SVN revision ${SVN_REVISION}"
- if ! [[ "${SVN_REVISION}" =~ ^-?[0-9]+$ ]]; then travis_terminate 1; fi
# Pass SVN revision for build to display in DoubleCmd
- export DC_REVISION="${SVN_REVISION}"
- sed -i s/"${BASE_SVN_REVISION}"/"${SVN_REVISION}"/g doublecmd-gtk.spec
- sed -i s/"* ${BASE_PACKAGE_DATE}"/"* $(date "+%a %b %d %Y")"/g doublecmd-gtk.spec
- git diff
# COPR credentials and cli
- pip install copr-cli simplejson
- if [[ "${TRAVIS_SECURE_ENV_VARS}" == "true" ]]; then
openssl aes-256-cbc -K $encrypted_a0f4470662d2_key -iv $encrypted_a0f4470662d2_iv -in copr.enc -out ~/.config/copr -d || travis_terminate 1;
fi
install:
- svn export ${SVN_REPO_URL} doublecmd-${BASE_PACKAGE_VERSION} || travis_terminate 1
- tar caf doublecmd-${BASE_PACKAGE_VERSION}-r${SVN_REVISION}.tar.xz doublecmd-${BASE_PACKAGE_VERSION} || travis_terminate 1
script:
- docker run -v ${PWD}:/sources -v ${PWD}:/output:Z -e "SRPM_ONLY=1" ${DOCKER_IMAGE}:${OS_TYPE}-${OS_VERSION} || travis_terminate 1
- ls -l *.rpm || travis_terminate 1
# Could be moved before RPM build process, however, having it after provided sanity tests even if no new commits are made
- if [[ "${PRODUCTION_BRANCH}" == "${TRAVIS_BRANCH}" && "${TRAVIS_SECURE_ENV_VARS}" == "true" ]]; then
export LAST_SUCCEEDED_BUILD_SVN_REVISION=`copr-cli get-package --name doublecmd-gtk --with-latest-succeeded-build "${COPR_PROJECT}" | jq -r '.latest_succeeded_build.source_package.version' | gawk 'match($0, /\.svn([0-9]*)\.fc/, a) {print a[1]}'`;
if [[ "${LAST_SUCCEEDED_BUILD_SVN_REVISION}" == '' ]]; then
echo "Unable to find last succeeded build number";
travis_terminate 1;
fi;
if [[ "${SVN_REVISION}" -gt "${LAST_SUCCEEDED_BUILD_SVN_REVISION}" ]]; then
echo "Building code from SVN revision ${SVN_REVISION} in COPR. It may take several minutes.";
stdbuf -o 0 copr-cli build "${COPR_PROJECT}" doublecmd-gtk-${BASE_PACKAGE_VERSION}-*.src.rpm || travis_terminate 1;
else
echo "Skipping COPR build. Current SVN revision (${SVN_REVISION}) is not greater than previously build in COPR (${LAST_SUCCEEDED_BUILD_SVN_REVISION}).";
fi;
else
echo "Skipping COPR build. Not in production branch ${PRODUCTION_BRANCH}.";
fi;