diff --git a/README.md b/README.md index d8b2fa6..3c858db 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ | Component | Build Status | NuGet Package | |:-|---|---| | Windows.Devices.Pwm | [![Build status](https://ci.appveyor.com/api/projects/status/3i6mwyv12tlapuyr/branch/master?svg=true)](https://ci.appveyor.com/project/nfbot/lib-windows-devices-pwm/branch/master) | [![NuGet](https://img.shields.io/nuget/v/nanoFramework.Windows.Devices.Pwm.svg)](https://www.nuget.org/packages/nanoFramework.Windows.Devices.Pwm/) | -| Windows.Devices.Pwm (preview) | [![Build status](https://ci.appveyor.com/api/projects/status/3i6mwyv12tlapuyr/branch/develop?svg=true)](https://ci.appveyor.com/project/nfbot/lib-windows-devices-pwm/branch/develop) | [![MyGet Pre Release](https://img.shields.io/myget/nanoframework-dev/vpre/nanoFramework.Windows.Devices.Pwm.svg)](https://www.myget.org/feed/nanoframework-dev/package/nuget/nanoFramework.Windows.Devices.Pwm) | +| Windows.Devices.Pwm (preview) | [![Build Status](https://dev.azure.com/nanoframework/Windows.Devices.Pwm/_apis/build/status/nanoframework.lib-Windows.Devices.Pwm)](https://dev.azure.com/nanoframework/Windows.Devices.Pwm/_build/latest?definitionId=8) | [![MyGet Pre Release](https://img.shields.io/myget/nanoframework-dev/vpre/nanoFramework.Windows.Devices.Pwm.svg)](https://www.myget.org/feed/nanoframework-dev/package/nuget/nanoFramework.Windows.Devices.Pwm) | ## Feedback and documentation diff --git a/appveyor-discord.ps1 b/appveyor-discord.ps1 deleted file mode 100644 index a1ce8b9..0000000 --- a/appveyor-discord.ps1 +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright (c) 2017 The nanoFramework project contributors -# Portions Copyright (c) Sankarsan Kampa (a.k.a. k3rn31p4nic). All rights reserved. -# See LICENSE file in the project root for full license information. - -$STATUS=$args[0] -$WEBHOOK_URL=$args[1] - -Write-Output "[Webhook]: Sending webhook to Discord..." - -Switch ($STATUS) { - "success" { - $EMBED_COLOR=3066993 - $STATUS_MESSAGE="Passed" - Break - } - "failure" { - $EMBED_COLOR=15158332 - $STATUS_MESSAGE="Failed" - Break - } - default { - Write-Output "Default!" - Break - } -} - -if (!$env:APPVEYOR_REPO_COMMIT) { - $env:APPVEYOR_REPO_COMMIT="$(git log -1 --pretty="%H")" -} - -$AUTHOR_NAME="$(git log -1 "$env:APPVEYOR_REPO_COMMIT" --pretty="%aN")" -$COMMITTER_NAME="$(git log -1 "$env:APPVEYOR_REPO_COMMIT" --pretty="%cN")" -$COMMIT_SUBJECT="$(git log -1 "$env:APPVEYOR_REPO_COMMIT" --pretty="%s")" -$COMMIT_MESSAGE="$(git log -1 "$env:APPVEYOR_REPO_COMMIT" --pretty="%b")" - -if ($AUTHOR_NAME -eq $COMMITTER_NAME) { - $CREDITS = "$AUTHOR_NAME authored & committed" -} -else { - $CREDITS = "$AUTHOR_NAME authored & $COMMITTER_NAME committed" -} - -if ($env:APPVEYOR_PULL_REQUEST_NUMBER) { - $URL="https://github.com/$env:APPVEYOR_REPO_NAME/pull/$env:APPVEYOR_PULL_REQUEST_NUMBER" -} -else { - $URL="" -} - -$BUILD_VERSION = [uri]::EscapeDataString($env:APPVEYOR_BUILD_VERSION) - -$WEBHOOK_DATA="{ - ""embeds"": [ { - ""color"": $EMBED_COLOR, - ""author"": { - ""name"": ""Job #$env:APPVEYOR_JOB_NUMBER (Build #$env:APPVEYOR_BUILD_NUMBER) $STATUS_MESSAGE - $env:APPVEYOR_REPO_NAME"", - ""url"": ""https://ci.appveyor.com/project/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/build/$BUILD_VERSION"", - ""icon_url"": ""$AVATAR"" - }, - ""title"": ""$COMMIT_SUBJECT"", - ""url"": ""$URL"", - ""description"": ""$COMMIT_MESSAGE $CREDITS"", - ""fields"": [ - { - ""name"": ""Commit"", - ""value"": ""[``$($env:APPVEYOR_REPO_COMMIT.substring(0, 7))``](https://github.com/$env:APPVEYOR_REPO_NAME/commit/$env:APPVEYOR_REPO_COMMIT)"", - ""inline"": true - }, - { - ""name"": ""Branch/Tag"", - ""value"": ""[``$env:APPVEYOR_REPO_BRANCH``](https://github.com/$env:APPVEYOR_REPO_NAME/tree/$env:APPVEYOR_REPO_BRANCH)"", - ""inline"": true - } - ] - } ], - ""content"" : """", - ""file"": """" -}" - -Invoke-RestMethod -Uri $WEBHOOK_URL -Method POST -UserAgent AppVeyor-Webhook -ContentType 'application/json' -Body $WEBHOOK_DATA - -Write-Output "[Webhook]: Successfully sent the webhook." diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index f6afda5..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,166 +0,0 @@ -# configuration for all branches - -image: Visual Studio 2017 - -skip_tags: false - -skip_branch_with_pr: true - -test: off - -# Skipping commits affecting specific files -skip_commits: - files: - - '**\AssemblyInfo.*' - - '**/*.md' - - 'LICENSE' - - dir/* - - '.gitignore' - - 'azure-pipelines.yml' - -build: - verbosity: minimal - -environment: - APPVEYOR_IGNORE_COMMIT_FILTERING_ON_TAG: true - APPVEYOR_SAVE_CACHE_ON_ERROR: true - matrix: - - RUBY_VERSION: 24 - GitHubUserName: - secure: 7OBtVAMTodMWK20wg6pGnQ== - GitHubUserEmail: - secure: /NpmL1KqwHyHFnF0GlUovA586wDIt8Hg/Q8Dro6kUpk= - GitHubToken: - secure: i/2hGsqVMwzdM5yIS4rxOIeG3ftx7su7klWYN80s/fHvgk7A5H2fF3oUTNLcyTbw - GitRestAuth: - secure: E3bCMe4LtDdAhHSYRcLp0N6DixJe1m8TNxhYeJW/GnqM3WXdRqsgkHSbwootPjJQtOQJrps4twmzTVzofLSVgPgbzU8PxU0AkJV7zwkyVOE= - -init: -- git config --global core.autocrlf true -- git config --global credential.helper store -- ps: Add-Content "$env:USERPROFILE\.git-credentials" "https://$($env:GitHubToken):x-oauth-basic@github.com`n" -- git config --global user.email "%GitHubUserEmail%" -- git config --global user.name "%GitHubUserName%" - -install: -- set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH% -- bundle config --local path vendor/bundle -- gem install bundler --quiet --no-ri --no-rdoc -- gem install github_changelog_generator --quiet --no-ri --no-rdoc -- dotnet tool install --tool-path . nbgv -- ps: .\install-vsix-appveyor.ps1 - -before_build: -- ps: >- - - nuget sources add -name MyGet -Source https://www.myget.org/F/nanoframework-dev - - nuget restore source\nanoFramework.Windows.Devices.Pwm.sln - - .\nbgv cloud -p source -a -c - -build_script: -- ps: msbuild source\nanoFramework.Windows.Devices.Pwm.sln /p:PublicRelease=true /p:Configuration=Release /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" - -before_deploy: - - ps: >- - .\nbgv cloud --version=$env:NBGV_SemVer1 - - $env:MyNuGetVersion = $env:NBGV_NuGetPackageVersion -replace "\-g$env:NBGV_GitCommitIdShort", " " - - .\generate-change-log.ps1 - - - nuget pack source\nanoframework.Windows.Devices.Pwm.nuspec -Version %MyNuGetVersion% - - nuget pack source\nanoframework.Windows.Devices.Pwm.DELIVERABLES.nuspec -Version %MyNuGetVersion% - - ps: >- - .\commit-assemblyinfo-changes.ps1 - - .\generate-change-log.ps1 - - Push-AppveyorArtifact $env:APPVEYOR_BUILD_FOLDER\nanoFramework.Windows.Devices.Pwm.$env:MyNuGetVersion.nupkg - -after_deploy: -# for this environment variable to work here it has to be set in AppVeyor UI -- nuget push nanoFramework.Windows.Devices.Pwm.%MyNuGetVersion%.nupkg %MyGetToken% -Source https://www.myget.org/F/nanoframework-dev/api/v2/package -- nuget push nanoFramework.Windows.Devices.Pwm.DELIVERABLES.%MyNuGetVersion%.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: - - ps: | - - & $env:APPVEYOR_BUILD_FOLDER\appveyor-discord.ps1 failure $env:APPVEYOR_DISCORD_WEBHOOK_URL - -cache: - - source\packages -> **source\packages.config - -################################################ -# override configuration for specific branches -for: - -- - branches: - only: - - master - - /v\d.*/ - - deploy: - - provider: NuGet - api_key: $(NuGetToken) - skip_symbols: true - on: - appveyor_repo_tag: true - - provider: GitHub - tag: v$(MyNuGetVersion) - release: nanoFramework Windows.Devices.Pwm Library v$(MyNuGetVersion) - description: 'Check the [changelog](https://github.com/nanoframework/lib-nanoFramework.Windows.Devices.Pwm/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.Windows.Devices.Pwm/$(MyNuGetVersion)) v$(MyNuGetVersion)' - auth_token: - secure: DNixoFFE+pGlwyhj7McfZoln42vOmj0iY1iNV9zXEr3y0NpXlOIgL8k5ehzlFM1S - artifact: - draft: true - prerelease: false - force_update: true - on: - appveyor_repo_tag: false - -- - branches: - only: - - /dev(elop)?$/ - - deploy: - - provider: GitHub - tag: v$(MyNuGetVersion) - release: nanoFramework Windows.Devices.Pwm Library v$(MyNuGetVersion) - description: 'Check the [changelog](https://github.com/nanoframework/lib-nanoFramework.Windows.Devices.Pwm/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\n:package: [.NET](https://www.myget.org/feed/nanoframework-dev/package/nuget/nanoFramework.Windows.Devices.Pwm/$(MyNuGetVersion)) v$(MyNuGetVersion)' - auth_token: - secure: DNixoFFE+pGlwyhj7McfZoln42vOmj0iY1iNV9zXEr3y0NpXlOIgL8k5ehzlFM1S - artifact: - draft: true - prerelease: true - force_update: true - on: - appveyor_repo_tag: false - -- - branches: - only: - - /release.*/ - - deploy: - - provider: NuGet - api_key: $(NuGetToken) - skip_symbols: true - on: - appveyor_repo_tag: true - - provider: GitHub - tag: v$(MyNuGetVersion) - release: nanoFramework Windows.Devices.Pwm Library v$(MyNuGetVersion) - description: 'Check the [changelog](https://github.com/nanoframework/lib-nanoFramework.Windows.Devices.Pwm/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.Windows.Devices.Pwm/$(MyNuGetVersion)) v$(MyNuGetVersion)' - auth_token: - secure: DNixoFFE+pGlwyhj7McfZoln42vOmj0iY1iNV9zXEr3y0NpXlOIgL8k5ehzlFM1S - artifact: - draft: true - prerelease: true - force_update: true - on: - appveyor_repo_tag: false diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..44cbed6 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,60 @@ +trigger: + branches: + include: + - master + - develop + - release/* + - refs/tags/* + paths: + exclude: + - /*.md + - .gitignore + - appveyor.yml + # waiting for feature to become available + # tags: + # include: + # - v/* + +pr: + branches: + include: + - master + - develop + - release/* + autoCancel: true + +# add nf-tools repo to resources (for Azure Pipelines templates) +resources: + repositories: + - repository: templates + type: github + name: nanoframework/nf-tools + endpoint: nfbot + +pool: + vmImage: 'VS2017-Win2016' + +variables: + solution: '**/source/*.sln' + buildPlatform: 'Any CPU' + buildConfiguration: 'Release' + classLibName: 'Windows.Devices.Adc' + nugetPackageName: 'nanoFramework.Windows.Devices.Pwm' + repoName: 'lib-Windows.Devices.Pwm' + +steps: + +# step from template @ nf-tools repo +# all build, update and publish steps +- template: azure-pipelines-templates/class-lib-build.yml@templates + parameters: + sourceFileName: 'win_dev_pwm_native.cpp' + classLibName: 'Windows.Devices.Pwm' + +# step from template @ nf-tools repo +# report error +- template: azure-pipelines-templates/discord-webhook-task.yml@templates + parameters: + status: 'failure' + webhookUrl: '$(DiscordWebhook)' + message: '' diff --git a/commit-assemblyinfo-changes.ps1 b/commit-assemblyinfo-changes.ps1 deleted file mode 100644 index 09ab9b2..0000000 --- a/commit-assemblyinfo-changes.ps1 +++ /dev/null @@ -1,91 +0,0 @@ -# Copyright (c) 2018 The nanoFramework project contributors -# See LICENSE file in the project root for full license information. - -# update assembly info in nf-interpreter if this is tag -if ($env:APPVEYOR_REPO_TAG -eq "true") -{ - 'Updating assembly version in nf-interpreter...' | Write-Host -ForegroundColor White -NoNewline - - # name of source file with the native declaration - $nativeFile = "win_dev_pwm_native.cpp" - - # find assembly declaration - $assemblyDeclarationPath = (Get-ChildItem -Path ".\*" -Include $nativeFile -Recurse) - $filecontent = Get-Content($assemblyDeclarationPath) - $assemblyChecksum = $filecontent -match '(0x.{8})' - $assemblyChecksum = $assemblyChecksum -replace "," , "" - $assemblyChecksum = $assemblyChecksum -replace " " , "" - - # clone nf-interpreter repo (only a shallow clone with last commit) - git clone https://github.com/nanoframework/nf-interpreter -b develop --depth 1 -q - cd nf-interpreter > $null - - # new branch name - $newBranch = "$env:APPVEYOR_REPO_BRANCH-nfbot/update-version/Windows.Devices.Pwm/$env:MyNuGetVersion" - - # create branch to perform updates - git checkout -b "$newBranch" develop -q - - # replace version in assembly declaration - $newVersion = $env:NBGV_AssemblyFileVersion -replace "\." , ", " - $newVersion = "{ $newVersion }" - - $versionRegex = "\{\s*\d+\,\s*\d+\,\s*\d+\,\s*\d+\s*}" - $assemblyFiles = (Get-ChildItem -Path ".\*" -Include $nativeFile -Recurse) - - foreach($file in $assemblyFiles) - { - # replace checksum - $filecontent = Get-Content($file) - attrib $file -r - $filecontent -replace "0x.{8}", $assemblyChecksum | Out-File $file -Encoding utf8 - - # replace version - $filecontent = Get-Content($file) - attrib $file -r - $filecontent -replace $versionRegex, $newVersion | Out-File $file -Encoding utf8 - } - - # check if anything was changed - $repoStatus = "$(git status --short --porcelain)" - - if ($repoStatus -eq "") - { - # nothing changed - cd .. - } - else - { - $commitMessage = "Update Windows.Devices.Pwm version to $env:MyNuGetVersion" - - # commit changes - git add -A 2>&1 - git commit -m"$commitMessage" -m"[version update]" -q - git push --set-upstream origin "$newBranch" --porcelain -q > $null - - # start PR - $prRequestBody = @{title="$commitMessage";body="$commitMessage`n`nStarted from https://github.com/$env:APPVEYOR_REPO_NAME/commit/$env:APPVEYOR_REPO_COMMIT`n`n[version update]";head="$newBranch";base="develop"} | ConvertTo-Json - $githubApiEndpoint = "https://api.github.com/repos/nanoframework/nf-interpreter/pulls" - [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 - - try - { - $result = Invoke-RestMethod -Method Post -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::InternetExplorer -Uri $githubApiEndpoint -Header @{"Authorization"="Basic $env:GitRestAuth"} -ContentType "application/json" -Body $prRequestBody - 'Started PR with version update...' | Write-Host -ForegroundColor White -NoNewline - 'OK' | Write-Host -ForegroundColor Green - } - catch - { - $result = $_.Exception.Response.GetResponseStream() - $reader = New-Object System.IO.StreamReader($result) - $reader.BaseStream.Position = 0 - $reader.DiscardBufferedData() - $responseBody = $reader.ReadToEnd(); - - "Error starting PR: $responseBody" | Write-Host -ForegroundColor Red - } - - # move back to home folder - & cd .. > $null - } -} diff --git a/generate-change-log.ps1 b/generate-change-log.ps1 deleted file mode 100644 index 7385c27..0000000 --- a/generate-change-log.ps1 +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright (c) 2018 The nanoFramework project contributors -# See LICENSE file in the project root for full license information. - -# skip generating the change log when 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 change log processing...' | Write-Host -ForegroundColor White -} -else -{ - # need this to keep ruby happy - md c:\tmp > $null - - 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:NBGV_Version" - } - else - { - # generate change log - # version includes commits - bundle exec github_changelog_generator --token $env:GitHubToken - } - - # updated changelog, if there are any differences - $logDif = git diff CHANGELOG.md - - if($logDif -ne $null) - { - git add CHANGELOG.md - git commit -m "Update CHANGELOG for v$env:MyNuGetVersion" - # need to wrap the git command bellow so it doesn't throw an error because of redirecting the output to stderr - git push origin "HEAD:$env:APPVEYOR_REPO_BRANCH" --porcelain | Write-Host - } -} diff --git a/install-vsix-appveyor.ps1 b/install-vsix-appveyor.ps1 deleted file mode 100644 index 127c876..0000000 --- a/install-vsix-appveyor.ps1 +++ /dev/null @@ -1,9 +0,0 @@ -$vsixPath = "$($env:USERPROFILE)\nanoFramework.Tools.VS2017.Extension.vsix" -(New-Object Net.WebClient).DownloadFile('https://marketplace.visualstudio.com/_apis/public/gallery/publishers/vs-publisher-1470366/vsextensions/nanoFrameworkVS2017Extension/0/vspackage', $vsixPath) -"`"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VSIXInstaller.exe`" /q /a $vsixPath" | out-file ".\install-vsix.cmd" -Encoding ASCII - -'Installing nanoFramework VS extension ...' | Write-Host -ForegroundColor White -NoNewline - -& .\install-vsix.cmd > $null - -'OK' | Write-Host -ForegroundColor Green diff --git a/source/NuGet.Config b/source/NuGet.Config index efc7d1b..86ceec1 100644 --- a/source/NuGet.Config +++ b/source/NuGet.Config @@ -1,6 +1,7 @@ + diff --git a/source/version.json b/source/version.json index aa621e0..841296b 100644 --- a/source/version.json +++ b/source/version.json @@ -14,13 +14,6 @@ ], "cloudBuild": { "setVersionVariables": true, - "setAllVariables": true, - "buildNumber": { - "enabled": true, - "includeCommitId": { - "when": "nonPublicReleaseOnly", - "where": "buildMetadata" - } - } + "setAllVariables": true } } \ No newline at end of file