diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..591fdf87 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,102 @@ +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: '1.0' + NEW_REL: '' + +# 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 + + +stages: + - build + - test + - staging + - deploy + - release + - installer + +build: + stage: build + before_script: + - *nuget-fix + - dotnet restore + script: + - dotnet build + +test: + stage: test + only: + - develop + needs: ["build"] + script: + - dotnet test + +staging: + stage: staging + only: + - develop + needs: ["build"] + # before_script: + # - *nuget-fix + # - dotnet restore + script: + - dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true MP.Stats/MP.Stats.csproj + + +staging: + stage: deploy + only: + - master + needs: ["build"] + # before_script: + # - *nuget-fix + # - dotnet restore + script: + - dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true MP.Stats/MP.Stats.csproj + - dotnet publish -p:PublishProfile=W2019-IIS-DEVProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true MP.Stats/MP.Stats.csproj + +release: + stage: release + only: + #- feature/Deploy_CI_CD + - master + needs: ["build"] + artifacts: + paths: + - publish/ + script: + - dotnet publish -c Release -o ./publish MP.Stats/MP.Stats.csproj + + + +# AC:install: +# stage: installer +# rules: +# - if: '$CI_COMMIT_BRANCH == "master"' +# when: manual +# # only: +# # - tags # the build process will only be started by git tag commits +# before_script: +# - *nuget-fix +# - '& "$env:NUGET_PATH" restore GPW.sln' +# - *version-fix +# script: +# # Admin ZIP package +# - '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /T:Package /P:Configuration=SPS /p:PublishProfile=SPS.pubxml /p:RunCodeAnalysis=false /p:PackageLocation=ReleaseClienti/SPS_PROD/$env:NEW_REL/GPW_Admin.zip /p:DeployIisAppPath="Default Web Site/GPW/ADMIN" /p:PackageAsSingleFile=True /p:OutputPath=bin/ GPW_Admin/GPW_Admin.csproj' +# # Commesse ZIP package +# - '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /T:Package /P:Configuration=SPS /p:PublishProfile=SPS.pubxml /p:RunCodeAnalysis=false /p:PackageLocation=ReleaseClienti/SPS_PROD/$env:NEW_REL/GPW_Commesse.zip /p:DeployIisAppPath="Default Web Site/GPW/ADMIN" /p:PackageAsSingleFile=True /p:OutputPath=bin/ GPW_Commesse/GPW_Commesse.csproj' +# needs: ["AC:build"] + + diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..fbfcb92d --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,36 @@ +{ + "version": "0.2.0", + "configurations": [ + { + // Use IntelliSense to find out which attributes exist for C# debugging + // Use hover for the description of the existing attributes + // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md + "name": ".NET Core Launch (web)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceFolder}/MP.Stats/bin/Debug/net5.0/MP.Stats.dll", + "args": [], + "cwd": "${workspaceFolder}/MP.Stats", + "stopAtEntry": false, + // Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser + "serverReadyAction": { + "action": "openExternally", + "pattern": "\\bNow listening on:\\s+(https?://\\S+)" + }, + "env": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "sourceFileMap": { + "/Views": "${workspaceFolder}/Views" + } + }, + { + "name": ".NET Core Attach", + "type": "coreclr", + "request": "attach", + "processId": "${command:pickProcess}" + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 00000000..3d710101 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,42 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/MP.Stats/MP.Stats.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/MP.Stats/MP.Stats.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "${workspaceFolder}/MP.Stats/MP.Stats.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/AppDeploy.ps1 b/AppDeploy.ps1 index b7b16fde..871b4322 100644 --- a/AppDeploy.ps1 +++ b/AppDeploy.ps1 @@ -1,7 +1,7 @@ #------------------------------------------------------------------- # Egalware 2021.05.25 # -# AppDeploy -AppPool MP.STATS -SourceDir c:\Steamware\installers\MP.STATS -ZipFile MP.STATS.zip -DestDir c:\inetpub\wwwroot\MP\STATS +# .\AppDeploy.ps1 -AppPool MP.STATS -SourceDir c:\Steamware\installers\MP\STATS -ZipFile MP.STATS.zip -DestDir c:\inetpub\wwwroot\MP\STATS2 # # Powershell script per deploy applicazione Blazor / dotnet core # @@ -29,6 +29,13 @@ param ( [string]$DestDir ) +# conf x logging +$logDir = "c:\Steamware\tmp" +$logFile = "$logDir\Script.log" +$logMirror = "$logDir\Mirror.log" +$utilDir = "c:\Steamware\tmp" +$installDir = "c:\Steamware\installers\" + # recupera timestamp x logging function Get-TimeStamp { @@ -37,14 +44,14 @@ function Get-TimeStamp # registra log! function DoLog($txt2log) { - Write-Output "$(Get-TimeStamp) $txt2log" | Out-File $filelog -Append + Write-Output "$(Get-TimeStamp) $txt2log" | Out-File $logFile -Append } # esegue e registra log function ExecuteLog($txt2log) { - Write-Output "-------------------------------------------------------------------------------------------------------------------------------------------------" | Out-File -FilePath "$filelog" -Append - Write-Output "$(Get-TimeStamp) $txt2log" | Out-File -FilePath "$filelog" -Append - Invoke-Expression "$txt2log 2>&1 | Out-File -FilePath $filelog -Append" + Write-Output "-------------------------------------------------------------------------------------------------------------------------------------------------" | Out-File -FilePath "$logFile" -Append + Write-Output "$(Get-TimeStamp) $txt2log" | Out-File -FilePath "$logFile" -Append + Invoke-Expression "$txt2log 2>&1 | Out-File -FilePath $logFile -Append" if( $LASTEXITCODE -ne 0) { Write-Host "Error during cmmand: $txt2log" -ForegroundColor Red ; @@ -53,27 +60,41 @@ function ExecuteLog($txt2log) exit } } -# conf x logging -$filelog = "c:\Steamware\tmp\Script.log" -$utilDir = "c:\Steamware\tmp\" -Write-Output "-------------------------------- START script --------------------------------" | Out-File $filelog +# fix cartelle... +If (!(test-path $logFile)) +{ + New-Item -ItemType Directory -Force -Path $logDir + New-Item -ItemType File -Force -Path $logFile + New-Item -ItemType File -Force -Path $logMirror +} + +Write-Output "-------------------------------- START script --------------------------------" | Out-File $logFile $StopWatch = New-Object System.Diagnostics.Stopwatch $StopWatch.Start() # step 1 : stop del pool applicazioni IIS -Write-Host "Stop AppPool" -ExecuteLog "Stop-WebAppPool -Name '$AppPool'" +$currState = Get-WebAppPoolState -Name $AppPool +if($currState.value -eq "Started") +{ + Write-Host "Stop AppPool" + ExecuteLog "Stop-WebAppPool -Name '$AppPool'" +} -# step 2 : unzip -ExecuteLog "Expand-7Zip -ArchiveFileName '$SourceDir\$ZipFile' -TargetPath '$utilDir'" +# step 2 : cambio dir + unzip +Write-Host "Unzip" +cd $utilDir +ExecuteLog "7z x ""$SourceDir\$ZipFile"" " # step 3 : replica applicazione Write-Host "START copy step" -ExecuteLog "robocopy '$utilDir\publish\net5.0\' '$DestDir' /MIR /Z /LOG:C:\tmp\ViewMirror.log /XF logs/*.txt logs/*.log" +ExecuteLog "robocopy '$utilDir\publish\net5.0\' '$DestDir' /MIR /Z /LOG:'$logMirror'" Write-Host "END copy step" # step 4 : riavvio pool Write-Host "Start AppPool" ExecuteLog "Start-WebAppPool -Name '$AppPool'" + +# step 5 : fix dir originale +cd $installDir \ No newline at end of file diff --git a/MP.Data/Controllers/MpStatsController.cs b/MP.Data/Controllers/MpStatsController.cs index 8a01f41f..d02a1c02 100644 --- a/MP.Data/Controllers/MpStatsController.cs +++ b/MP.Data/Controllers/MpStatsController.cs @@ -27,7 +27,7 @@ namespace MP.Data.Controllers { _configuration = configuration; dbCtx = new MoonPro_STATSContext(configuration); - Log.Info("Avviata classe MpStatsController.MpStatsController"); + Log.Info("Avviata classe MpStatsController"); } #endregion Public Constructors @@ -111,6 +111,12 @@ namespace MP.Data.Controllers return dbResult; } + public void ResetController() + { + dbCtx = new MoonPro_STATSContext(_configuration); + Log.Info("Effettuato reset MpStatsController"); + } + /// /// Annulla modifiche su una specifica entity (cancel update) /// diff --git a/MP.Stats/Components/ChartControlli.razor b/MP.Stats/Components/ChartControlli.razor index 40f2a97c..2f870d3d 100644 --- a/MP.Stats/Components/ChartControlli.razor +++ b/MP.Stats/Components/ChartControlli.razor @@ -7,7 +7,7 @@ } else { -
+