Rewritten CI configuration.

1. Added Dockerfile.buildenv to generate build environment image. It is based on Debian 11 x86_64 (contains GTK2, GTK3, Qt5 libraries and FPC (versions 3.2.0, 3.2.2) for x86_64-linux with x86_64-win64 and i386-win32 cross-compilers.

2. New CI configuration with jobs to build Lazarus with both FPC versions for x86_64-gtk2, x86_64-qt5, x86_64-win64, i386-win32. Also there is a job to update build environment image, which should be only run when Dockerfile.buildenv and/or FPC version constants in .gitlab-ci.yml file were updated.

All jobs were set to manual (don't trigger automatically) mode for now.
This commit is contained in:
Maxim Ganetsky 2022-08-12 03:13:57 +03:00
parent 8425924181
commit ff0ee07384
2 changed files with 154 additions and 15 deletions

View File

@ -1,22 +1,87 @@
image: debian:stable-backports
variables:
FPC_OLDSTABLE_VER: 3.2.0
FPC_STABLE_VER: 3.2.2
IMAGE_TAG: $CI_REGISTRY_IMAGE/debian11-x86-64:latest
before_script:
- apt-get update
- apt-get -y install build-essential libgtk2.0-dev wget
- wget https://sourceforge.net/projects/freepascal/files/Linux/3.2.2/fpc-3.2.2.x86_64-linux.tar
- tar xf fpc-3.2.2.x86_64-linux.tar
- cd fpc-3.2.2.x86_64-linux
- echo -e "\n\n\n\n" | ./install.sh
- cd ..
default:
image: $IMAGE_TAG
stages: # List of stages for jobs, and their order of execution
- prepenv
- build
build-job: # This job runs in the build stage, which runs first.
update-build-env: # This job updates building environment image. Run it if FPC version constants and/or Dockerfile.buildenv were changed.
stage: prepenv
image: docker
services:
- docker:dind
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build --pull --build-arg FPC_OLDSTABLE_VER=$FPC_OLDSTABLE_VER --build-arg FPC_STABLE_VER=$FPC_STABLE_VER -t $IMAGE_TAG - < Dockerfile.buildenv
- docker push $IMAGE_TAG
when: manual
x86_64-gtk2-oldstable:
stage: build
script:
- echo "Using FPC:"
- fpc -iV
- echo
- echo "Compiling bigide for GTK2"
- make bigide LCL_PLATFORM=gtk2
- make bigide FPC=/usr/lib/fpc/$FPC_OLDSTABLE_VER/ppcx64 CPU_TARGET=x86_64 LCL_PLATFORM=gtk2
when: manual
x86_64-gtk2-stable:
stage: build
script:
- make bigide FPC=/usr/lib/fpc/$FPC_STABLE_VER/ppcx64 CPU_TARGET=x86_64 LCL_PLATFORM=gtk2
when: manual
x86_64-qt5-oldstable:
stage: build
script:
- cd lcl/interfaces/qt5/cbindings # build and install Qt5 Pascal bindings
- qmake -query
- qmake
- make
- make install
- cd ../../../..
- make bigide FPC=/usr/lib/fpc/$FPC_OLDSTABLE_VER/ppcx64 CPU_TARGET=x86_64 LCL_PLATFORM=qt5
when: manual
x86_64-qt5-stable:
stage: build
script:
- cd lcl/interfaces/qt5/cbindings # build and install Qt5 Pascal bindings
- qmake -query
- qmake
- make
- make install
- cd ../../../..
- make bigide FPC=/usr/lib/fpc/$FPC_STABLE_VER/ppcx64 CPU_TARGET=x86_64 LCL_PLATFORM=qt5
when: manual
i386-win32-oldstable:
stage: build
script:
- make lazbuild FPC=/usr/lib/fpc/$FPC_OLDSTABLE_VER/ppcx64
- make bigide FPC=/usr/lib/fpc/$FPC_OLDSTABLE_VER/ppcross386 OS_TARGET=win32 CPU_TARGET=i386 LCL_PLATFORM=win32
when: manual
i386-win32-stable:
stage: build
script:
- make lazbuild FPC=/usr/lib/fpc/$FPC_STABLE_VER/ppcx64
- make bigide FPC=/usr/lib/fpc/$FPC_STABLE_VER/ppcross386 OS_TARGET=win32 CPU_TARGET=i386 LCL_PLATFORM=win32
when: manual
x86_64-win64-oldstable:
stage: build
script:
- make lazbuild FPC=/usr/lib/fpc/$FPC_OLDSTABLE_VER/ppcx64
- make bigide FPC=/usr/lib/fpc/$FPC_OLDSTABLE_VER/ppcx64 OS_TARGET=win64 CPU_TARGET=x86_64 LCL_PLATFORM=win32
when: manual
x86_64-win64-stable:
stage: build
script:
- make lazbuild FPC=/usr/lib/fpc/$FPC_STABLE_VER/ppcx64
- make bigide FPC=/usr/lib/fpc/$FPC_STABLE_VER/ppcx64 OS_TARGET=win64 CPU_TARGET=x86_64 LCL_PLATFORM=win32
when: manual

74
Dockerfile.buildenv Normal file
View File

@ -0,0 +1,74 @@
FROM debian:11
ARG FPC_STABLE_VER
ARG FPC_OLDSTABLE_VER
RUN dpkg --add-architecture i386 && apt-get update && apt-get -y install \
build-essential \
libc6-dev-i386 \
libgtk2.0-dev \
libgtk-3-dev \
libqt5x11extras5-dev \
qtbase5-dev \
wget
SHELL ["/bin/bash", "-c"]
RUN tarballs=( \
"$FPC_OLDSTABLE_VER fpc-$FPC_OLDSTABLE_VER-x86_64-linux" \
"$FPC_STABLE_VER fpc-$FPC_STABLE_VER.x86_64-linux" \
); \
for tbl in "${tarballs[@]}"; do \
tarball=($tbl); \
wget https://sourceforge.net/projects/freepascal/files/Linux/${tarball[0]}/${tarball[1]}.tar; \
tar xf ${tarball[1]}.tar; \
cd ${tarball[1]}; \
echo -e "\n\n\n\n" | ./install.sh; \
if [ $? -ne 0 ]; then \
exit 1; \
fi; \
cd ..; \
rm -f ${tarball[1]}.tar; \
rm -rf ${tarball[1]}; \
done; \
echo; \
echo "Contents of /etc/fpc.cfg:"; \
cat /etc/fpc.cfg; \
# build and install cross-compilers
tarballs=( \
"$FPC_OLDSTABLE_VER fpc-$FPC_OLDSTABLE_VER.source tar.gz win32 i386" \
"$FPC_OLDSTABLE_VER fpc-$FPC_OLDSTABLE_VER.source tar.gz win64 x86_64" \
"$FPC_STABLE_VER fpc-$FPC_STABLE_VER.source tar.gz win32 i386" \
"$FPC_STABLE_VER fpc-$FPC_STABLE_VER.source tar.gz win64 x86_64" \
); \
# downloading, building and tarball removal are done in separate steps,
# because several targets can be built from one source
#
# download sources
for tbl in "${tarballs[@]}"; do \
tarball=($tbl); \
if [ ! -f ${tarball[1]}.${tarball[2]} ]; then \
wget https://sourceforge.net/projects/freepascal/files/Source/${tarball[0]}/${tarball[1]}.${tarball[2]}; \
fi; \
if [ ! -d fpc-${tarball[0]} ]; then \
tar zxf ${tarball[1]}.${tarball[2]}; \
fi; \
if [ $? -ne 0 ]; then \
exit 1; \
fi; \
done; \
# build and install cross-compilers
for tbl in "${tarballs[@]}"; do \
tarball=($tbl); \
cd fpc-${tarball[0]}; \
make all FPC=/usr/lib/fpc/${tarball[0]}/ppcx64 OS_TARGET=${tarball[3]} CPU_TARGET=${tarball[4]}; \
make crossinstall FPC=/usr/lib/fpc/${tarball[0]}/ppcx64 OS_TARGET=${tarball[3]} CPU_TARGET=${tarball[4]} INSTALL_PREFIX=/usr; \
if [ $? -ne 0 ]; then \
exit 1; \
fi; \
cd ..; \
done; \
# remove sources
for tbl in "${tarballs[@]}"; do \
tarball=($tbl); \
rm -f ${tarball[1]}.${tarball[2]}; \
rm -rf fpc-${tarball[0]}; \
done;