mirror of
https://github.com/darlinghq/darling.git
synced 2024-11-23 04:09:43 +00:00
Build RPMs with the CI; enable ccache
on CI
This commit is contained in:
parent
f1153d9b1a
commit
be134fcbec
@ -1,5 +1,5 @@
|
|||||||
# this Dockerfile must be built using the following command:
|
# this Dockerfile must be built using the following command:
|
||||||
# docker build -f ../ci/Dockerfile .
|
# docker build -f ../ci/Debian.Dockerfile .
|
||||||
# this command must be run while in the `debian` directory in the root of the repo.
|
# this command must be run while in the `debian` directory in the root of the repo.
|
||||||
FROM ubuntu:jammy
|
FROM ubuntu:jammy
|
||||||
LABEL name=darling-build-image version=0.1.0
|
LABEL name=darling-build-image version=0.1.0
|
||||||
@ -14,4 +14,8 @@ RUN apt-get -y install devscripts equivs debhelper && apt clean -y
|
|||||||
COPY control /control
|
COPY control /control
|
||||||
RUN mk-build-deps -i -r -t "apt-get --no-install-recommends -y" /control && apt clean -y
|
RUN mk-build-deps -i -r -t "apt-get --no-install-recommends -y" /control && apt clean -y
|
||||||
RUN rm /control
|
RUN rm /control
|
||||||
|
RUN apt-get -y install ccache && apt clean -y
|
||||||
|
RUN mkdir -p /ccache
|
||||||
|
RUN mkdir -p /src/mnt
|
||||||
|
RUN chown -R ci:ci /src
|
||||||
USER ci
|
USER ci
|
82
ci/Jenkinsfile
vendored
82
ci/Jenkinsfile
vendored
@ -1,21 +1,26 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
agent {
|
agent {
|
||||||
docker {
|
docker {
|
||||||
image 'registry.git.facekapow.dev/darling-build-image:latest'
|
image 'registry.git.facekapow.dev/darling-build-image-top:latest'
|
||||||
registryUrl 'https://registry.git.facekapow.dev'
|
registryUrl 'https://registry.git.facekapow.dev'
|
||||||
alwaysPull true
|
alwaysPull true
|
||||||
args '-u ci:ci'
|
args '-u ci:ci -v /var/run/docker.sock:/var/run/docker.sock --group-add docker'
|
||||||
label 'darling'
|
label 'darling'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parameters {
|
||||||
|
booleanParam(name: 'DEB', defaultValue: true, description: 'If true, build Debian packages.')
|
||||||
|
booleanParam(name: 'RPM', defaultValue: false, description: 'If true, build RPM packages.')
|
||||||
|
}
|
||||||
|
|
||||||
triggers {
|
triggers {
|
||||||
githubPush()
|
githubPush()
|
||||||
}
|
}
|
||||||
|
|
||||||
environment {
|
environment {
|
||||||
DEB_DISTRO = sh(script: 'lsb_release -cs', returnStdout: true).trim()
|
|
||||||
ESCAPED_JOB_NAME = sh(script: 'echo "${JOB_NAME}" | sed \'s/\\//-/g\'', returnStdout: true).trim()
|
ESCAPED_JOB_NAME = sh(script: 'echo "${JOB_NAME}" | sed \'s/\\//-/g\'', returnStdout: true).trim()
|
||||||
|
CCACHE_DIR = credentials('darling-ccache-dir')
|
||||||
}
|
}
|
||||||
|
|
||||||
options {
|
options {
|
||||||
@ -34,26 +39,79 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Build') {
|
stage('Prepare') {
|
||||||
steps {
|
steps {
|
||||||
dir('source') {
|
dir('source') {
|
||||||
sh 'git submodule update --init --recursive'
|
sh 'git submodule update --init --recursive'
|
||||||
sh 'cd src/external/swift && git lfs install && git lfs pull'
|
sh 'cd src/external/swift && git lfs install && git lfs pull'
|
||||||
touch '../.submodules-cloned'
|
touch '../.submodules-cloned'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//sh 'tools/debian/make-deb --dsc'
|
stage('Build Debian') {
|
||||||
sh 'tools/debian/make-deb'
|
when { expression { params.DEB } }
|
||||||
|
agent {
|
||||||
|
docker {
|
||||||
|
image 'registry.git.facekapow.dev/darling-build-image:latest'
|
||||||
|
registryUrl 'https://registry.git.facekapow.dev'
|
||||||
|
alwaysPull true
|
||||||
|
args '-u ci:ci -v ${WORKSPACE}/source:/src/mnt:rw -v ${CCACHE_DIR}:/ccache:rw'
|
||||||
|
label 'darling'
|
||||||
|
reuseNode true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
environment {
|
||||||
|
DEB_DISTRO = sh(script: 'lsb_release -cs', returnStdout: true).trim()
|
||||||
|
CCACHE_DIR = '/ccache'
|
||||||
|
CCACHE_BASEDIR = '/src/mnt'
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
//sh 'tools/debian/make-deb --dsc'
|
||||||
|
sh '''#!/bin/bash
|
||||||
|
pushd /src/mnt
|
||||||
|
tools/debian/make-deb
|
||||||
|
popd
|
||||||
|
'''
|
||||||
|
|
||||||
|
sh 'rm -rf out-deb'
|
||||||
|
sh 'mkdir out-deb'
|
||||||
|
|
||||||
|
dir('out-deb') {
|
||||||
|
sh 'mv /src/*.deb ./'
|
||||||
}
|
}
|
||||||
|
|
||||||
sh 'rm -rf out'
|
archiveArtifacts artifacts: 'out-deb/**/*', fingerprint: true
|
||||||
sh 'mkdir out'
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dir('out') {
|
stage('Build RPM') {
|
||||||
sh 'mv ../*.deb ./'
|
when { expression { params.RPM } }
|
||||||
sh 'rm ../*.*'
|
agent {
|
||||||
|
docker {
|
||||||
|
image 'registry.git.facekapow.dev/darling-build-image-fedora:latest'
|
||||||
|
registryUrl 'https://registry.git.facekapow.dev'
|
||||||
|
alwaysPull true
|
||||||
|
args '-v ${WORKSPACE}/source:/src:ro -v ${CCACHE_DIR}:/ccache:rw'
|
||||||
|
label 'darling'
|
||||||
|
reuseNode true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
environment {
|
||||||
|
CCACHE_DIR = '/ccache'
|
||||||
|
CCACHE_BASEDIR = '/home/ci/rpmbuild/BUILD/darling'
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
sh 'bash -xv /src/rpm/build.bsh'
|
||||||
|
|
||||||
|
sh 'rm -rf out-rpm'
|
||||||
|
sh 'mkdir out-rpm'
|
||||||
|
|
||||||
|
dir('out-rpm') {
|
||||||
|
sh 'mv ${HOME}/rpmbuild/RPMS/x86_64/*.rpm ./'
|
||||||
}
|
}
|
||||||
|
|
||||||
archiveArtifacts artifacts: 'out/**/*', fingerprint: true
|
archiveArtifacts artifacts: 'out-rpm/**/*', fingerprint: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
23
ci/RPM.Dockerfile
Normal file
23
ci/RPM.Dockerfile
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# this Dockerfile must be built using the following command:
|
||||||
|
# docker build -f ../ci/RPM.Dockerfile .
|
||||||
|
# this command must be run while in the `rpm` directory in the root of the repo.
|
||||||
|
FROM fedora:37
|
||||||
|
LABEL name=darling-build-image-fedora version=0.1.0
|
||||||
|
RUN dnf install -y rpm-build dnf-utils rpmdevtools git; \
|
||||||
|
source /etc/os-release; \
|
||||||
|
dnf install -y https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-${VERSION_ID}.noarch.rpm; \
|
||||||
|
dnf clean all
|
||||||
|
RUN groupadd -g 1001 ci
|
||||||
|
RUN useradd -u 1001 -g 1001 -m ci
|
||||||
|
COPY SPECS/darling.spec /darling.spec
|
||||||
|
RUN yum-builddep -y /darling.spec; \
|
||||||
|
dnf clean all
|
||||||
|
RUN rm /darling.spec
|
||||||
|
RUN dnf install -y sudo; \
|
||||||
|
dnf clean all
|
||||||
|
RUN echo 'ci ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
||||||
|
RUN mkdir -p /src
|
||||||
|
RUN dnf install -y ccache; \
|
||||||
|
dnf clean all
|
||||||
|
RUN mkdir -p /ccache
|
||||||
|
USER ci
|
9
ci/top.Dockerfile
Normal file
9
ci/top.Dockerfile
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
FROM alpine:latest
|
||||||
|
LABEL name=darling-build-image-top version=0.1.0
|
||||||
|
ARG DOCKER_GID=975
|
||||||
|
RUN addgroup -g ${DOCKER_GID} -S docker
|
||||||
|
RUN apk add docker git git-lfs sed
|
||||||
|
RUN addgroup -g 1001 ci
|
||||||
|
RUN adduser -u 1001 -G ci --disabled-password ci
|
||||||
|
RUN addgroup ci docker
|
||||||
|
USER ci
|
@ -3,26 +3,19 @@ FROM ${OS}
|
|||||||
|
|
||||||
SHELL ["bash", "-euxvc"]
|
SHELL ["bash", "-euxvc"]
|
||||||
|
|
||||||
RUN dnf install -y rpm-build dnf-utils rpmdevtools; \
|
RUN dnf install -y rpm-build dnf-utils rpmdevtools git; \
|
||||||
source /etc/os-release; \
|
source /etc/os-release; \
|
||||||
dnf install -y https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-${VERSION_ID}.noarch.rpm; \
|
dnf install -y https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-${VERSION_ID}.noarch.rpm; \
|
||||||
dnf clean all
|
dnf clean all
|
||||||
|
|
||||||
|
COPY SPECS/darling.spec /darling.spec
|
||||||
|
|
||||||
# Bootstrap
|
# Bootstrap
|
||||||
RUN dnf install -y bison cairo-devel clang cmake flex fontconfig-devel.x86_64 \
|
RUN yum-builddep -y /darling.spec; \
|
||||||
fontconfig-devel.i686 freetype-devel.x86_64 freetype-devel.i686 \
|
|
||||||
fuse-devel glibc-devel glibc-devel.i686 \
|
|
||||||
libglvnd-devel libjpeg-turbo-devel libjpeg-turbo-devel.i686 \
|
|
||||||
libtiff-devel libtiff-devel.i686 mesa-libGL-devel mesa-libEGL-devel \
|
|
||||||
python2 systemd-devel make libxml2-devel elfutils-libelf-devel \
|
|
||||||
libbsd-devel ffmpeg-devel pulseaudio-libs-devel openssl-devel \
|
|
||||||
giflib-devel libXrandr-devel libXcursor-devel libxkbfile-devel \
|
|
||||||
dbus-devel mesa-libGLU-devel vulkan-headers llvm-devel libcap-devel \
|
|
||||||
vulkan-loader-devel \
|
|
||||||
# git - so I can determine the describe of the last commit, not an rpm dependency
|
|
||||||
git; \
|
|
||||||
dnf clean all
|
dnf clean all
|
||||||
|
|
||||||
|
RUN rm /darling.spec
|
||||||
|
|
||||||
RUN mkdir -p /root/rpmbuild/SOURCES
|
RUN mkdir -p /root/rpmbuild/SOURCES
|
||||||
|
|
||||||
CMD bash -xv /src/rpm/build.bsh
|
CMD bash -xv /src/rpm/build.bsh
|
||||||
|
@ -2,18 +2,19 @@
|
|||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
yum-builddep -y /src/rpm/SPECS/darling.spec
|
mkdir -p $HOME/rpmbuild/SOURCES
|
||||||
|
|
||||||
if [ -e "/src/rpm/SOURCES/darling.tar.gz" ]; then
|
if [ -e "/src/rpm/SOURCES/darling.tar.gz" ]; then
|
||||||
ln -sf /src/rpm/SOURCES/darling.tar.gz /root/rpmbuild/SOURCES/
|
ln -sf /src/rpm/SOURCES/darling.tar.gz $HOME/rpmbuild/SOURCES/
|
||||||
else
|
else
|
||||||
# Preparing tarball
|
# Preparing tarball
|
||||||
tar --transform "s|^\./|./darling/|" -cf /root/rpmbuild/SOURCES/darling.tar.gz -C /src --exclude=.git --exclude SOURCES --exclude SRPMS --exclude RPMS --exclude BUILD .
|
tar --transform "s|^\./|./darling/|" -cf $HOME/rpmbuild/SOURCES/darling.tar.gz -C /src --exclude=.git --exclude SOURCES --exclude SRPMS --exclude RPMS --exclude BUILD .
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e "/src/rpm/SOURCES/darling-macho-deps.tar.gz" ]; then
|
if [ -e "/src/rpm/SOURCES/darling-macho-deps.tar.gz" ]; then
|
||||||
ln -sf /src/rpm/SOURCES/darling-macho-deps.tar.gz /root/rpmbuild/SOURCES/
|
ln -sf /src/rpm/SOURCES/darling-macho-deps.tar.gz $HOME/rpmbuild/SOURCES/
|
||||||
else
|
else
|
||||||
tar --transform "s|^\./|darling-macho-deps/|" -cf /root/rpmbuild/SOURCES/darling-macho-deps.tar.gz -C /src/tools/rpm .
|
tar --transform "s|^\./|darling-macho-deps/|" -cf $HOME/rpmbuild/SOURCES/darling-macho-deps.tar.gz -C /src/tools/rpm .
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (cd /src && git describe --tags HEAD); then
|
if (cd /src && git describe --tags HEAD); then
|
||||||
@ -25,7 +26,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
rpmbuild -ba /src/rpm/SPECS/darling-macho-deps.spec
|
rpmbuild -ba /src/rpm/SPECS/darling-macho-deps.spec
|
||||||
rpm -U --force /root/rpmbuild/RPMS/x86_64/darling-macho-deps*.rpm
|
sudo rpm -U --force $HOME/rpmbuild/RPMS/x86_64/darling-macho-deps*.rpm
|
||||||
|
|
||||||
#spectool -g -R /src/rpm/SPECS/darling.spec
|
#spectool -g -R /src/rpm/SPECS/darling.spec
|
||||||
rpmbuild -ba /src/rpm/SPECS/darling.spec
|
rpmbuild -ba /src/rpm/SPECS/darling.spec
|
||||||
|
@ -17,4 +17,4 @@ else
|
|||||||
ARG='-b'
|
ARG='-b'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
debuild --no-lintian -us -uc ${ARG}
|
debuild --preserve-envvar 'CCACHE_*' --no-lintian -us -uc ${ARG}
|
||||||
|
Loading…
Reference in New Issue
Block a user