From 7fd8824fbc3a7cd073d01769336515595d8af66c Mon Sep 17 00:00:00 2001 From: Maxim Ganetsky Date: Wed, 22 Nov 2023 02:42:38 +0300 Subject: [PATCH] CI: Renamed Dockerfile to make code highlight to work in GitLab web interface. Also simplified it and made to terminate earlier in case of compilation errors. --- .gitlab-ci.yml | 4 +-- Dockerfile.buildenv => buildenv.Dockerfile | 29 ++++++---------------- 2 files changed, 9 insertions(+), 24 deletions(-) rename Dockerfile.buildenv => buildenv.Dockerfile (90%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 45a9e97747..4bd1f317a4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -38,7 +38,7 @@ stages: # List of stages for jobs, and their order of execution rules: - when: on_success -update-build-env: # This job updates building environment image. Run it if FPC version constants and/or Dockerfile.buildenv were changed. +update-build-env: # This job updates building environment image. Run it if FPC version constants and/or buildenv.Dockerfile were changed. stage: prepenv image: docker services: @@ -50,7 +50,7 @@ update-build-env: # This job updates building environment image. Run it if FPC --build-arg FPC_STABLE_VER=$FPC_STABLE_VER --build-arg FPC_FIXES_VER=$FPC_FIXES_VER --build-arg FPC_MAIN_VER=$FPC_MAIN_VER - -t $IMAGE_TAG - < Dockerfile.buildenv + -t $IMAGE_TAG - < buildenv.Dockerfile - docker push $IMAGE_TAG rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH diff --git a/Dockerfile.buildenv b/buildenv.Dockerfile similarity index 90% rename from Dockerfile.buildenv rename to buildenv.Dockerfile index f26ff29ecf..a480e7da23 100644 --- a/Dockerfile.buildenv +++ b/buildenv.Dockerfile @@ -36,10 +36,7 @@ RUN docarchive=doc-chm.zip; \ tar xf ${tarball[2]}.tar; \ cd ${tarball[2]}; \ # install only compiler and RTL, do not install documentation and demos - echo -e "\nn\nn\n" | ./install.sh; \ - if [ $? -ne 0 ]; then \ - exit 1; \ - fi; \ + echo -e "\nn\nn\n" | ./install.sh || exit 1; \ cd ..; \ # store fpdoc binaries separately for each FPC version (needed to build Lazarus docs) cp -v /usr/bin/fpdoc /usr/bin/fpdoc-${tarball[0]}; \ @@ -81,34 +78,22 @@ RUN tarballs=( \ for tbl in "${tarballs[@]}"; do \ tarball=($tbl); \ cd ${tarball[2]}; \ - make all FPC=/usr/lib/fpc/${tarball[0]}/ppcx64 OS_TARGET=${tarball[4]} CPU_TARGET=${tarball[5]}; \ - make crossinstall FPC=/usr/lib/fpc/${tarball[0]}/ppcx64 OS_TARGET=${tarball[4]} CPU_TARGET=${tarball[5]} INSTALL_PREFIX=/usr; \ - if [ $? -ne 0 ]; then \ - exit 1; \ - fi; \ + make all FPC=/usr/lib/fpc/${tarball[0]}/ppcx64 OS_TARGET=${tarball[4]} CPU_TARGET=${tarball[5]} || exit 1; \ + make crossinstall FPC=/usr/lib/fpc/${tarball[0]}/ppcx64 OS_TARGET=${tarball[4]} CPU_TARGET=${tarball[5]} INSTALL_PREFIX=/usr || exit 1; \ cd ..; \ done; \ # save sources for FPC from main branch separately (they are needed e.g. for running Codetools tests) fpcsrcdir=/fpcsrc; \ fpcsrcdirmain=$fpcsrcdir/$FPC_MAIN_VER; \ mkdir -p $fpcsrcdirmain; \ - tar zxf source-main.tar.gz --strip-components=1 --directory $fpcsrcdirmain; \ - if [ $? -ne 0 ]; then \ - exit 1; \ - fi; \ + tar zxf source-main.tar.gz --strip-components=1 --directory $fpcsrcdirmain || exit 1; \ # compile and install pas2js (needed for running some Codetools tests) - git clone --depth 1 https://gitlab.com/freepascal.org/fpc/pas2js.git; \ - if [ $? -ne 0 ]; then \ - exit 1; \ - fi; \ + git clone --depth 1 https://gitlab.com/freepascal.org/fpc/pas2js.git || exit 1; \ cd pas2js; \ rm -rf compiler; \ ln -s ../source-main compiler; \ - make all FPC=/usr/lib/fpc/$FPC_MAIN_VER/ppcx64; \ - make install FPC=/usr/lib/fpc/$FPC_MAIN_VER/ppcx64; \ - if [ $? -ne 0 ]; then \ - exit 1; \ - fi; \ + make all FPC=/usr/lib/fpc/$FPC_MAIN_VER/ppcx64 || exit 1; \ + make install FPC=/usr/lib/fpc/$FPC_MAIN_VER/ppcx64 || exit 1; \ cd ..; \ rm -rf pas2js; \ echo "Contents of /usr/local/bin/pas2js.cfg:"; \