Skip to content

Commit

Permalink
Work CD-CI
Browse files Browse the repository at this point in the history
- Remove nuproj projects and replace with plain nuspec files.
- Update AppVeyor yaml accordingly.
- Replace gitversion with Nerdbank.GitVersioning.
- Rework update dependencies PS to update nuspec instead of nuproj.

Signed-off-by: José Simões <[email protected]>
  • Loading branch information
josesimoes committed Nov 7, 2018
1 parent a64ed55 commit 740e72c
Show file tree
Hide file tree
Showing 15 changed files with 163 additions and 206 deletions.
38 changes: 0 additions & 38 deletions GitVersion.yml

This file was deleted.

69 changes: 37 additions & 32 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ skip_commits:
- 'LICENSE'
- dir/*
- '.gitignore'
- 'azure-pipelines.yml'

build:
verbosity: minimal
Expand Down Expand Up @@ -44,38 +45,44 @@ init:
- ps: "if($env:APPVEYOR_PULL_REQUEST_NUMBER -eq \"\")\n{\n \n if($env:APPVEYOR_REPO_COMMIT_AUTHOR -eq \"nfbot\" -and $env:APPVEYOR_REPO_COMMIT_MESSAGE_EXTENDED -like \"*[version update]*\")\n {\n # commit was from nfbot AND it's taged as a [version update]\n # OK to skip AppVeyor build \n \"Version update only. Skipping build.\" | Write-Host -BackgroundColor White -ForegroundColor Blue\n Exit-AppveyorBuild\n }\n}"

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
# 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
- ps: .\install-vsix-appveyor.ps1

build_script:
- ps: >-
msbuild source\nanoFramework.CoreLibrary.sln /p:Configuration=Release /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
- 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 restore source\nanoFramework.CoreLibrary.sln
dotnet-gitversion /l console /output buildserver /updateAssemblyInfo "source\nanoFramework.CoreLibrary\System\AssemblyInfo2.cs"
.\nbgv cloud -p source -a -c
after_deploy:
# for this environment variable to work here it has to be set in AppVeyor UI
- nuget push source\Nuget.CoreLibrary\bin\Release\nanoFramework.CoreLibrary.%GitVersion_NuGetVersionV2%.nupkg %MyGetToken% -Source https://www.myget.org/F/nanoframework-dev/api/v2/package
- nuget push source\Nuget.CoreLibrary.DELIVERABLES\bin\Release\nanoFramework.CoreLibrary.DELIVERABLES.%GitVersion_NuGetVersionV2%.nupkg %MyGetToken% -Source https://www.myget.org/F/nanoframework-dev/api/v2/package
build_script:
- ps: msbuild source\nanoFramework.CoreLibrary.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.CoreLibrary.nuspec -Version %MyNuGetVersion%
- nuget pack source\nanoFramework.CoreLibrary.DELIVERABLES.nuspec -Version %MyNuGetVersion%
- ps: >-
.\commit-assemblyinfo-changes.ps1
.\generate-change-log.ps1
Push-AppveyorArtifact $env:APPVEYOR_BUILD_FOLDER\source\Nuget.CoreLibrary\bin\Release\nanoFramework.CoreLibrary.$env:GitVersion_NuGetVersionV2.nupkg
Push-AppveyorArtifact $env:APPVEYOR_BUILD_FOLDER\nanoFramework.CoreLibrary.$env:MyNuGetVersion.nupkg
after_deploy:
# for this environment variable to work here it has to be set in AppVeyor UI
- nuget push nanoFramework.CoreLibrary.%MyNuGetVersion%.nupkg %MyGetToken% -Source https://www.myget.org/F/nanoframework-dev/api/v2/package
- nuget push nanoFramework.CoreLibrary.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:
Expand All @@ -88,8 +95,6 @@ on_success:

cache:
- source\packages -> **source\packages.config
- C:\ProgramData\chocolatey\bin -> appveyor.yml
- C:\ProgramData\chocolatey\lib -> appveyor.yml

################################################
# override configuration for specific branches
Expand All @@ -99,7 +104,7 @@ for:
branches:
only:
- master
- /v.*/
- /v\d.*/

deploy:
- provider: NuGet
Expand All @@ -108,9 +113,9 @@ for:
on:
appveyor_repo_tag: true
- provider: GitHub
tag: v$(GitVersion_NuGetVersionV2)
release: nanoFramework Base Class Library v$(GitVersion_NuGetVersionV2)
description: 'Check the [changelog](https://github.com/nanoframework/lib-CoreLibrary/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.CoreLibrary/$(GitVersion_NuGetVersionV2)) v$(GitVersion_NuGetVersionV2)'
tag: v$(MyNuGetVersion)
release: nanoFramework Base Class Library v$(MyNuGetVersion)
description: 'Check the [changelog](https://github.com/nanoframework/lib-CoreLibrary/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.CoreLibrary/$(MyNuGetVersion)) v$(MyNuGetVersion)'
auth_token:
secure: DNixoFFE+pGlwyhj7McfZoln42vOmj0iY1iNV9zXEr3y0NpXlOIgL8k5ehzlFM1S
artifact:
Expand All @@ -123,16 +128,16 @@ for:
-
branches:
only:
- /dev.*/
- /dev(elop)?$/

deploy:
- provider: GitHub
tag: v$(GitVersion_NuGetVersionV2)
release: nanoFramework Core Library v$(GitVersion_NuGetVersionV2)
description: 'Check the [changelog](https://github.com/nanoframework/lib-CoreLibrary/blob/develop/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.CoreLibrary/$(GitVersion_NuGetVersionV2)) v$(GitVersion_NuGetVersionV2)'
tag: v$(MyNuGetVersion)
release: nanoFramework Core Library v$(MyNuGetVersion)
description: 'Check the [changelog](https://github.com/nanoframework/lib-CoreLibrary/blob/develop/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.CoreLibrary/$(MyNuGetVersion)) v$(MyNuGetVersion)'
auth_token:
secure: DNixoFFE+pGlwyhj7McfZoln42vOmj0iY1iNV9zXEr3y0NpXlOIgL8k5ehzlFM1S
artifact: source\Nuget.CoreLibrary\bin\Release\nanoFramework.CoreLibrary.$(GitVersion_NuGetVersionV2).nupkg
artifact: source\Nuget.CoreLibrary\bin\Release\nanoFramework.CoreLibrary.$(MyNuGetVersion).nupkg
draft: true
prerelease: true
force_update: true
Expand All @@ -151,9 +156,9 @@ for:
on:
appveyor_repo_tag: true
- provider: GitHub
tag: v$(GitVersion_NuGetVersionV2)
release: nanoFramework Core Library v$(GitVersion_NuGetVersionV2)
description: 'Check the [changelog](https://github.com/nanoframework/lib-CoreLibrary/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.CoreLibrary/$(GitVersion_NuGetVersionV2)) v$(GitVersion_NuGetVersionV2)'
tag: v$(MyNuGetVersion)
release: nanoFramework Core Library v$(MyNuGetVersion)
description: 'Check the [changelog](https://github.com/nanoframework/lib-CoreLibrary/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.CoreLibrary/$(MyNuGetVersion)) v$(MyNuGetVersion)'
auth_token:
secure: DNixoFFE+pGlwyhj7McfZoln42vOmj0iY1iNV9zXEr3y0NpXlOIgL8k5ehzlFM1S
artifact:
Expand Down
22 changes: 3 additions & 19 deletions commit-assemblyinfo-changes.ps1
Original file line number Diff line number Diff line change
@@ -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 as this is not a tag build...' | Write-Host -ForegroundColor White
}
else
{
# updated assembly info files
git add "source\nanoFramework.CoreLibrary\System\AssemblyInfo2.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")
{
Expand All @@ -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.CorLib/$env:GitVersion_NuGetVersionV2"
$newBranch = "$env:APPVEYOR_REPO_BRANCH-nfbot/update-version/nanoFramework.CorLib/$env:MyNuGetVersion"

# create branch to perform updates
git checkout -b "$newBranch" develop -q

# replace version in assembly declaration
$newVersion = $env:GitVersion_AssemblySemFileVer -replace "\." , ", "
$newVersion = $env:NBGV_AssemblyFileVersion -replace "\." , ", "
$newVersion = "{ $newVersion }"

$versionRegex = "\{\s*\d+\,\s*\d+\,\s*\d+\,\s*\d+\s*}"
Expand All @@ -56,7 +40,7 @@ if ($env:APPVEYOR_REPO_TAG -eq "true")
}
else
{
$commitMessage = "Update nanoFramework.CorLib version to $env:GitVersion_NuGetVersionV2"
$commitMessage = "Update nanoFramework.CorLib version to $env:MyNuGetVersion"

# commit changes
git add -A 2>&1
Expand Down
16 changes: 11 additions & 5 deletions generate-change-log.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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_Version"
}
else
{
Expand All @@ -23,8 +23,14 @@ else
bundle exec github_changelog_generator --token $env:GitHubToken
}

# updated changelog and the updated assembly info files
git add CHANGELOG.md
git commit -m "Update CHANGELOG for v$env:GitVersion_NuGetVersionV2"
git push origin --porcelain -q > $null
# 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 --porcelain | Write-Host
}
}

This file was deleted.

2 changes: 1 addition & 1 deletion source/Nuget.CoreLibrary/Nuget.CoreLibrary.nuproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<Import Project="$(NuProjPath)\NuProj.props" Condition="Exists('$(NuProjPath)\NuProj.props')" />
<PropertyGroup Label="Configuration">
<Id>nanoFramework.CoreLibrary</Id>
<Version>$(GitVersion_NuGetVersionV2)</Version>
<Version>1.0.5-preview024</Version>
<Title>nanoFramework.CoreLibrary</Title>
<Authors>nanoFramework project contributors</Authors>
<Owners>nanoFramework project contributors</Owners>
Expand Down
27 changes: 27 additions & 0 deletions source/nanoFramework.CoreLibrary.DELIVERABLES.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>nanoFramework.CoreLibrary.DELIVERABLES</id>
<version>$version$</version>
<title>nanoFramework.CoreLibrary.DELIVERABLES</title>
<authors>nanoFramework project contributors</authors>
<owners>nanoFramework project contributors</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<releaseNotes></releaseNotes>
<developmentDependency>false</developmentDependency>
<projectUrl>https://github.com/nanoframework/lib-CoreLibrary</projectUrl>
<iconUrl>https://secure.gravatar.com/avatar/97d0e092247f0716db6d4b47b7d1d1ad</iconUrl>
<copyright>Copyright (c) 2018 The nanoFramework project contributors</copyright>
<description>** DON'T REFERENCE THIS PACKAGE ** Not meant for development. This package includes the deliverable artifacts of the base class library (mscorlib) of nanoFramework. These are for testing purposes and for updating the native code base of the core library.</description>
<summary>nanoFramework.CoreLibrary.DELIVERABLES is not meant for development</summary>
<tags></tags>
</metadata>
<files>
<file src="nanoFramework.CoreLibrary\bin\Release\Stubs\*.*" target="content\Stubs\" />
<file src="nanoFramework.CoreLibrary\obj\Release\*.txt" target="content\txt\" />
<file src="nanoFramework.CoreLibrary\obj\Release\*.dump" target="content\dump\" />
<file src="nanoFramework.CoreLibrary\obj\Release\*.strings" target="content\dump\" />
<file src="nanoFramework.CoreLibrary\obj\Release\*.resources" target="content\resources\" />
<file src="nanoFramework.CoreLibrary\obj\Release\*.il" target="content\disasm\" />
</files>
</package>
26 changes: 26 additions & 0 deletions source/nanoFramework.CoreLibrary.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>nanoFramework.CoreLibrary</id>
<version>$version$</version>
<title>nanoFramework.CoreLibrary</title>
<authors>nanoFramework project contributors</authors>
<owners>nanoFramework project contributors</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<releaseNotes></releaseNotes>
<developmentDependency>false</developmentDependency>
<projectUrl>https://github.com/nanoframework/lib-CoreLibrary</projectUrl>
<iconUrl>https://secure.gravatar.com/avatar/97d0e092247f0716db6d4b47b7d1d1ad</iconUrl>
<copyright>Copyright (c) 2018 The nanoFramework project contributors</copyright>
<description>This package includes the nanoFramework.CoreLibrary assembly for nanoFramework C# projects.</description>
<summary>This package includes the nanoFramework.CoreLibrary assembly for nanoFramework C# projects.</summary>
<tags>nanoFramework C# csharp netmf netnf nanoFramework.CoreLibrary</tags>
</metadata>
<files>
<file src="nanoFramework.CoreLibrary\bin\Release\mscorlib.dll" target="lib\mscorlib.dll" />
<file src="nanoFramework.CoreLibrary\bin\Release\mscorlib.pdb" target="lib\mscorlib.pdb" />
<file src="nanoFramework.CoreLibrary\bin\Release\mscorlib.pdbx" target="lib\mscorlib.pdbx" />
<file src="nanoFramework.CoreLibrary\bin\Release\mscorlib.pe" target="lib\mscorlib.pe" />
<file src="nanoFramework.CoreLibrary\bin\Release\mscorlib.xml" target="lib\mscorlib.xml" />
</files>
</package>
Loading

0 comments on commit 740e72c

Please sign in to comment.