aboutsummaryrefslogtreecommitdiffstats
path: root/.github/containers/centos7/build.sh
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2021-06-07 17:09:15 +0200
committerPierre Ossman <ossman@cendio.se>2021-06-08 11:17:16 +0200
commitabcabc5a9ee3e34935c03676aa8d9451fe8f47d0 (patch)
tree748ecc25d680fb51915c5764995fa6e526446592 /.github/containers/centos7/build.sh
parent8616c0bd67d7c393c30816d1a72edd477514afce (diff)
downloadtigervnc-abcabc5a9ee3e34935c03676aa8d9451fe8f47d0.tar.gz
tigervnc-abcabc5a9ee3e34935c03676aa8d9451fe8f47d0.zip
Convert CI to GitHub Actions
Travis has unfortunately been severely rate limited by Docker Hub so we have to switch to GitHub, which has an agreement with Docker to avoid the rate limiting.
Diffstat (limited to '.github/containers/centos7/build.sh')
-rwxr-xr-x.github/containers/centos7/build.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/.github/containers/centos7/build.sh b/.github/containers/centos7/build.sh
new file mode 100755
index 00000000..55ad8107
--- /dev/null
+++ b/.github/containers/centos7/build.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+set -e
+set -x
+
+## Basic variables
+
+CURDIR=$(dirname $(readlink -f $0))
+TOPDIR=$(git rev-parse --show-toplevel 2>/dev/null)
+
+RPMDIR=${TOPDIR}/contrib/packages/rpm/el7
+
+VERSION=$(grep '^set(VERSION ' ${TOPDIR}/CMakeLists.txt | sed 's@^set(VERSION \(.*\))@\1@')
+
+## Prepare the build directory
+
+rm -rf ${CURDIR}/rpmbuild
+mkdir -p ${CURDIR}/rpmbuild/{BUILD,BUILDROOT,SRPMS,SOURCES,SPECS,RPMS}
+chmod a+w ${CURDIR}/rpmbuild/{BUILD,BUILDROOT,SRPMS,RPMS}
+[ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled && chcon -Rt container_file_t ${CURDIR}/rpmbuild
+
+## Copy over the packaging files
+
+cp ${RPMDIR}/SOURCES/* ${CURDIR}/rpmbuild/SOURCES
+cp ${RPMDIR}/SPECS/tigervnc.spec ${CURDIR}/rpmbuild/SPECS
+sed -i "s/@VERSION@/${VERSION}/" ${CURDIR}/rpmbuild/SPECS/tigervnc.spec
+
+## Copy over the source code
+
+(cd ${TOPDIR} && git archive --prefix tigervnc-${VERSION}/ HEAD) | bzip2 > ${CURDIR}/rpmbuild/SOURCES/tigervnc-${VERSION}.tar.bz2
+
+## Start the build
+
+docker run --volume ${CURDIR}/rpmbuild:/home/rpm/rpmbuild --interactive --rm tigervnc/${DOCKER} \
+ bash -c "
+ sudo yum-builddep -y ~/rpmbuild/SPECS/tigervnc.spec &&
+ sudo chown 0.0 ~/rpmbuild/SOURCES/* &&
+ sudo chown 0.0 ~/rpmbuild/SPECS/* &&
+ rpmbuild -ba ~/rpmbuild/SPECS/tigervnc.spec
+ "