diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..871a227 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,122 @@ +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\GPW\Release' + DEPLOY_FOLDER: 'c:\Projects\Deploy\GPW\Builds' + VERS_MAIN: '2.7' + REL_NUM: '4159' + VERS_NUMBER: '$VERS_MAIN.2103.$CI_PIPELINE_IID' + # EXE_RELEASE_FOLDER: 'YourApp\bin\Release' + # MSI_RELEASE_FOLDER: 'Setup\bin\Release' + # TEST_FOLDER: 'Tests\bin\Release' + # DEPLOY_FOLDER: 'P:\Projects\YourApp\Builds' + # NUNIT_PATH: 'C:\Program Files (x86)\NUnit.org\nunit-console\nunit3-console.exe' + +# 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 + +# 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/ + + + +# helper x fix pacchetti nuget da repo locale nexus.steamware.net +.nuget-fix: &nuget-fix + - | + $hasSource = C:\Tools\nuget.exe sources list | find "`"Steamware Nexus`"" /C + if ($hasSource -eq 0) { + C:\Tools\nuget.exe sources Add -Name "`"Steamware Nexus`"" -Source http://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`"" + } else { + C:\Tools\nuget.exe sources Update -Name "`"Steamware Nexus`"" -Source http://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`"" + } + echo $hasSource + # path alla solution corrente + - '& "$env:NUGET_PATH" restore GPW.sln' + +# .versNumbFix: &versNumbFix +# - 'echo "Set vers: $env:VERS_NUMBER"' +# - '& ((Get-Content -path VersGen\\GPW.cs -Raw) -replace '0.0.0.0','$env:VERS_NUMBER') | Set-Content -Path VersGen\\GPW.cs?' + +stages: + - build + - deploy + +admin:build: + stage: build + before_script: + - *nuget-fix + script: + - '& "$env:MSBUILD_PATH" GPW_Admin/GPW_Admin.csproj -target:Build /p:Configuration=Release /p:Platform="Any CPU" /p:OutputPath=bin/ /m' +# artifacts: +# expire_in: 1 week # save gitlab server space, we copy the files we need to deploy folder later on +# paths: +# # - '$env:EXE_RELEASE_FOLDER\YourApp.exe' # saving exe to copy to deploy folder +# # - '$env:MSI_RELEASE_FOLDER\YourApp Setup.msi' # saving msi to copy to deploy folder +# # - '$env:TEST_FOLDER\' # saving entire Test project so NUnit can run tests +# - '$env:EXE_RELEASE_FOLDER\GPW_Admin\' # saving entire Test project so NUnit can run tests +# - '$env:DEPLOY_FOLDER\GPW_Admin\' # saving entire Test project so NUnit can run tests + +bcode:build: + stage: build + before_script: + - *nuget-fix + script: + - '& "$env:MSBUILD_PATH" GPW_Barcode/GPW_Barcode.csproj -target:Build /p:Configuration=Release /p:Platform="Any CPU" /p:OutputPath=bin/ /m' + +# artifacts: +# expire_in: 1 week # save gitlab server space, we copy the files we need to deploy folder later on +# paths: +# # - '$env:EXE_RELEASE_FOLDER\YourApp.exe' # saving exe to copy to deploy folder +# # - '$env:MSI_RELEASE_FOLDER\YourApp Setup.msi' # saving msi to copy to deploy folder +# # - '$env:TEST_FOLDER\' # saving entire Test project so NUnit can run tests +# - '$env:EXE_RELEASE_FOLDER\GPW_Barcode\' # saving entire Test project so NUnit can run tests +# - '$env:DEPLOY_FOLDER\GPW_Barcode\' # saving entire Test project so NUnit can run tests + +# test_job: +# stage: test +# only: +# - tags +# script: +# - '& "$env:NUNIT_PATH" ".\$env:TEST_FOLDER\Tests.dll"' # running NUnit tests +# artifacts: +# when: always # save test results even when the task fails +# expire_in: 1 week # save gitlab server space, we copy the files we need to deploy folder later on +# paths: +# - '.\TestResult.xml' # saving NUnit results to copy to deploy folder +# dependencies: +# - build_job + + +admin:deploy: + stage: deploy +# rules: +# - if: '$CI_COMMIT_BRANCH == "develop"' +# only: +# - tags # the build process will only be started by git tag commits + before_script: + - *nuget-fix + script: + - '& "$env:MSBUILD_PATH" /p:m=4 /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/ GPW_Admin/GPW_Admin.csproj' + needs: ["admin:build"] + dependencies: + - admin:build + # - test_job + +bcode:deploy: + stage: deploy + before_script: + - *nuget-fix + script: + - '& "$env:MSBUILD_PATH" /p:m=4 /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/ GPW_Barcode/GPW_Barcode.csproj' + needs: ["bcode:build"] + dependencies: + - bcode:build + # - test_job + \ No newline at end of file diff --git a/gitlab-ci.yml b/gitlab-ci.yml deleted file mode 100644 index 918af0c..0000000 --- a/gitlab-ci.yml +++ /dev/null @@ -1,54 +0,0 @@ -variables: - NUGET_PATH: 'C:\Tools\nuget.exe' - MSBUILD_PATH: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe' - #hasSource: '& "$env:NUGET_PATH" sources list | find "`"Steamware Nexus`"" /C' - #hasSource: '0' - - -stages: - - build - - deploy - - -#build_job: -# stage: build -# script: -# - |- -# echo $env:hasSource -# if ($env:hasSource -eq 0) -# { -# $env:NUGET_PATH sources Add -Name "`"Steamware Nexus`"" -Source http://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" #-password "`"viaDante16`"" -# } -# else -# { -# - '& "$env:NUGET_PATH" sources Update -Name "`"Steamware Nexus`"" -Source http://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`""' -# } -# $env:NUGET_PATH restore -# #- '& "$env:NUGET_PATH" restore LPA.sln' -# $env:MSBUILD_PATH LPA/LPA.csproj /p:DeployOnBuild=true /p:Configuration=Release /p:OutputPath=bin/ - -build_job: - stage: build - script: - - | - $hasSource = C:\Tools\nuget.exe sources list | find "`"Steamware Nexus`"" /C - if ($hasSource -eq 0) { - C:\Tools\nuget.exe sources Add -Name "`"Steamware Nexus`"" -Source http://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`"" - } else { - C:\Tools\nuget.exe sources Update -Name "`"Steamware Nexus`"" -Source http://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`"" - } - echo $hasSource - - - '& "$env:NUGET_PATH" restore GPW.sln' - - '& "$env:MSBUILD_PATH" GPW/GPW.csproj /p:DeployOnBuild=true /p:Configuration=Release /p:Platform="Any CPU" /p:OutputPath=sourcecode/' - - #artifacts: - # expire_in: 365 days #artifcats will be stored only 365 days after this it will - # paths: - # - '.\sourcecode\project.sln\bin\Release\Publish\' - # - '.\sourcecode\project.sln\bin\Publish\' - -deploy_job: - stage: deploy - script: - - 'xcopy /y /s ".\sourcecode\*.*" "C:\solutionDir"' #Path where you want to store the solution