This commit is contained in:
nfbot 2018-11-28 00:14:04 +00:00 коммит произвёл José Simões
Родитель 4f3c6ae881
Коммит 1fa7459ba8
9 изменённых файлов: 62 добавлений и 393 удалений

Просмотреть файл

@ -13,7 +13,7 @@
| Component | Build Status | NuGet Package |
|:-|---|---|
| nanoFramework.Devices.OneWire | [![Build status](https://ci.appveyor.com/api/projects/status/9vnpnwek2jo385q2/branch/master?svg=true)](https://ci.appveyor.com/project/nfbot/lib-nanoframework-devices-onewire/branch/master) | [![NuGet](https://img.shields.io/nuget/v/nanoFramework.Devices.OneWire.svg)](https://www.nuget.org/packages/nanoFramework.Devices.OneWire/) |
| nanoFramework.Devices.OneWire (preview) | [![Build status](https://ci.appveyor.com/api/projects/status/9vnpnwek2jo385q2/branch/develop?svg=true)](https://ci.appveyor.com/project/nfbot/lib-nanoframework-devices-onewire/branch/develop) | [![MyGet Pre Release](https://img.shields.io/myget/nanoframework-dev/vpre/nanoFramework.Devices.OneWire.svg)](https://www.myget.org/feed/nanoframework-dev/package/nuget/nanoFramework.Devices.OneWire) |
| nanoFramework.Devices.OneWire (preview) | [![Build Status](https://dev.azure.com/nanoframework/nanoFramework.Devices.OneWire/_apis/build/status/nanoframework.lib-nanoFramework.Devices.OneWire)](https://dev.azure.com/nanoframework/nanoFramework.Devices.OneWire/_build/latest?definitionId=15) | [![MyGet Pre Release](https://img.shields.io/myget/nanoframework-dev/vpre/nanoFramework.Devices.OneWire.svg)](https://www.myget.org/feed/nanoframework-dev/package/nuget/nanoFramework.Devices.OneWire) |
## Feedback and documentation

Просмотреть файл

@ -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."

Просмотреть файл

@ -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.Devices.OneWire.sln
.\nbgv cloud -p source -a -c
build_script:
- ps: msbuild source\nanoFramework.Devices.OneWire.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.Devices.OneWire.nuspec -Version %MyNuGetVersion%
- nuget pack source\nanoFramework.Devices.OneWire.DELIVERABLES.nuspec -Version %MyNuGetVersion%
- ps: >-
.\commit-assemblyinfo-changes.ps1
.\generate-change-log.ps1
Push-AppveyorArtifact $env:APPVEYOR_BUILD_FOLDER\nanoFramework.Devices.OneWire.$env:MyNuGetVersion.nupkg
after_deploy:
# for this environment variable to work here it has to be set in AppVeyor UI
- nuget push nanoFramework.Devices.OneWire.%MyNuGetVersion%.nupkg %MyGetToken% -Source https://www.myget.org/F/nanoframework-dev/api/v2/package
- nuget push nanoFramework.Devices.OneWire.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 Devices.OneWire Library v$(MyNuGetVersion)
description: 'Check the [changelog](https://github.com/nanoframework/lib-nanoFramework.Devices.OneWire/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.Devices.OneWire/$(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 Devices.OneWire Library v$(MyNuGetVersion)
description: 'Check the [changelog](https://github.com/nanoframework/lib-nanoFramework.Devices.OneWire/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.Devices.OneWire/$(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 Devices.OneWire Library v$(MyNuGetVersion)
description: 'Check the [changelog](https://github.com/nanoframework/lib-nanoFramework.Devices.OneWire/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.Devices.OneWire/$(MyNuGetVersion)) v$(MyNuGetVersion)'
auth_token:
secure: DNixoFFE+pGlwyhj7McfZoln42vOmj0iY1iNV9zXEr3y0NpXlOIgL8k5ehzlFM1S
artifact:
draft: true
prerelease: true
force_update: true
on:
appveyor_repo_tag: false

59
azure-pipelines.yml Normal file
Просмотреть файл

@ -0,0 +1,59 @@
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'
nugetPackageName: 'nanoFramework.Devices.OneWire'
repoName: 'lib-nanoFramework.Devices.OneWire'
steps:
# step from template @ nf-tools repo
# all build, update and publish steps
- template: azure-pipelines-templates/class-lib-build.yml@templates
parameters:
sourceFileName: 'nf_devices_onewire_native.cpp'
classLibName: 'nanoFramework.Devices.OneWire'
# step from template @ nf-tools repo
# report error
- template: azure-pipelines-templates/discord-webhook-task.yml@templates
parameters:
status: 'failure'
webhookUrl: '$(DiscordWebhook)'
message: ''

Просмотреть файл

@ -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 = "nf_devices_onewire_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/nanoFramework.Devices.OneWire/$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 .. > $null
}
else
{
$commitMessage = "Update nanoFramework.Devices.OneWire 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
}
}

Просмотреть файл

@ -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
}
}

Просмотреть файл

@ -1,9 +0,0 @@
$vsixPath = "$($env:USERPROFILE)\47973986-ed3c-4b64-ba40-a9da73b44ef7-1.0.1.0.vsix"
(New-Object Net.WebClient).DownloadFile('https://www.myget.org/F/nanoframework-dev/vsix/47973986-ed3c-4b64-ba40-a9da73b44ef7-1.0.1.0.vsix', $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

Просмотреть файл

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="NuGet" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="MyGet nanoFramework dev" value="https://www.myget.org/F/nanoframework-dev/api/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>

Просмотреть файл

@ -14,13 +14,6 @@
],
"cloudBuild": {
"setVersionVariables": true,
"setAllVariables": true,
"buildNumber": {
"enabled": true,
"includeCommitId": {
"when": "nonPublicReleaseOnly",
"where": "buildMetadata"
}
}
"setAllVariables": true
}
}