Skip to content

Commit

Permalink
Adding json validation build (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
soninaren authored Jan 2, 2019
1 parent dc913df commit 8bb1e2a
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
13 changes: 13 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 1.0.3.{build}
pull_requests:
do_not_increment_build_number: true
branches:
only:
- dev
- master
- v2.x
max_jobs: 1
image: Visual Studio 2017
build_script:
- ps: >-
.\build.ps1
34 changes: 34 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
$ErrorActionPreference = "Stop"

function LogOperationStart($message) {
Write-Host $message -NoNewline
}

function LogSuccess() {
Write-Host -ForegroundColor Green "...Done"
}

function LogErrorAndExit($errorMessage, $exception) {
Write-Host -ForegroundColor Red "...Failed"
Write-Host $errorMessage -ForegroundColor Red
if ($exception -ne $null) {
Write-Host $exception -ForegroundColor Red | format-list -force
}
Exit
}

Function validateFeedJson()
{
try {
$file = Get-Content ".\cli-feed-v3.json" -Raw
$jsonObj = ConvertFrom-Json $file
} catch {
LogErrorAndExit "The feed content is not valid JSON" $_.Exception
}
}

# start tests

LogOperationStart "Checking if the feed content is valid json"
validateFeedJson
LogSuccess

0 comments on commit 8bb1e2a

Please sign in to comment.