From 0767f1c64757cbe52468b835a1b9a3671162942f Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 28 Sep 2021 19:28:48 +0200 Subject: [PATCH 1/9] Test prima versione CI/CD --- .gitlab-ci.yml | 160 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..177f97f3 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,160 @@ +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' + NEXUS_PATH: 'MAPO/IOB-WIN-NEXT' + APP_NAME: 'IOB-WIN-NEXT' + VERS_MAIN: '3.5' + NEW_REL: '' + OUTPUT_DIR: '' + +# 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 https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"$NEXUS_PASSWD`"" + } else { + C:\Tools\nuget.exe sources Update -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"$NEXUS_PASSWD`"" + } + echo $hasSource + +# helper x fix version number +.version-fix: &version-fix + - | + $env:NEW_REL = $env:VERS_MAIN+"."+(get-date –format yyMM)+"."+$CI_PIPELINE_IID + $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' + echo "Set vers: $env:NEW_REL" + +# helper pulizia files zip +.cleanup-zip: &cleanup-zip + - | + $env:OUTPUT_DIR = "Releases\" + $CI_COMMIT_BRANCH + "\*" + if ((Test-Path $env:OUTPUT_DIR)) + { + Remove-Item $env:OUTPUT_DIR -Force -Recurse -ErrorAction Ignore + } + echo "Clening ZIP dir: $env:OUTPUT_DIR" + +# helper creazione files zip +.zipper: &zipper + - | + $7zipPath = $env:ProgramFiles+"\7-Zip\7z.exe" + if (-not (Test-Path -Path $7zipPath -PathType Leaf)) { + throw "7 zip file '$7zipPath' not found" + } + Set-Alias 7zip $7zipPath + $Target = "Releases\" + $CI_COMMIT_BRANCH + "\" + $env:APP_NAME + ".zip" + $Source = "$env:APP_NAME\bin\*" + 7zip a -tzip $Target $Source + echo "called ZIP $Source --> $Target" + +# helper creazione hash files +.hashBuild: &hashBuild + - | + $Target = "Releases\" + $CI_COMMIT_BRANCH + "\" + $env:APP_NAME + ".zip" + $MD5 = Get-FileHash $Target -Algorithm MD5 + $SHA1 = Get-FileHash $Target -Algorithm SHA1 + New-Item $Target".md5" + New-Item $Target".sha1" + $MD5.Hash | Set-Content -Path $Target".md5" + $SHA1.Hash | Set-Content -Path $Target".sha1" + + echo "Created HASH files for $Target" + +# helper x send su NEXUS + # $File2Send = "Releases\" + $CI_COMMIT_BRANCH + "\" + $env:APP_NAME + ".zip" + # mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File2Send https://nexus.steamware.net/repository/utility/$env:NEXUS_PATH/$version/$env:APP_NAME-$version.zip + # mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File2Send".md5" https://nexus.steamware.net/repository/utility/$env:NEXUS_PATH/$version/$env:APP_NAME-$version.zip".md5" + # mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File2Send".sha1" https://nexus.steamware.net/repository/utility/$env:NEXUS_PATH/$version/$env:APP_NAME-$version.zip".sha1" +.nexusUpload: &nexusUpload + - | + Set-Alias mCurl C:\Windows\system32\curl.exe + if($CI_COMMIT_BRANCH -eq "master") + { + $version = "stable" + } + else + { + $version = "unstable" + } + $File2Send = "Releases\" + $CI_COMMIT_BRANCH + "\" + $env:APP_NAME + ".*" + ForEach ($File in $File2Send) { + $FileName = Split-Path $File -leaf + mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/$FileName + mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/ARCHIVE/$VersNumb/$FileName + } + mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\manifest.xml" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/manifest.xml + mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\ChangeLog.html" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/ChangeLog.html + +# mCurl -v -u $env:NEXUS_USER:$env:NEXUS_PASSWD --upload-file bin/release/$env:APP_NAME.zip $env:NEXUS_SERVER/utility/$env:NEXUS_PATH/$version/$env:APP_NAME-$version.zip + +stages: + - build + - deploy + +IOB:build: + stage: build + tags: + - win + variables: + APP_NAME: IOB-WIN + before_script: + - *nuget-fix + - '& "$env:NUGET_PATH" restore $env:APP_NAME.sln' # path alla solution corrente + - *version-fix + script: + - '& "$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' + +IOB-NEXT:build: + stage: build + tags: + - win + variables: + APP_NAME: IOB-WIN-NEXT + before_script: + - *nuget-fix + - '& "$env:NUGET_PATH" restore $env:APP_NAME.sln' # path alla solution corrente + - *version-fix + script: + - '& "$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' + +IOB:deploy: + stage: deploy + tags: + - win + variables: + APP_NAME: IOB-WIN + before_script: + - *nuget-fix + - '& "$env:NUGET_PATH" restore $env:APP_NAME.sln' # path alla solution corrente + - *version-fix + - *cleanup-zip + script: + - '& "$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' + - *zipper + - *hashBuild + - *nexusUpload + needs: ["IOB:build"] + +IOB-NEXT:deploy: + stage: deploy + tags: + - win + variables: + APP_NAME: IOB-WIN-NEXT + before_script: + - *nuget-fix + - '& "$env:NUGET_PATH" restore $env:APP_NAME.sln' # path alla solution corrente + - *version-fix + - *cleanup-zip + script: + - '& "$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' + - *zipper + - *hashBuild + - *nexusUpload + needs: ["IOB-NEXT:build"] \ No newline at end of file From e38339f9659b571cbd5525cac48a2540abd88043 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 28 Sep 2021 19:33:28 +0200 Subject: [PATCH 2/9] cambio sintassi CI/CD --- .gitlab-ci.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 177f97f3..02b96b06 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -105,10 +105,10 @@ IOB:build: APP_NAME: IOB-WIN before_script: - *nuget-fix - - '& "$env:NUGET_PATH" restore $env:APP_NAME.sln' # path alla solution corrente + - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"' - *version-fix script: - - '& "$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' + - '& "$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' IOB-NEXT:build: stage: build @@ -118,10 +118,10 @@ IOB-NEXT:build: APP_NAME: IOB-WIN-NEXT before_script: - *nuget-fix - - '& "$env:NUGET_PATH" restore $env:APP_NAME.sln' # path alla solution corrente + - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"' - *version-fix script: - - '& "$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' + - '& "$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' IOB:deploy: stage: deploy @@ -131,11 +131,11 @@ IOB:deploy: APP_NAME: IOB-WIN before_script: - *nuget-fix - - '& "$env:NUGET_PATH" restore $env:APP_NAME.sln' # path alla solution corrente + - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"' - *version-fix - *cleanup-zip script: - - '& "$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' + - '& "$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' - *zipper - *hashBuild - *nexusUpload @@ -149,11 +149,11 @@ IOB-NEXT:deploy: APP_NAME: IOB-WIN-NEXT before_script: - *nuget-fix - - '& "$env:NUGET_PATH" restore $env:APP_NAME.sln' # path alla solution corrente + - '& "$env:NUGET_PATH" restore $env:APP_NAME.sln' - *version-fix - *cleanup-zip script: - - '& "$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' + - '& "$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' - *zipper - *hashBuild - *nexusUpload From ae4161a503474f338931449f49017e3eb3362bf4 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 28 Sep 2021 19:38:41 +0200 Subject: [PATCH 3/9] Fix verbosity niget + fix deploy sertp 2 --- .gitlab-ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 02b96b06..64032e32 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -105,7 +105,7 @@ IOB:build: APP_NAME: IOB-WIN before_script: - *nuget-fix - - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"' + - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet' - *version-fix script: - '& "$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' @@ -118,7 +118,7 @@ IOB-NEXT:build: APP_NAME: IOB-WIN-NEXT before_script: - *nuget-fix - - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"' + - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet' - *version-fix script: - '& "$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' @@ -131,7 +131,7 @@ IOB:deploy: APP_NAME: IOB-WIN before_script: - *nuget-fix - - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"' + - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet' - *version-fix - *cleanup-zip script: @@ -149,7 +149,7 @@ IOB-NEXT:deploy: APP_NAME: IOB-WIN-NEXT before_script: - *nuget-fix - - '& "$env:NUGET_PATH" restore $env:APP_NAME.sln' + - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet' - *version-fix - *cleanup-zip script: From 20efb6b0d2dc7aaaf83d7d5f14eae6794f99f0f3 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 28 Sep 2021 19:41:16 +0200 Subject: [PATCH 4/9] Fix architettura compilazione --- .gitlab-ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 64032e32..a7297f16 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -108,7 +108,7 @@ IOB:build: - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet' - *version-fix script: - - '& "$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' + - '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=Release /p:Platform="x86" /p:OutputPath=bin/ /verbosity:minimal /m' IOB-NEXT:build: stage: build @@ -121,7 +121,7 @@ IOB-NEXT:build: - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet' - *version-fix script: - - '& "$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' + - '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=Release /p:Platform="x86" /p:OutputPath=bin/ /verbosity:minimal /m' IOB:deploy: stage: deploy @@ -135,7 +135,7 @@ IOB:deploy: - *version-fix - *cleanup-zip script: - - '& "$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' + - '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=Release /p:Platform="x86" /p:OutputPath=bin/ /verbosity:minimal /m' - *zipper - *hashBuild - *nexusUpload @@ -153,7 +153,7 @@ IOB-NEXT:deploy: - *version-fix - *cleanup-zip script: - - '& "$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' + - '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=Release /p:Platform="x86" /p:OutputPath=bin/ /verbosity:minimal /m' - *zipper - *hashBuild - *nexusUpload From 5865160198f92515aee69dae6f4f1c849df04ee6 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 28 Sep 2021 19:43:21 +0200 Subject: [PATCH 5/9] Provo compilazione SOLO IOB-WIN-NEXT --- .gitlab-ci.yml | 58 +++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a7297f16..3ae980ab 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -97,18 +97,18 @@ stages: - build - deploy -IOB:build: - stage: build - tags: - - win - variables: - APP_NAME: IOB-WIN - before_script: - - *nuget-fix - - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet' - - *version-fix - script: - - '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=Release /p:Platform="x86" /p:OutputPath=bin/ /verbosity:minimal /m' +# IOB:build: +# stage: build +# tags: +# - win +# variables: +# APP_NAME: IOB-WIN +# before_script: +# - *nuget-fix +# - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet' +# - *version-fix +# script: +# - '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=Release /p:Platform="x86" /p:OutputPath=bin/ /verbosity:minimal /m' IOB-NEXT:build: stage: build @@ -123,23 +123,23 @@ IOB-NEXT:build: script: - '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=Release /p:Platform="x86" /p:OutputPath=bin/ /verbosity:minimal /m' -IOB:deploy: - stage: deploy - tags: - - win - variables: - APP_NAME: IOB-WIN - before_script: - - *nuget-fix - - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet' - - *version-fix - - *cleanup-zip - script: - - '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=Release /p:Platform="x86" /p:OutputPath=bin/ /verbosity:minimal /m' - - *zipper - - *hashBuild - - *nexusUpload - needs: ["IOB:build"] +# IOB:deploy: +# stage: deploy +# tags: +# - win +# variables: +# APP_NAME: IOB-WIN +# before_script: +# - *nuget-fix +# - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet' +# - *version-fix +# - *cleanup-zip +# script: +# - '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=Release /p:Platform="x86" /p:OutputPath=bin/ /verbosity:minimal /m' +# - *zipper +# - *hashBuild +# - *nexusUpload +# needs: ["IOB:build"] IOB-NEXT:deploy: stage: deploy From 1432a1fbee8f4895fe8c115bb7cd0621a88824d1 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 28 Sep 2021 19:48:35 +0200 Subject: [PATCH 6/9] messaggio verboso x nuget --- .gitlab-ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3ae980ab..d61e5cb1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -118,6 +118,8 @@ IOB-NEXT:build: APP_NAME: IOB-WIN-NEXT before_script: - *nuget-fix + - echo "Chiamata comando nuget-restore" + - echo "'& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet'" - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet' - *version-fix script: @@ -149,6 +151,8 @@ IOB-NEXT:deploy: APP_NAME: IOB-WIN-NEXT before_script: - *nuget-fix + - echo "Chiamata comando nuget-restore" + - echo "'& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet'" - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet' - *version-fix - *cleanup-zip From c39021f5b7301451d0c17511733939bab0d91a8e Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 28 Sep 2021 19:53:04 +0200 Subject: [PATCH 7/9] test CI/CD alternativo solo 1 step --- .gitlab-ci.yml | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d61e5cb1..8fecb8b4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -95,7 +95,7 @@ variables: stages: - build - - deploy +# - deploy # IOB:build: # stage: build @@ -120,7 +120,8 @@ IOB-NEXT:build: - *nuget-fix - echo "Chiamata comando nuget-restore" - echo "'& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet'" - - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet' + - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"' + # - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet' - *version-fix script: - '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=Release /p:Platform="x86" /p:OutputPath=bin/ /verbosity:minimal /m' @@ -143,22 +144,22 @@ IOB-NEXT:build: # - *nexusUpload # needs: ["IOB:build"] -IOB-NEXT:deploy: - stage: deploy - tags: - - win - variables: - APP_NAME: IOB-WIN-NEXT - before_script: - - *nuget-fix - - echo "Chiamata comando nuget-restore" - - echo "'& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet'" - - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet' - - *version-fix - - *cleanup-zip - script: - - '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=Release /p:Platform="x86" /p:OutputPath=bin/ /verbosity:minimal /m' - - *zipper - - *hashBuild - - *nexusUpload - needs: ["IOB-NEXT:build"] \ No newline at end of file +# IOB-NEXT:deploy: +# stage: deploy +# tags: +# - win +# variables: +# APP_NAME: IOB-WIN-NEXT +# before_script: +# - *nuget-fix +# - echo "Chiamata comando nuget-restore" +# - echo "'& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet'" +# - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet' +# - *version-fix +# - *cleanup-zip +# script: +# - '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=Release /p:Platform="x86" /p:OutputPath=bin/ /verbosity:minimal /m' +# - *zipper +# - *hashBuild +# - *nexusUpload +# needs: ["IOB-NEXT:build"] \ No newline at end of file From 2f613211319693febd218c98f90671f4e12eb11a Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 29 Sep 2021 17:43:50 +0200 Subject: [PATCH 8/9] Aggiunta gestione delta valori x min/max e disconnect x ModBus --- IOB-WIN-NEXT/DATA/CONF/PIZ04.ini | 2 ++ IOB-WIN-NEXT/DATA/CONF/PIZ05.ini | 2 ++ IOB-WIN-NEXT/IobModbusTCP.cs | 24 ++++++++++++++++++++++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/IOB-WIN-NEXT/DATA/CONF/PIZ04.ini b/IOB-WIN-NEXT/DATA/CONF/PIZ04.ini index b2c6e223..5bb1ff68 100644 --- a/IOB-WIN-NEXT/DATA/CONF/PIZ04.ini +++ b/IOB-WIN-NEXT/DATA/CONF/PIZ04.ini @@ -55,6 +55,8 @@ MAX_SEND_PZC_BLOCK=100 ; GEST DATI DYN ENABLE_DYN_DATA=TRUE FORCE_DYN_DATA=TRUE +; gestione delta minimo accettabile tra min/MAX +DELTA_VAL=0.1 ; clock base (da 10ms) timerIntMs=100 diff --git a/IOB-WIN-NEXT/DATA/CONF/PIZ05.ini b/IOB-WIN-NEXT/DATA/CONF/PIZ05.ini index 2c2f56ef..115e8aff 100644 --- a/IOB-WIN-NEXT/DATA/CONF/PIZ05.ini +++ b/IOB-WIN-NEXT/DATA/CONF/PIZ05.ini @@ -55,6 +55,8 @@ MAX_SEND_PZC_BLOCK=100 ; GEST DATI DYN ENABLE_DYN_DATA=TRUE FORCE_DYN_DATA=TRUE +; gestione delta minimo accettabile tra min/MAX +DELTA_VAL=0.1 ; clock base (da 10ms) timerIntMs=100 diff --git a/IOB-WIN-NEXT/IobModbusTCP.cs b/IOB-WIN-NEXT/IobModbusTCP.cs index ef5ade76..cbf13c13 100644 --- a/IOB-WIN-NEXT/IobModbusTCP.cs +++ b/IOB-WIN-NEXT/IobModbusTCP.cs @@ -21,6 +21,15 @@ namespace IOB_WIN_NEXT public class IobModbusTCP : IobGeneric { + #region Private Fields + + /// + /// Valore delta x gestione min/MAX e valore rilevato + /// + private double deltaVal = 0; + + #endregion Private Fields + #region Protected Fields protected ModbusClient currPLC; @@ -222,8 +231,8 @@ namespace IOB_WIN_NEXT default: break; } - // verifica limite... - dataOk = (valore > item.Value.minVal && valore < item.Value.maxVal); + // verifica limite... con delta da impianto + dataOk = (valore > (item.Value.minVal + deltaVal) && valore < (item.Value.maxVal - deltaVal)); if (dataOk) { // moltiplico x fattore conversione... @@ -496,6 +505,12 @@ namespace IOB_WIN_NEXT parentForm.commPlcActive = false; // carico conf vettore memoria... loadMemConf(); + // aggiungo DELTA x calcolo min/MAX... + string deltaValStr = getOptPar("DELTA_VAL"); + if (!string.IsNullOrEmpty(deltaValStr)) + { + double.TryParse(deltaValStr, out deltaVal); + } bool enableByApp = utils.CRB("enableContapezzi"); bool enableByIob = (getOptPar("ENABLE_PZCOUNT") == "TRUE"); bool disableByIob = (getOptPar("DISABLE_PZCOUNT") == "TRUE"); @@ -686,6 +701,11 @@ namespace IOB_WIN_NEXT { readErrorList = getDataDictionary(readErrorList, false, ref outVal); } + // se avessi acnora errori --> disconnetto + if (readErrorList.Count > 0) + { + tryDisconnect(); + } } else { From 9bc16ed95fdfcd91213d192aa02279abf2a4239f Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 29 Sep 2021 17:44:08 +0200 Subject: [PATCH 9/9] refresh gitla yaml x testing --- .gitlab-ci.yml | 8 ++++---- CVCncLib/CVCncLib.dll | Bin 967680 -> 967680 bytes 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8fecb8b4..56bfaac7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,7 +24,7 @@ variables: # helper x fix version number .version-fix: &version-fix - | - $env:NEW_REL = $env:VERS_MAIN+"."+(get-date –format yyMM)+"."+$CI_PIPELINE_IID + $env:NEW_REL = $env:VERS_MAIN+"."+(get-date –format yyMM)+"."+(get-date –format ddHH) $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' @@ -119,9 +119,9 @@ IOB-NEXT:build: before_script: - *nuget-fix - echo "Chiamata comando nuget-restore" - - echo "'& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet'" - - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"' - # - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet' + - echo "'& "$env:NUGET_PATH" restore "$env:APP_NAME.sln" -verbosity quiet'" + # - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"' + - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln" -verbosity quiet' - *version-fix script: - '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=Release /p:Platform="x86" /p:OutputPath=bin/ /verbosity:minimal /m' diff --git a/CVCncLib/CVCncLib.dll b/CVCncLib/CVCncLib.dll index 77ac5221039597180a4a8eac0b9a46d27b802fe4..ae70509998b68c0cafbd6427dcdaa46b78edbaeb 100644 GIT binary patch delta 134 zcmZqZux{wEp3uSU9v1shf*M?Ups+Wuz)AB!*m_3|^f delta 134 zcmZqZux{wEp3uR(abHklcWXCeYd2GCH*;$@OKUf4Yd2eKH+yS0M{74{Yd2SGH}}?V z9?OLSar>9E1=t#UPA>fXWARDu5A9bL@&GaK_A3kd{_yDljY?zy0wy4qVPs%