LaurentGirard 0 Posted December 6, 2023 Using Gitlab Saas for a VCL Delphi Project (Alexandria 11.3), I'd like to implement a Gitlab CI to run unit tests and build the application. I have no problem for the unit tests build and run (DUnitX framework) But I'm facing a problem with the main application. This one is using some external components (LMD Components and Konopka components) : the CI doesn't find these components within the build stage, despite a lot of searches on the net, If I remove from my project these external components, then it works fine. But I need them .... I cannot find a solution. Can somebody help me please ? Here's my gitlab-ci.yml file before_script: - $env:BDS="C:/Program Files (x86)/Embarcadero/Studio/22.0" - $env:BDSINCLUDE="C:\Program Files (x86)\Embarcadero\Studio\22.0\Include" - $env:BDSCOMMONDIR="C:\Users\Public\Documents\Embarcadero\Studio/22.0" - $env:BDSCatalogRepositoryAllUsers="C:\Users\Public\Documents\Embarcadero\Studio\22.0\CatalogRepository" - $env:FrameworkDir="C:/Windows/Microsoft.NET/Framework/v4.0.30319" - $env:FrameworkVersion=4.5 - $env:PATH=$env:FrameworkDir;"$env:BDS\bin";$env:PATH - $env:LANGDIR="FR" - $env:PLATFORM="" - $env:PlatformSDK="" stages: - compil compil-job: tags: - delphi stage: compil script: - echo "building project..." - C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe /m /nologo <myProject>.dproj /target:Build /p:DCC_BuildAllUnits=true /p:"Config=Release" /p:"Platform=Win64" - echo "building complete." Share this post Link to post
Uwe Raabe 1979 Posted December 6, 2023 Not sure it is related, but there is a very inconsistent use of slash and backslash in the $env values. Share this post Link to post
LaurentGirard 0 Posted December 7, 2023 You're right, I can make this more consistent. What are your recommendations on this subject? slash ? Backslash ? double backslash ? ... But unfortunately this doesn't change the failed compilation result. Share this post Link to post
Darian Miller 353 Posted December 7, 2023 If you run that build manually, does it work? Is your CI work being done on a machine that Delphi was installed on? (Or are files just copied to a build server?) Share this post Link to post
LaurentGirard 0 Posted December 8, 2023 Quote If you run that build manually, does it work? No, it doesn' work Quote Is your CI work being done on a machine that Delphi was installed on? (Or are files just copied to a build server?) My CI run on a windows server on which gitlab runner and of course Delphi and all its components are installed. On this server, the compilation using Delphi IDE works fine. Below is the log of the Gitrlab CI job : Running with gitlab-runner 16.5.0 (853330f9) on Delphi 3vozL1wki, system ID: s_867c15c8db7f Preparing the "shell" executor 00:00 Using Shell (pwsh) executor... Preparing environment 00:01 Running on SRV-JENKINS... Getting source from Git repository 00:04 Fetching changes with git depth set to 20... Reinitialized existing Git repository in C:/GitLab-Runner/builds/3vozL1wki/0/axioroute/tests/testsci/.git/ Checking out 6f8ab724 as detached HEAD (ref is master)... Removing tests/calculatorTests.exe Removing tests/dunitx-results.xml git-lfs/3.4.0 (GitHub; windows amd64; go 1.20.6; git d06d6e9e) Skipping Git submodules setup Downloading artifacts 00:02 Version: 16.5.0 Git revision: 853330f9 Git branch: 16-5-stable GO version: go1.20.10 Built: 2023-10-20T15:57:25+0000 OS/Arch: windows/amd64 Downloading artifacts for build-job (5694869986)... Runtime platform arch=amd64 os=windows pid=5032 revision=853330f9 version=16.5.0 Downloading artifacts from coordinator... ok host=cdn.artifacts.gitlab-static.net id=5694869986 responseStatus=200 OK token=64_etzum Downloading artifacts for test-job (5694869988)... Runtime platform arch=amd64 os=windows pid=2628 revision=853330f9 version=16.5.0 Downloading artifacts from coordinator... ok host=cdn.artifacts.gitlab-static.net id=5694869988 responseStatus=200 OK token=64_etzum Executing "step_script" stage of the job script 00:02 $ $env:BDS="C:/Program Files (x86)/Embarcadero/Studio/22.0" $ $env:BDSINCLUDE="C:\Program Files (x86)\Embarcadero\Studio\22.0\Include" $ $env:BDSCOMMONDIR="C:\Users\Public\Documents\Embarcadero\Studio/22.0" $ $env:BDSCatalogRepositoryAllUsers="C:\Users\Public\Documents\Embarcadero\Studio\22.0\CatalogRepository" $ $env:FrameworkDir="C:/Windows/Microsoft.NET/Framework/v4.0.30319" $ $env:FrameworkVersion=4.5 $ $env:PATH=$env:FrameworkDir;"$env:BDS\bin";$env:PATH C:/Program Files (x86)/Embarcadero/Studio/22.0\bin C:/Windows/Microsoft.NET/Framework/v4.0.30319 $ $env:LANGDIR="FR" $ $env:PLATFORM="" $ $env:PlatformSDK="" $ echo "building project..." building project... $ C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe /m /nologo calculator.dproj /target:Build /p:DCC_BuildAllUnits=true /p:"Config=Release" /p:"Platform=Win64" La génération a démarré 06/12/2023 16:45:22. 1>Projet "C:\GitLab-Runner\builds\3vozL1wki\0\axioroute\tests\testsci\calculator.dproj" sur le nœud 1 (Build cible(s)). 1>C:\Program Files (x86)\Embarcadero\Studio\22.0\bin\CodeGear.Common.Targets(307,5): warning : Expected configuration file missing - C:\WINDOWS\system32\config\systemprofile\AppData\Roaming\Embarcadero\BDS\22.0\EnvOptions.proj [C:\GitLab-Runner\builds\3vozL1wki\0\axioroute\tests\testsci\calculator.dproj] 1>CreateProjectDirectories: Création du répertoire ".\Win64\Release\". BuildVersionResource: C:/Program Files (x86)/Embarcadero/Studio/22.0\bin\cgrc.exe -c65001 calculator.vrc -focalculator.res CodeGear Resource Compiler/Binder Version 1.2.2 Copyright (c) 2008-2012 Embarcadero Technologies Inc. Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0 Copyright (C) Microsoft Corporation. All rights reserved. Suppression du fichier "calculator.vrc". Suppression du fichier "calculator.$manifest". _PasCoreCompile: C:/Program Files (x86)/Embarcadero/Studio/22.0\bin\dcc64.exe -$D0 -$L- -$Y- --no-config -B -Q -TX.exe -AGenerics.Collections=System.Generics.Collections;Generics.Defaults=System.Generics.Defaults;WinTypes=Winapi.Windows;WinProcs=Winapi.Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE @C:\Projet\Composants\Gitlab\tests\testsci\bin\Win64\Release\calculator.cmds -DRELEASE;;FRAMEWORK_VCL -EC:\Projet\Composants\Gitlab\tests\testsci\bin\Win64\Release -NU.\Win64\Release -NSWinapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell; -NO.\Win64\Release calculator.dpr Embarcadero Delphi for Win64 compiler version 35.0 Copyright (c) 1983,2022 Embarcadero Technologies, Inc. 1>forms\fCalculator.pas(7): error F2613: Unité 'RzEdit' non trouvée. [C:\GitLab-Runner\builds\3vozL1wki\0\axioroute\tests\testsci\calculator.dproj] 1>Génération du projet "C:\GitLab-Runner\builds\3vozL1wki\0\axioroute\tests\testsci\calculator.dproj" terminée (Build cible(s)) -- ÉCHEC. ÉCHEC de la build. "C:\GitLab-Runner\builds\3vozL1wki\0\axioroute\tests\testsci\calculator.dproj" (Build cible) (1) -> (_CheckBuildEnvironment cible) -> C:\Program Files (x86)\Embarcadero\Studio\22.0\bin\CodeGear.Common.Targets(307,5): warning : Expected configuration file missing - C:\WINDOWS\system32\config\systemprofile\AppData\Roaming\Embarcadero\BDS\22.0\EnvOptions.proj [C:\GitLab-Runner\builds\3vozL1wki\0\axioroute\tests\testsci\calculator.dproj] "C:\GitLab-Runner\builds\3vozL1wki\0\axioroute\tests\testsci\calculator.dproj" (Build cible) (1) -> (_PasCoreCompile cible) -> forms\fCalculator.pas(7): error F2613: Unité 'RzEdit' non trouvée. [C:\GitLab-Runner\builds\3vozL1wki\0\axioroute\tests\testsci\calculator.dproj] 1 Avertissement(s) 1 Erreur(s) Temps écoulé 00:00:00.66 Cleaning up project directory and file based variables 00:01 ERROR: Job failed: exit status 1 Share this post Link to post
Darian Miller 353 Posted December 10, 2023 Ah - "Expected configuration file missing - C:\WINDOWS\system32\config\systemprofile\AppData\Roaming\Embarcadero\BDS\22.0\EnvOptions.proj" See my blog post for setting up Jenkins, it has the workaround: https://ideasawakened.com/post/getting-started-with-ci-cd-using-delphi-and-jenkins-on-windows "Copy the EnvOptions.proj file to the APPDATA folder of the user account which will execute the builds. (For example: C:\Users\JenkinsUserName\Roaming\Embarcadero\BDS\21.0) If you have custom paths for libraries and component packages, edit the DelphiLibraryPath for each target platform that you will use to match your build machine paths. You will get a warning message in your builds if this file is not found..." 1 Share this post Link to post
aehimself 391 Posted December 10, 2023 3 hours ago, Darian Miller said: Copy the EnvOptions.proj file to the APPDATA folder of the user account which will execute the builds As an alternate, the path where this file is attempted to be loaed from can be changed in Program Files\Embarcadero\Studio\xx\bin\Codegear.Common.Targets inside the PropertyGroup tag. This is what we ended up using on Azure DevOps at work: Be careful, though. Changing these to a static path will result all users on the same machine to use the very same environment.proj and/or envoptions.proj. This might be, or might not be wanted. 1 Share this post Link to post