Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works

Random project

delphi-gitlab-ci-sample

:man_juggling: Gitlab CI/CD with Delphi example

View on GitHub

Anyone may press Interesting, signed in or not. It helps others find this project.

Member rating

No ratings yet.

Sign in to rate this project.

README

Gitlab-CI with Docker-Windows for Delphi Projects

Pipelines: https://gitlab.com/charoleizer/delphi-gitlab-ci-sample/pipelines

Stack

  • Windows 10 v1089 as Host;
  • Delphi CE;
  • .NET Framework v3.5;
  • Docker Desktop 2.1.0.0 ;
  • Gitlab-Runner with Docker-Windows executor and .NET 3.5 image;
  • Sonarqube 5.6.7 ;
  • Sonar-Scanner 3.2 ;
  • JFrog Artifactory OSS;
  • Portainer;

Docker Images

  • .NET Framework: mcr.microsoft.com/dotnet/framework/runtime:3.5 (Windows)
  • Sonarqube with Delphi Plugin: charoleizer/sonarqube-delphi-5.6.7-alpine
  • JFrog Artifactory OSS: docker.bintray.io/jfrog/artifactory-oss
  • Portainer: portainer/portainer (Optional)

Flow

  • Download gitlab runner for Windows, register, install and start as service. [?];
  • It will create 2 Runners container, one for cache and another for build
  • Switch to Windows Containers on Docker Desktop.
  • Pull the .NET Framework image. This image will be used to create a container from Build Runner. [?];
  • Bind the Delphi ./bin directory (C:\Program Files (x86)\Embarcadero\Studio\17.0\bin) with Build Runner Container.
  • Download Sonar-Scanner 3.2 and bind the scanner path with Build Runner Container. [?]
  • Switch to Linux Containers on Docker Desktop.
  • Create a Linux-Container with Sonarqube. This container use SandroLuck's Plugin. [?]
  • Sonar Scanner need a property file to analyse the code. [?]
  • Create a Linux-Container with Artifactory OSS. [?]
  • Switch to Windows Containers on Docker Desktop.

.gitlab-ci.yml

Specificaly for this Delphi example, we will use this file to do 4 steps(stages):

test:

  • Build the test project with MSBuild;
  • Run the Test binary output;
  • Save the result file for future coverage;

analyze:

  • Run the sonar-scanner using sonar-project.properties configurations;

build

  • Build the project with MSBuild;
  • Deploy the artifact temporarily;

deploy

  • Take the build stage artifact, and compress it;
  • Set JFrog Artifactory OSS variables;
  • Upload the artifact by Artifactory rest API;

Curiosities

Why gitlab?

  • Because Gitlab-CE and Gitlab-CI are free self-hosted tools. Maybe Github Actions can change it. Waiting for Self-Hosted option.

Why is this project in github?

  • Because github is the most famous repository and has a larger community

Why not create an image with Delphi?

  • Because of Embarcadero's license