Skip to content

Commit 4b327fd

Browse files
author
Bart Koelman
authored
Setup cibuild using AppVeyor (#5)
* Setup cibuild using AppVeyor
1 parent 8314439 commit 4b327fd

File tree

5 files changed

+130
-0
lines changed

5 files changed

+130
-0
lines changed

.github/ISSUE_TEMPLATE.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#### DESCRIPTION
2+
3+
_Describe your bug or feature request here._
4+
5+
#### STEPS TO REPRODUCE
6+
7+
_Consider to include your code here, such as models, controllers, resource services, repositories, resource definitions etc._
8+
9+
1.
10+
2.
11+
3.
12+
13+
#### EXPECTED BEHAVIOR
14+
15+
#### ACTUAL BEHAVIOR
16+
17+
#### VERSIONS USED
18+
- JsonApiDotNetCore version:
19+
- ASP.NET Core version:
20+
- MongoDB version:

.github/PULL_REQUEST_TEMPLATE.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
3+
Closes #{ISSUE_NUMBER}
4+
5+
#### QUALITY CHECKLIST
6+
- [ ] Changes implemented in code
7+
- [ ] Adapted tests
8+
- [ ] Documentation updated

Build.ps1

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Gets the version suffix from the repo tag
2+
# example: v1.0.0-preview1-final => preview1-final
3+
function Get-Version-Suffix-From-Tag {
4+
$tag=$env:APPVEYOR_REPO_TAG_NAME
5+
$split=$tag -split "-"
6+
$suffix=$split[1..2]
7+
$final=$suffix -join "-"
8+
return $final
9+
}
10+
11+
function CheckLastExitCode {
12+
param ([int[]]$SuccessCodes = @(0), [scriptblock]$CleanupScript=$null)
13+
14+
if ($SuccessCodes -notcontains $LastExitCode) {
15+
$msg = "EXE RETURNED EXIT CODE $LastExitCode"
16+
throw $msg
17+
}
18+
}
19+
20+
$revision = @{ $true = $env:APPVEYOR_BUILD_NUMBER; $false = 1 }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
21+
$revision = "{0:D4}" -f [convert]::ToInt32($revision, 10)
22+
23+
dotnet restore
24+
CheckLastExitCode
25+
26+
dotnet build -c Release
27+
CheckLastExitCode
28+
29+
dotnet test -c Release --no-build
30+
CheckLastExitCode
31+
32+
Write-Output "APPVEYOR_REPO_TAG: $env:APPVEYOR_REPO_TAG"
33+
34+
if ($env:APPVEYOR_REPO_TAG -eq $true) {
35+
$revision = Get-Version-Suffix-From-Tag
36+
Write-Output "VERSION-SUFFIX: $revision"
37+
38+
if ([string]::IsNullOrWhitespace($revision)) {
39+
Write-Output "RUNNING dotnet pack .\src\JsonApiDotNetCore.MongoDb -c Release -o .\artifacts"
40+
dotnet pack .\src\JsonApiDotNetCore.MongoDb -c Release -o .\artifacts
41+
CheckLastExitCode
42+
}
43+
else {
44+
Write-Output "RUNNING dotnet pack .\src\JsonApiDotNetCore.MongoDb -c Release -o .\artifacts --version-suffix=$revision"
45+
dotnet pack .\src\JsonApiDotNetCore.MongoDb -c Release -o .\artifacts --version-suffix=$revision
46+
CheckLastExitCode
47+
}
48+
}
49+
else {
50+
$packageVersionSuffix="pre-$revision"
51+
Write-Output "VERSION-SUFFIX: $packageVersionSuffix"
52+
Write-Output "RUNNING dotnet pack .\src\JsonApiDotNetCore.MongoDb -c Release -o .\artifacts --version-suffix=$packageVersionSuffix"
53+
dotnet pack .\src\JsonApiDotNetCore.MongoDb -c Release -o .\artifacts --version-suffix=$packageVersionSuffix
54+
CheckLastExitCode
55+
}

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
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.
44

5+
[![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)
6+
[![NuGet](https://img.shields.io/nuget/v/JsonApiDotNetCore.MongoDb.svg)](https://www.nuget.org/packages/JsonApiDotNetCore.MongoDb/)
7+
58
## Installation and Usage
69

710
```bash

appveyor.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
version: '{build}'
2+
os: Visual Studio 2019
3+
4+
pull_requests:
5+
do_not_increment_build_number: true
6+
7+
branches:
8+
only:
9+
- master
10+
- /release\/.+/
11+
12+
nuget:
13+
disable_publish_on_pr: true
14+
15+
services:
16+
- mongodb
17+
18+
build_script:
19+
- pwsh: dotnet --version
20+
- pwsh: .\Build.ps1
21+
22+
test: off
23+
24+
artifacts:
25+
- path: .\**\artifacts\**\*.nupkg
26+
name: NuGet
27+
28+
deploy:
29+
- provider: NuGet
30+
name: production
31+
skip_symbols: false
32+
api_key:
33+
secure: ogA5YOVPy9v1Vd623/Jf79dzYlCb5NrXb1e7uHolnyVYTWVz7MporZ+KTVFpAQci
34+
on:
35+
branch: master
36+
appveyor_repo_tag: true
37+
38+
- provider: NuGet
39+
skip_symbols: false
40+
api_key:
41+
secure: ogA5YOVPy9v1Vd623/Jf79dzYlCb5NrXb1e7uHolnyVYTWVz7MporZ+KTVFpAQci
42+
on:
43+
branch: /release\/.+/
44+
appveyor_repo_tag: true

0 commit comments

Comments
 (0)