From 234445ad6164df0c2b10befcc365637d7747e7e9 Mon Sep 17 00:00:00 2001 From: Bart Koelman Date: Sat, 2 Jan 2021 00:31:14 +0100 Subject: [PATCH 1/3] Setup cibuild using AppVeyor --- .github/ISSUE_TEMPLATE.md | 20 ++++++++++++ .github/PULL_REQUEST_TEMPLATE.md | 8 +++++ Build.ps1 | 55 ++++++++++++++++++++++++++++++++ README.md | 3 ++ appveyor.yml | 44 +++++++++++++++++++++++++ 5 files changed, 130 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 Build.ps1 create mode 100644 appveyor.yml diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..98a5e78 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,20 @@ +#### DESCRIPTION + +_Describe your bug or feature request here._ + +#### STEPS TO REPRODUCE + +_Consider to include your code here, such as models, controllers, resource services, repositories, resource definitions etc._ + +1. +2. +3. + +#### EXPECTED BEHAVIOR + +#### ACTUAL BEHAVIOR + +#### VERSIONS USED +- JsonApiDotNetCore version: +- ASP.NET Core version: +- MongoDB version: diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..0eaf6a9 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,8 @@ + + +Closes #{ISSUE_NUMBER} + +#### QUALITY CHECKLIST +- [ ] Changes implemented in code +- [ ] Adapted tests +- [ ] Documentation updated diff --git a/Build.ps1 b/Build.ps1 new file mode 100644 index 0000000..300180a --- /dev/null +++ b/Build.ps1 @@ -0,0 +1,55 @@ +# Gets the version suffix from the repo tag +# example: v1.0.0-preview1-final => preview1-final +function Get-Version-Suffix-From-Tag { + $tag=$env:APPVEYOR_REPO_TAG_NAME + $split=$tag -split "-" + $suffix=$split[1..2] + $final=$suffix -join "-" + return $final +} + +function CheckLastExitCode { + param ([int[]]$SuccessCodes = @(0), [scriptblock]$CleanupScript=$null) + + if ($SuccessCodes -notcontains $LastExitCode) { + $msg = "EXE RETURNED EXIT CODE $LastExitCode" + throw $msg + } +} + +$revision = @{ $true = $env:APPVEYOR_BUILD_NUMBER; $false = 1 }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL]; +$revision = "{0:D4}" -f [convert]::ToInt32($revision, 10) + +dotnet restore +CheckLastExitCode + +dotnet build -c Release +CheckLastExitCode + +dotnet test -c Release --no-build +CheckLastExitCode + +Write-Output "APPVEYOR_REPO_TAG: $env:APPVEYOR_REPO_TAG" + +if ($env:APPVEYOR_REPO_TAG -eq $true) { + $revision = Get-Version-Suffix-From-Tag + Write-Output "VERSION-SUFFIX: $revision" + + if ([string]::IsNullOrWhitespace($revision)) { + Write-Output "RUNNING dotnet pack .\src\JsonApiDotNetCore.MongoDb -c Release -o .\artifacts" + dotnet pack .\src\JsonApiDotNetCore.MongoDb -c Release -o .\artifacts + CheckLastExitCode + } + else { + Write-Output "RUNNING dotnet pack .\src\JsonApiDotNetCore.MongoDb -c Release -o .\artifacts --version-suffix=$revision" + dotnet pack .\src\JsonApiDotNetCore.MongoDb -c Release -o .\artifacts --version-suffix=$revision + CheckLastExitCode + } +} +else { + $packageVersionSuffix="pre-$revision" + Write-Output "VERSION-SUFFIX: $packageVersionSuffix" + Write-Output "RUNNING dotnet pack .\src\JsonApiDotNetCore.MongoDb -c Release -o .\artifacts --version-suffix=$packageVersionSuffix" + dotnet pack .\src\JsonApiDotNetCore.MongoDb -c Release -o .\artifacts --version-suffix=$packageVersionSuffix + CheckLastExitCode +} diff --git a/README.md b/README.md index 68d3aa3..e0bb283 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,9 @@ Plug-n-play implementation of `IResourceRepository` allowing you to use [MongoDB](https://www.mongodb.com/) with your [JsonApiDotNetCore](https://github.com/json-api-dotnet/JsonApiDotNetCore) APIs. +[![Build status](https://ci.appveyor.com/api/projects/status/dadm2kr2y0353mji/branch/master?svg=true)](https://ci.appveyor.com/project/json-api-dotnet/jsonapidotnetcore-mongodb/branch/master) +[![NuGet](https://img.shields.io/nuget/v/JsonApiDotNetCore.MongoDb.svg)](https://www.nuget.org/packages/JsonApiDotNetCore.MongoDb/) + ## Installation and Usage ```bash diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..742c57e --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,44 @@ +version: '{build}' +os: Visual Studio 2019 + +pull_requests: + do_not_increment_build_number: true + +branches: + only: + - master + - /release\/.+/ + +nuget: + disable_publish_on_pr: true + +services: + - mongodb + +build_script: +- pwsh: dotnet --version +- pwsh: .\Build.ps1 + +test: off + +artifacts: +- path: .\**\artifacts\**\*.nupkg + name: NuGet + +deploy: +- provider: NuGet + name: production + skip_symbols: false + api_key: + secure: ogA5YOVPy9v1Vd623/Jf79dzYlCb5NrXb1e7uHolnyVYTWVz7MporZ+KTVFpAQci + on: + branch: master + appveyor_repo_tag: true + +- provider: NuGet + skip_symbols: false + api_key: + secure: ogA5YOVPy9v1Vd623/Jf79dzYlCb5NrXb1e7uHolnyVYTWVz7MporZ+KTVFpAQci + on: + branch: /release\/.+/ + appveyor_repo_tag: true From 651a36dfb6cfb89e2481745d10e7ea16cc4ee748 Mon Sep 17 00:00:00 2001 From: Bart Koelman Date: Sat, 2 Jan 2021 00:36:51 +0100 Subject: [PATCH 2/3] test to break the build --- src/JsonApiDotNetCore.MongoDb/MongoDbRepository.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/JsonApiDotNetCore.MongoDb/MongoDbRepository.cs b/src/JsonApiDotNetCore.MongoDb/MongoDbRepository.cs index bcbbfd2..d9dff20 100644 --- a/src/JsonApiDotNetCore.MongoDb/MongoDbRepository.cs +++ b/src/JsonApiDotNetCore.MongoDb/MongoDbRepository.cs @@ -16,6 +16,8 @@ namespace JsonApiDotNetCore.MongoDb { +... trying to break the build and see cibuild fail... + /// /// Implements the foundational Repository layer in the JsonApiDotNetCore architecture that uses MongoDB. /// From 2309245bab619ba40ff16c401945bb98a86bd66f Mon Sep 17 00:00:00 2001 From: Bart Koelman Date: Sat, 2 Jan 2021 00:40:08 +0100 Subject: [PATCH 3/3] Revert "test to break the build" This reverts commit 651a36dfb6cfb89e2481745d10e7ea16cc4ee748. --- src/JsonApiDotNetCore.MongoDb/MongoDbRepository.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/JsonApiDotNetCore.MongoDb/MongoDbRepository.cs b/src/JsonApiDotNetCore.MongoDb/MongoDbRepository.cs index d9dff20..bcbbfd2 100644 --- a/src/JsonApiDotNetCore.MongoDb/MongoDbRepository.cs +++ b/src/JsonApiDotNetCore.MongoDb/MongoDbRepository.cs @@ -16,8 +16,6 @@ namespace JsonApiDotNetCore.MongoDb { -... trying to break the build and see cibuild fail... - /// /// Implements the foundational Repository layer in the JsonApiDotNetCore architecture that uses MongoDB. ///