Skip to content

Commit

Permalink
Adds Build.ps1 and appveyor.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisrichards committed Dec 14, 2016
1 parent b8697c7 commit 659e6ed
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -232,3 +232,5 @@ _Pvt_Extensions

# FAKE - F# Make
.fake/

.artifacts/
62 changes: 62 additions & 0 deletions Build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<#
.SYNOPSIS
You can add this to you build script to ensure that psbuild is available before calling
Invoke-MSBuild. If psbuild is not available locally it will be downloaded automatically.
#>
function EnsurePsbuildInstalled{
[cmdletbinding()]
param(
[string]$psbuildInstallUri = 'https://raw.githubusercontent.com/ligershark/psbuild/master/src/GetPSBuild.ps1'
)
process{
if(-not (Get-Command "Invoke-MsBuild" -errorAction SilentlyContinue)){
'Installing psbuild from [{0}]' -f $psbuildInstallUri | Write-Verbose
(new-object Net.WebClient).DownloadString($psbuildInstallUri) | iex
}
else{
'psbuild already loaded, skipping download' | Write-Verbose
}

# make sure it's loaded and throw if not
if(-not (Get-Command "Invoke-MsBuild" -errorAction SilentlyContinue)){
throw ('Unable to install/load psbuild from [{0}]' -f $psbuildInstallUri)
}
}
}

# Taken from psake https://github.com/psake/psake

<#
.SYNOPSIS
This is a helper function that runs a scriptblock and checks the PS variable $lastexitcode
to see if an error occcured. If an error is detected then an exception is thrown.
This function allows you to run command-line programs without having to
explicitly check the $lastexitcode variable.
.EXAMPLE
exec { svn info $repository_trunk } "Error executing SVN. Please verify SVN command-line client is installed"
#>
function Exec
{
[CmdletBinding()]
param(
[Parameter(Position=0,Mandatory=1)][scriptblock]$cmd,
[Parameter(Position=1,Mandatory=0)][string]$errorMessage = ($msgs.error_bad_command -f $cmd)
)
& $cmd
if ($lastexitcode -ne 0) {
throw ("Exec: " + $errorMessage)
}
}

if(Test-Path .\artifacts) { Remove-Item .\artifacts -Force -Recurse }

EnsurePsbuildInstalled

exec { & dotnet restore }

$revision = @{ $true = $env:APPVEYOR_BUILD_NUMBER; $false = 1 }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
$revision = "{0:D}" -f [convert]::ToInt32($revision, 10)

exec { & dotnet publish -c Release -r win10-x64 -o .\artifacts/win10-x64 --version-suffix=$revision }
exec { & dotnet publish -c Release -r osx.10.10-x64 -o .\artifacts/osx.10.10-x64 --version-suffix=$revision }
exec { & dotnet publish -c Release -r ubuntu.14.04-x64 -o .\artifacts/ubuntu.14.04-x64 --version-suffix=$revision }
29 changes: 29 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: '{build}'
pull_requests:
do_not_increment_build_number: true
branches:
only:
- master
nuget:
disable_publish_on_pr: true
build_script:
- ps: .\Build.ps1
test: off
artifacts:
- path: .\artifacts\win10-x64
name: dbf-win10-x64
- path: .\artifacts\osx.10.10-x64
name: dbf-osx.10.10-x64
- path: .\artifacts\ubuntu.14.04-x64
name: dbf-ubuntu.14.04-x64
deploy:
description: 'Release description'
provider: GitHub
auth_token:
secure: zIuIoM6+3Bc95kSVegG4Lwls01vu+J5OlwOFG2CSaB2YLNdYsTtNqJVnWrnIXMBl
artifact: artifacts\dbf-win10-x64.zip,artifacts\dbf-osx.10.10-x64.zip,artifacts\dbf-ubuntu.14.04-x64.zip
draft: false
prerelease: false
on:
branch: master
appveyor_repo_tag: true
11 changes: 5 additions & 6 deletions project.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.1.0"
},
"CommandLineParser": "2.1.1-beta",
Expand All @@ -34,9 +33,9 @@
"tooling": {
"defaultNamespace": "Dbf"
},
// "runtimes": {
// "win10-x64": {},
// "osx.10.10-x64": {},
// "ubuntu.14.04-x64": {}
// }
"runtimes": {
"win10-x64": {},
"osx.10.10-x64": {},
"ubuntu.14.04-x64": {}
}
}

0 comments on commit 659e6ed

Please sign in to comment.