Skip to content

Setup cibuild using AppVeyor #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -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:
8 changes: 8 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@


Closes #{ISSUE_NUMBER}

#### QUALITY CHECKLIST
- [ ] Changes implemented in code
- [ ] Adapted tests
- [ ] Documentation updated
55 changes: 55 additions & 0 deletions Build.ps1
Original file line number Diff line number Diff line change
@@ -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
}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

Plug-n-play implementation of `IResourceRepository<TResource, TId>` 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
Expand Down
44 changes: 44 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -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