test build CI/CD

This commit is contained in:
Samuele Locatelli
2022-04-11 09:48:26 +02:00
parent 046238375f
commit 19a29668dc
+91 -133
View File
@@ -2,13 +2,11 @@ variables:
NUGET_PATH: 'C:\Tools\nuget.exe'
MSBUILD_PATH: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe'
ASPNET_MERGE_PATH: 'C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools'
EXE_RELEASE_FOLDER: 'c:\Projetcs\Compiled\NKC\Release'
DEPLOY_FOLDER: 'c:\Projects\Deploy\NKC\Builds'
VERS_MAIN: '2.0'
VERS_MAIN: '1.1'
NEW_REL: ''
NEXUS_PATH: 'NKC'
PROJ_NAME: 'NKC_WF'
APP_NAME: 'NKC'
NEXUS_PATH: 'ZCode'
APP_NAME: 'QR-GEN'
APP_CONF: 'Release'
# helper x fix pacchetti nuget da repo locale nexus.steamware.net
@@ -30,15 +28,6 @@ variables:
$contenuto = Get-Content -path 'VersGen\VersGen.cs' -Raw
$newContenuto = $contenuto -replace '0.0.0.0', $env:NEW_REL
$newContenuto | Set-Content -path 'VersGen\VersGen.cs'
# helper x fix manifest xml
.manifest-fix: &manifest-fix
- |
echo "Set manifest.xml for branch: $CI_COMMIT_BRANCH"
$contenuto = Get-Content -path $env:PROJ_NAME'\Resources\manifest.xml' -Raw
$newContenuto = $contenuto -replace '{{BRANCHNAME}}', $CI_COMMIT_BRANCH
$newContenuto = $newContenuto -replace '0.0.0.0', $env:NEW_REL
$newContenuto | Set-Content -path $env:PROJ_NAME'\Resources\manifest.xml'
# helper creazione hash files
.hashBuild: &hashBuild
@@ -82,135 +71,104 @@ variables:
stages:
- build
- deploy
- installer
- release
Net:build:
Zcode:build:
stage: build
tags:
- win
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore NKC_WF.sln -Verbosity quiet'
- '& "$env:NUGET_PATH" restore $env:APP_NAME.sln -Verbosity quiet'
- *version-fix
script:
- '& "$env:MSBUILD_PATH" NKC_WF/NKC_WF.csproj -target:Build /p:Configuration=Release /p:Platform="Any CPU" /p:OutputPath=bin/ /verbosity:minimal /m'
- '& "$env:MSBUILD_PATH" $env:APP_NAME/$env:APP_NAME.csproj -target:Build /p:Configuration=Release /p:Platform="Any CPU" /p:OutputPath=bin/ /verbosity:minimal /m'
Core:build:
stage: build
tags:
- win
before_script:
- *nuget-fix
- dotnet restore REMAN.sln
script:
- dotnet build REMAN/REMAN.csproj
# Zcode:IIS01:deploy:
# stage: deploy
# tags:
# - win
# rules:
# - if: '$CI_COMMIT_BRANCH == "develop"'
# before_script:
# - *nuget-fix
# - '& "$env:NUGET_PATH" restore $env:APP_NAME.sln -Verbosity quiet'
# - *version-fix
# script:
# - '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /p:DeployOnBuild=true /p:Targets=Publish /p:PublishProfile=IIS01.pubxml /p:RunCodeAnalysis=false /p:Configuration=Release /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ /verbosity:minimal $env:APP_NAME/$env:APP_NAME.csproj'
# needs: ["Net:build"]
Net:IIS01:deploy:
stage: deploy
tags:
- win
rules:
- if: '$CI_COMMIT_BRANCH == "develop"'
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore NKC_WF.sln -Verbosity quiet'
- *version-fix
script:
- '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /p:DeployOnBuild=true /p:Targets=Publish /p:PublishProfile=IIS01.pubxml /p:RunCodeAnalysis=false /p:Configuration=IIS01 /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ /verbosity:minimal NKC_WF/NKC_WF.csproj'
needs: ["Net:build"]
Net:IIS02:deploy:
stage: deploy
tags:
- win
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore NKC_WF.sln -Verbosity quiet'
- *version-fix
script:
- '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /p:DeployOnBuild=true /p:Targets=Publish /p:PublishProfile=IIS02.pubxml /p:RunCodeAnalysis=false /p:Configuration=IIS02 /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ /verbosity:minimal NKC_WF/NKC_WF.csproj'
needs: ["Net:build"]
Core:IIS01:deploy:
stage: deploy
tags:
- win
only:
- develop
needs: ["Core:build"]
script:
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true REMAN/REMAN.csproj
Core:IIS02:deploy:
stage: deploy
tags:
- win
only:
- master
needs: ["Core:build"]
script:
- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true REMAN/REMAN.csproj
- dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true REMAN/REMAN.csproj
Net:install:
stage: installer
tags:
- win
# Zcode:IIS02:deploy:
# stage: deploy
# tags:
# - win
# rules:
# - if: '$CI_COMMIT_BRANCH == "master"'
# when: manual
variables:
APP_NAME: NKC
PROJ_NAME: NKC_WF
NEXUS_PATH: NKC
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore NKC_WF.sln -Verbosity quiet'
- *version-fix
- *manifest-fix
script:
- '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /T:Package /P:Configuration=Release /p:PublishProfile=master.pubxml /p:RunCodeAnalysis=false /p:PackageLocation=Release/$env:APP_NAME.zip /p:DeployIisAppPath="Default Web Site/NKC" /p:PackageAsSingleFile=True /verbosity:minimal /p:OutputPath=bin/ NKC_WF/NKC_WF.csproj'
# qui il deploy su nexus...
- *hashBuild
- *nexusUpload
needs: ["Net:build"]
# before_script:
# - *nuget-fix
# - '& "$env:NUGET_PATH" restore $env:APP_NAME.sln -Verbosity quiet'
# - *version-fix
# script:
# - '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /p:DeployOnBuild=true /p:Targets=Publish /p:PublishProfile=IIS02.pubxml /p:RunCodeAnalysis=false /p:Configuration=Release /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ /verbosity:minimal $env:APP_NAME/$env:APP_NAME.csproj'
# needs: ["Net:build"]
Core:install:
stage: installer
tags:
- win
only:
- develop
- master
needs: ["Core:build"]
variables:
APP_NAME: REMAN
PROJ_NAME: REMAN
NEXUS_PATH: REMAN
before_script:
# - *nuget-fix
- dotnet restore REMAN.sln
- *version-fix
- *manifest-fix
script:
- dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release REMAN/REMAN.csproj -o:publish
# qui il deploy su nexus...
- *hashBuild
- *nexusUpload
# VARIABILI
# Tema numero versione: si potrebbe usare la variabile CI_COMMIT_TAG con $env:CI_COMMIT_TAG, in questo caso SOLO SE c'è un tag sistema versione...
# Tema compilazione x branch: $CI_COMMIT_BRANCH == "my-branch" potrebbe essere condizione if x fare alcuni sscript...
# rif: https://docs.gitlab.com/ee/ci/variables/predefined_variables.html
# Zcode:IIS03:deploy:
# stage: deploy
# tags:
# - win
# rules:
# - if: '$CI_COMMIT_BRANCH == "master"'
# before_script:
# - *nuget-fix
# - '& "$env:NUGET_PATH" restore $env:APP_NAME.sln -Verbosity quiet'
# - *version-fix
# script:
# - '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /p:DeployOnBuild=true /p:Targets=Publish /p:PublishProfile=IIS03.pubxml /p:RunCodeAnalysis=false /p:Configuration=Release /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ /verbosity:minimal $env:APP_NAME/$env:APP_NAME.csproj'
# needs: ["Net:build"]
# Da approfondire:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/dotNET.gitlab-ci.yml
# https://www.google.com/search?q=gitlab+variable+year+month&rlz=1C1GCEA_enIT945IT945&oq=gitlab+variable+year+month&aqs=chrome..69i57j69i64.5262j0j7&sourceid=chrome&ie=UTF-8
# https://docs.gitlab.com/ee/ci/examples/README.html
# https://docs.gitlab.com/ee/ci/quick_start/index.html
# https://docs.gitlab.com/ee/ci/yaml/
# Zcode:OVH:release:
# stage: release
# tags:
# - win
# # rules:
# # - if: '$CI_COMMIT_BRANCH == "master"'
# # when: manual
# variables:
# APP_NAME: NKC
# PROJ_NAME: $env:APP_NAME
# NEXUS_PATH: NKC
# before_script:
# - *nuget-fix
# - '& "$env:NUGET_PATH" restore $env:APP_NAME.sln -Verbosity quiet'
# - *version-fix
# - *manifest-fix
# script:
# - '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /T:Package /P:Configuration=Release /p:PublishProfile=master.pubxml /p:RunCodeAnalysis=false /p:PackageLocation=Release/$env:APP_NAME.zip /p:DeployIisAppPath="Default Web Site/NKC" /p:PackageAsSingleFile=True /verbosity:minimal /p:OutputPath=bin/ $env:APP_NAME/$env:APP_NAME.csproj'
# # qui il deploy su nexus...
# - *hashBuild
# - *nexusUpload
# needs: ["Net:build"]
# Zcode:ZIP:release:
# stage: release
# tags:
# - win
# # rules:
# # - if: '$CI_COMMIT_BRANCH == "master"'
# # when: manual
# variables:
# APP_NAME: NKC
# PROJ_NAME: $env:APP_NAME
# NEXUS_PATH: NKC
# before_script:
# - *nuget-fix
# - '& "$env:NUGET_PATH" restore $env:APP_NAME.sln -Verbosity quiet'
# - *version-fix
# - *manifest-fix
# script:
# - '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /T:Package /P:Configuration=Release /p:PublishProfile=master.pubxml /p:RunCodeAnalysis=false /p:PackageLocation=Release/$env:APP_NAME.zip /p:DeployIisAppPath="Default Web Site/NKC" /p:PackageAsSingleFile=True /verbosity:minimal /p:OutputPath=bin/ $env:APP_NAME/$env:APP_NAME.csproj'
# # qui il deploy su nexus...
# - *hashBuild
# - *nexusUpload
# needs: ["Net:build"]