diff --git a/appveyor.yml b/appveyor.yml index 6dabefe..8c8c89b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -49,8 +49,7 @@ install: - bundle config --local path vendor/bundle - gem install bundler --quiet --no-ri --no-rdoc - gem install github_changelog_generator --quiet --no-ri --no-rdoc - # this needs to be replace with the official version and nuget package as soon as it's released - - dotnet tool install -g --version 4.0.0-pullrequest1422-1625 --add-source https://ci.appveyor.com/nuget/gitversion-8nigugxjftrw GitVersion.CommandLine.DotNetCore.Tool + - dotnet tool install --tool-path . nbgv - ps: .\install-vsix-appveyor.ps1 before_build: @@ -60,12 +59,19 @@ before_build: nuget restore source\nanoFramework.Networking.Sntp.sln - dotnet-gitversion /l console /output buildserver /updateAssemblyInfo "source\nanoFramework.Networking.Sntp\Properties\AssemblyInfo.cs" + .\nbgv cloud -p "source" build_script: - ps: >- - msbuild source\nanoFramework.Networking.Sntp.sln /p:Configuration=Release /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" + if ($env:APPVEYOR_REPO_TAG -eq "true") + { + msbuild source\nanoFramework.Networking.Sntp.sln /p:PublicRelease=true /p:Configuration=Release /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" + } + else + { + msbuild source\nanoFramework.Networking.Sntp.sln /p:Configuration=Release /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" + } before_deploy: - ps: >- @@ -73,12 +79,12 @@ before_deploy: .\generate-change-log.ps1 - Push-AppveyorArtifact $env:APPVEYOR_BUILD_FOLDER\source\Nuget.nanoFramework.Networking.Sntp\bin\Release\nanoFramework.Networking.Sntp.$env:GitVersion_NuGetVersionV2.nupkg + Push-AppveyorArtifact $env:APPVEYOR_BUILD_FOLDER\source\Nuget.nanoFramework.Networking.Sntp\bin\Release\nanoFramework.Networking.Sntp.$env:NBGV_NuGetPackageVersion.nupkg after_deploy: # for this environment variable to work here it has to be set in AppVeyor UI -- nuget push source\Nuget.nanoFramework.Networking.Sntp\bin\Release\nanoFramework.Networking.Sntp.%GitVersion_NuGetVersionV2%.nupkg %MyGetToken% -Source https://www.myget.org/F/nanoframework-dev/api/v2/package -- nuget push source\Nuget.nanoFramework.Networking.Sntp.DELIVERABLES\bin\Release\nanoFramework.Networking.Sntp.DELIVERABLES.%GitVersion_NuGetVersionV2%.nupkg %MyGetToken% -Source https://www.myget.org/F/nanoframework-dev/api/v2/package +- nuget push source\Nuget.nanoFramework.Networking.Sntp\bin\Release\nanoFramework.Networking.Sntp.%NBGV_NuGetPackageVersion%.nupkg %MyGetToken% -Source https://www.myget.org/F/nanoframework-dev/api/v2/package +- nuget push source\Nuget.nanoFramework.Networking.Sntp.DELIVERABLES\bin\Release\nanoFramework.Networking.Sntp.DELIVERABLES.%NBGV_NuGetPackageVersion%.nupkg %MyGetToken% -Source https://www.myget.org/F/nanoframework-dev/api/v2/package # requires APPVEYOR_DISCORD_WEBHOOK_URL enviroment variable set with Discord webhook URL on_failure: @@ -108,9 +114,9 @@ for: on: appveyor_repo_tag: true - provider: GitHub - tag: v$(GitVersion_NuGetVersionV2) - release: nanoFramework.Networking.Sntp Library v$(GitVersion_NuGetVersionV2) - description: 'Check the [changelog](https://github.com/nanoframework/lib-nanoFramework.Networking.Sntp/blob/master/CHANGELOG.md)\n\n## Install from NuGet\n\nThe following NuGet packages are available for download from this release\n\n:package: [.NET](https://www.nuget.org/packages/nanoFramework.Networking.Sntp/$(GitVersion_NuGetVersionV2)) v$(GitVersion_NuGetVersionV2)' + tag: v$(NBGV_NuGetPackageVersion) + release: nanoFramework.Networking.Sntp Library v$(NBGV_NuGetPackageVersion) + description: 'Check the [changelog](https://github.com/nanoframework/lib-nanoFramework.Networking.Sntp/blob/master/CHANGELOG.md)\n\n## Install from NuGet\n\nThe following NuGet packages are available for download from this release\n\n:package: [.NET](https://www.nuget.org/packages/nanoFramework.Networking.Sntp/$(NBGV_NuGetPackageVersion)) v$(NBGV_NuGetPackageVersion)' auth_token: secure: DNixoFFE+pGlwyhj7McfZoln42vOmj0iY1iNV9zXEr3y0NpXlOIgL8k5ehzlFM1S artifact: @@ -126,9 +132,9 @@ for: deploy: - provider: GitHub - tag: v$(GitVersion_NuGetVersionV2) - release: nanoFramework.Networking.Sntp Library v$(GitVersion_NuGetVersionV2) - description: 'Check the [changelog](https://github.com/nanoframework/lib-nanoFramework.Networking.Sntp/blob/$(appveyor_repo_branch)/CHANGELOG.md)\n\n## Install from nanoFramework MyGet development feed\n\nThe following NuGet packages are available for download from this release\n\npackage: [.NET](https://www.myget.org/feed/nanoframework-dev/package/nuget/nanoFramework.Networking.Sntp/$(GitVersion_NuGetVersionV2)) v$(GitVersion_NuGetVersionV2)' + tag: v$(NBGV_NuGetPackageVersion) + release: nanoFramework.Networking.Sntp Library v$(NBGV_NuGetPackageVersion) + description: 'Check the [changelog](https://github.com/nanoframework/lib-nanoFramework.Networking.Sntp/blob/$(appveyor_repo_branch)/CHANGELOG.md)\n\n## Install from nanoFramework MyGet development feed\n\nThe following NuGet packages are available for download from this release\n\npackage: [.NET](https://www.myget.org/feed/nanoframework-dev/package/nuget/nanoFramework.Networking.Sntp/$(NBGV_NuGetPackageVersion)) v$(NBGV_NuGetPackageVersion)' auth_token: secure: DNixoFFE+pGlwyhj7McfZoln42vOmj0iY1iNV9zXEr3y0NpXlOIgL8k5ehzlFM1S artifact: @@ -150,9 +156,9 @@ for: on: appveyor_repo_tag: true - provider: GitHub - tag: v$(GitVersion_NuGetVersionV2) - release: nanoFramework.Networking.Sntp Library v$(GitVersion_NuGetVersionV2) - description: 'Check the [changelog](https://github.com/nanoframework/lib-nanoFramework.Networking.Sntp/blob/$(appveyor_repo_branch)/CHANGELOG.md)\n\n## Install from NuGet\n\nThe following NuGet packages are available for download from this release\n\n:package: [.NET](https://www.nuget.org/packages/nanoFramework.Networking.Sntp/$(GitVersion_NuGetVersionV2)) v$(GitVersion_NuGetVersionV2)' + tag: v$(NBGV_NuGetPackageVersion) + release: nanoFramework.Networking.Sntp Library v$(NBGV_NuGetPackageVersion) + description: 'Check the [changelog](https://github.com/nanoframework/lib-nanoFramework.Networking.Sntp/blob/$(appveyor_repo_branch)/CHANGELOG.md)\n\n## Install from NuGet\n\nThe following NuGet packages are available for download from this release\n\n:package: [.NET](https://www.nuget.org/packages/nanoFramework.Networking.Sntp/$(NBGV_NuGetPackageVersion)) v$(NBGV_NuGetPackageVersion)' auth_token: secure: DNixoFFE+pGlwyhj7McfZoln42vOmj0iY1iNV9zXEr3y0NpXlOIgL8k5ehzlFM1S artifact: diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9f981a6..34b2192 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,7 +1,12 @@ -# .NET Desktop -# Build and run tests for .NET Desktop or Windows classic desktop solutions. -# Add steps that publish symbols, save build artifacts, and more: -# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net +trigger: + branches: + include: ["master", "*"] + paths: + exclude: ["doc", "*.md", ".appveyor.yml"] + +pr: + branches: + include: [ "*" ] pool: vmImage: 'VS2017-Win2016' @@ -20,17 +25,16 @@ steps: feedsToUse: config nugetConfigPath: source/NuGet.config -# Download file -# - task: DownloadFile@1 -# inputs: -# FileUrl: 'https://marketplace.visualstudio.com/_apis/public/gallery/publishers/vs-publisher-1470366/vsextensions/nanoFrameworkVS2017Extension/0/vspackage' +- task: DotNetCoreCLI@2 + inputs: + command: custom + custom: tool + arguments: install --tool-path . nbgv + displayName: Install NBGV tool -# # install nanoFramework VS extension -# - task: PowerShell@2 -# inputs: -# targetType: 'inline' -# script: 'Install-Module VSSetup -Scope CurrentUser -AcceptLicense -Force' -# errorActionPreference: 'stop' +- script: nbgv cloud -p "source" + displayName: Set build number + condition: ne(variables['system.pullrequest.isfork'], true) # install nanoFramework VS extension - task: PowerShell@2 @@ -38,6 +42,11 @@ steps: filePath: 'install-nf-vs-extension.ps1' errorActionPreference: 'stop' +# # Batch Script +# - task: BatchScript@1 +# inputs: +# filename: '$(INSTALLER_PATH)' + # # Run a command line script using cmd.exe on Windows and bash on macOS and Linux. # - task: CmdLine@2 # inputs: @@ -51,17 +60,30 @@ steps: platform: '$(buildPlatform)' configuration: '$(buildConfiguration)' -- task: VSTest@2 +# we don't have tests (yet) +# - task: VSTest@2 +# inputs: +# platform: '$(buildPlatform)' +# configuration: '$(buildConfiguration)' + +- task: CopyFiles@1 inputs: - platform: '$(buildPlatform)' - configuration: '$(buildConfiguration)' + sourceFolder: $(System.DefaultWorkingDirectory) + Contents: | + **source\Nuget.*\*.nupkg + TargetFolder: $(Build.ArtifactStagingDirectory)/deployables + flattenFolders: true + displayName: Collecting deployable artifacts - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: $(Build.ArtifactStagingDirectory)/deployables + ArtifactName: deployables + ArtifactType: Container + displayName: Publish deployables artifacts - task: NuGetCommand@2 inputs: command: push nuGetFeedType: external publishFeedCredentials: 'MyGet' - versioningScheme: byEnvVar - versionEnvVar: Version diff --git a/commit-assemblyinfo-changes.ps1 b/commit-assemblyinfo-changes.ps1 index 1205ecd..9fd69cd 100644 --- a/commit-assemblyinfo-changes.ps1 +++ b/commit-assemblyinfo-changes.ps1 @@ -1,22 +1,6 @@ # Copyright (c) 2018 The nanoFramework project contributors # See LICENSE file in the project root for full license information. -# skip updating assembly info changes if build is a pull-request or not a tag (can't commit when repo is in a tag) -if ($env:appveyor_pull_request_number -or $env:APPVEYOR_REPO_TAG -eq "true") -{ - 'Skip committing assembly info changes...' | Write-Host -ForegroundColor White -} -else -{ - # updated assembly info files - git add "source\nanoFramework.Networking.Sntp\Properties\AssemblyInfo.cs" - git commit -m "Update assembly info file for v$env:GitVersion_NuGetVersionV2" -m"[version update]" - git push origin --porcelain -q > $null - - 'Updated assembly info...' | Write-Host -ForegroundColor White -NoNewline - 'OK' | Write-Host -ForegroundColor Green -} - # update assembly info in nf-interpreter if this is tag if ($env:APPVEYOR_REPO_TAG -eq "true") { @@ -27,13 +11,13 @@ if ($env:APPVEYOR_REPO_TAG -eq "true") cd nf-interpreter > $null # new branch name - $newBranch = "$env:APPVEYOR_REPO_BRANCH-nfbot/update-version/nanoFramework.Networking.Sntp/$env:GitVersion_NuGetVersionV2" + $newBranch = "$env:APPVEYOR_REPO_BRANCH-nfbot/update-version/nanoFramework.Networking.Sntp/$env:NBGV_NuGetPackageVersion" # create branch to perform updates git checkout -b "$newBranch" develop -q # replace version in assembly declaration - $newVersion = $env:GitVersion_AssemblySemFileVer -replace "\." , ", " + $newVersion = $env:NBGV_GitBuildVersion -replace "\." , ", " $newVersion = "{ $newVersion }" $versionRegex = "\{\s*\d+\,\s*\d+\,\s*\d+\,\s*\d+\s*}" @@ -56,7 +40,7 @@ if ($env:APPVEYOR_REPO_TAG -eq "true") } else { - $commitMessage = "Update nanoFramework.Networking.Sntp version to $env:GitVersion_NuGetVersionV2" + $commitMessage = "Update nanoFramework.Networking.Sntp version to $env:NBGV_NuGetPackageVersion" # commit changes git add -A 2>&1 diff --git a/generate-change-log.ps1 b/generate-change-log.ps1 index 3d1f660..3051f1c 100644 --- a/generate-change-log.ps1 +++ b/generate-change-log.ps1 @@ -14,7 +14,7 @@ else if ($env:APPVEYOR_REPO_BRANCH -eq "master" -or $env:APPVEYOR_REPO_BRANCH -match "^release*") { # generate change log including future version - bundle exec github_changelog_generator --token $env:GitHubToken --future-release "v$env:GitVersion_MajorMinorPatch" + bundle exec github_changelog_generator --token $env:GitHubToken --future-release "v$env:NBGV_GitVersion_MajorMinorPatch" } else { @@ -25,7 +25,7 @@ else # updated changelog and the updated assembly info files git add CHANGELOG.md - git commit -m "Update CHANGELOG for v$env:GitVersion_NuGetVersionV2" + git commit -m "Update CHANGELOG for v$env:NBGV_NuGetPackageVersion" # need to wrap the git command bellow so it doesn't throw an error because of redirecting the output to stderr git push origin --porcelain | Write-Host } diff --git a/install-nf-vs-extension.ps1 b/install-nf-vs-extension.ps1 index 1c25e65..1b105d8 100644 --- a/install-nf-vs-extension.ps1 +++ b/install-nf-vs-extension.ps1 @@ -17,8 +17,11 @@ # | Select-VSSetupInstance ` # | Select-Object -ExpandProperty InstallationPath -# # extension path -# $vsixPath = Join-Path $env:Agent_TempDirectory "nanoFramework.Tools.VS2017.Extension.vsix" +# extension path +$vsixPath = Join-Path $env:Agent_TempDirectory "nanoFramework.Tools.VS2017.Extension.vsix" +# installer path +$INSTALLER_PATH = Join-Path $env:Agent_TempDirectory "install-vsix.cmd" +Write-Host ("##vso[task.setvariable variable=INSTALLER_PATH;]$INSTALLER_PATH") # "Downloading extension from marketplace..." | Write-Host -ForegroundColor White @@ -40,33 +43,23 @@ $FilePath = "${env:Temp}\$Name" Invoke-WebRequest -Uri $Url -OutFile $FilePath -$ArgumentList = ('/quiet', $FilePath) +# $ArgumentList = ('/quiet /a', $FilePath) +# install on normal process Write-Host "Starting Install $Name..." -$process = Start-Process -FilePath 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VSIXInstaller.exe' -ArgumentList $ArgumentList -Wait -PassThru -NoNewWindow -$exitCode = $process.ExitCode - -if ($exitCode -eq 0 -or $exitCode -eq 3010) -{ - Write-Host -Object 'Installation successful' - return $exitCode -} -else -{ - Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." - return $exitCode -} - -# install on process with timeout +Start-Process -FilePath 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VSIXInstaller.exe' -ArgumentList " /skuName:Enterprise /skuVersion:15.0 /quiet /a $FilePath" -Wait -PassThru + +# # install on process with timeout # Write-Host "Starting Install $Name..." -# $proc = Start-Process -FilePath 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VSIXInstaller.exe' -ArgumentList $ArgumentList -Wait -PassThru +# $proc = Start-Process -FilePath 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VSIXInstaller.exe' -ArgumentList "/q /a $FilePath" -Wait -PassThru # # keep track of timeout event # $timeouted = $null # reset any previously set timeout # # wait up to 4 minutes (4 * 60 = 240 seconds) for normal termination -# $proc | Wait-Process -Timeout 240 -ErrorAction SilentlyContinue -ErrorVariable timeouted +# Wait-Process -Name "VSIXInstaller" -Timeout 240 -ErrorAction SilentlyContinue -ErrorVariable $timeouted +# # $proc | Wait-Process -Timeout 240 -ErrorAction SilentlyContinue -ErrorVariable timeouted # if ($timeouted) # { @@ -85,6 +78,9 @@ else # ("`"$vsInstallPath\Common7\IDE\VSIXInstaller.exe`" /q $vsixPath" | Out-File $installScript -Encoding ASCII) # # "`"$vsInstallPath\Common7\IDE\VSIXInstaller.exe`" /q /a $vsixPath" | out-file ".\install-vsix.cmd" -Encoding ASCII +# "`"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VSIXInstaller.exe`" /skuName:Enterprise /skuVersion:15.0 /q /a `"$vsixPath`"" | out-file $INSTALLER_PATH -Encoding ASCII +"`"$vsInstallPath\Common7\IDE\VSIXInstaller.exe`" /skuName:Enterprise /skuVersion:15.0 /q `"$vsixPath`"" | out-file $INSTALLER_PATH -Encoding ASCII + # Start-Process -FilePath "$vsInstallPath\Common7\IDE\VSIXInstaller.exe" -ArgumentList "/q $extension" -Wait -PassThru # 'Installing nanoFramework VS extension ...' | Write-Host -ForegroundColor White -NoNewline diff --git a/source/Nuget.nanoFramework.Networking.Sntp.DELIVERABLES/Nuget.nanoFramework.Networking.Sntp.DELIVERABLES.nuproj b/source/Nuget.nanoFramework.Networking.Sntp.DELIVERABLES/Nuget.nanoFramework.Networking.Sntp.DELIVERABLES.nuproj index 040b181..01b5e18 100644 --- a/source/Nuget.nanoFramework.Networking.Sntp.DELIVERABLES/Nuget.nanoFramework.Networking.Sntp.DELIVERABLES.nuproj +++ b/source/Nuget.nanoFramework.Networking.Sntp.DELIVERABLES/Nuget.nanoFramework.Networking.Sntp.DELIVERABLES.nuproj @@ -11,7 +11,7 @@ - 1.0.0-preview001 + 1.0.0-preview001 @@ -50,7 +50,7 @@ nanoFramework.Networking.Sntp.DELIVERABLES - $(GitVersion_NuGetVersionV2) + $(NBGV_NuGetPackageVersion) nanoFramework.Networking.Sntp.DELIVERABLES nanoFramework project contributors nanoFramework project contributors diff --git a/source/Nuget.nanoFramework.Networking.Sntp/Nuget.nanoFramework.Networking.Sntp.nuproj b/source/Nuget.nanoFramework.Networking.Sntp/Nuget.nanoFramework.Networking.Sntp.nuproj index 8a4b1dc..910316e 100644 --- a/source/Nuget.nanoFramework.Networking.Sntp/Nuget.nanoFramework.Networking.Sntp.nuproj +++ b/source/Nuget.nanoFramework.Networking.Sntp/Nuget.nanoFramework.Networking.Sntp.nuproj @@ -11,7 +11,7 @@ - 1.0.0-preview001 + 1.0.0-preview001 @@ -47,7 +47,7 @@ nanoFramework.Networking.Sntp - $(GitVersion_NuGetVersionV2) + $(NBGV_NuGetPackageVersion) nanoFramework.Networking.Sntp nanoFramework project contributors nanoFramework project contributors diff --git a/source/nanoFramework.Networking.Sntp/Properties/AssemblyInfo.cs b/source/nanoFramework.Networking.Sntp/Properties/AssemblyInfo.cs index 5cba5e7..c3a4e9a 100644 --- a/source/nanoFramework.Networking.Sntp/Properties/AssemblyInfo.cs +++ b/source/nanoFramework.Networking.Sntp/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following @@ -14,17 +13,3 @@ // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.1.0")] -[assembly: AssemblyVersion("1.0.1.0")] -[assembly: AssemblyFileVersion("1.0.1.0")] -[assembly: AssemblyInformationalVersion("1.0.1-preview016")] diff --git a/source/nanoFramework.Networking.Sntp/nanoFramework.Networking.Sntp.nfproj b/source/nanoFramework.Networking.Sntp/nanoFramework.Networking.Sntp.nfproj index 240f803..b0a28e5 100644 --- a/source/nanoFramework.Networking.Sntp/nanoFramework.Networking.Sntp.nfproj +++ b/source/nanoFramework.Networking.Sntp/nanoFramework.Networking.Sntp.nfproj @@ -62,9 +62,10 @@ ..\packages\nanoFramework.CoreLibrary.1.0.5-preview024\lib\mscorlib.dll True True - + + diff --git a/source/nanoFramework.Networking.Sntp/packages.config b/source/nanoFramework.Networking.Sntp/packages.config index 22eb72e..41c1b88 100644 --- a/source/nanoFramework.Networking.Sntp/packages.config +++ b/source/nanoFramework.Networking.Sntp/packages.config @@ -1,6 +1,7 @@  + \ No newline at end of file diff --git a/source/version.json b/source/version.json new file mode 100644 index 0000000..8ad3cda --- /dev/null +++ b/source/version.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", + "version": "1.0.1-preview.{height}", + "nugetPackageVersion": { + "semVer": 2 + }, + "publicReleaseRefSpec": [ + "^refs/heads/master$", + "^refs/heads/v\\d+(?:\\.\\d+)?$" + ], + "cloudBuild": { + "setVersionVariables": true, + "setAllVariables": true, + "buildNumber": { + "enabled": true + } + } +} \ No newline at end of file