diff --git a/appveyor.yml b/appveyor.yml index 7bbf1e546..99f346a98 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -28,9 +28,6 @@ matrix: platform: - Any CPU -configuration: - - Debug - - Release # Attempt to limit the number of commits to clone - our project has a LOT of history # TODO: drop this to about ~100 later on @@ -57,29 +54,41 @@ before_build: - nuget restore build_script: + - echo "Building Debug" - ps: > msbuild "C:\projects\audio-analysis\AudioAnalysis\AudioAnalysis2012.sln" /m /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" /p:WarningLevel=0 /p:RunCodeAnalysis=false - /p:Configuration=$env:configuration /property:Platform=$env:platform + /p:Configuration=Debug /property:Platform=$env:platform + - echo "Building Release" + - ps: > + msbuild + "C:\projects\audio-analysis\AudioAnalysis\AudioAnalysis2012.sln" /m /verbosity:minimal + /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" + /p:WarningLevel=0 /p:RunCodeAnalysis=false + /p:Configuration=Release /property:Platform=$env:platform + +after_build: + # package up artifacts + # defined env vars: $env:ApPackage{Configuration} , $env:ApVersion , $env:ApName{Configuration} + - cd %APPVEYOR_BUILD_FOLDER% + - ps: . .\package.ps1 "Debug" + - ps: . .\package.ps1 "Release" + test: assemblies: only: - #- "C:\Work\Github\audio-analysis\Acoustics\Acoustics.Test\bin\Debug\Acoustics.Test.dll" - #- "C:\Work\Github\audio-analysis\AudioAnalysis\AED\Test\bin\Debug\Test.dll" - - '**\Acoustics.Test.dll' - -before_package: - # package up artifacts - # defined env vars: $env:ApPackage , $env:ApVersion , $env:ApName - - ps: . .\package.ps1 $env:configuration + #- "Acoustics\Acoustics.Test\bin\Debug\Acoustics.Test.dll" + - '**bin\Debug\Acoustics.Test.dll' # Upload previously generated artifacts artifacts: - - path: $(ApPackage) - name: $(ApName) + - path: '$(ApPackageDebug)' + name: '$(ApNameDebug)' + - path: '$(ApPackageRelease)' + name: '$(ApNameRelease)' before_deploy: # Enable git credential store @@ -89,6 +98,9 @@ before_deploy: # add our auth token to the cred store - ps: Add-Content "$env:USERPROFILE\.git-credentials" "https://$($env:GH_CREATE_RELEASES_TOKEN):x-oauth-basic@github.com`n" # tag if needed, and output $env:ApTagName + - cd %APPVEYOR_BUILD_FOLDER% + # Buggy authentication with git-lfs + - git config lfs.https://github.com/QutBioacoustics/audio-analysis.git/info/lfs.locksverify false - ps: . .\tag.ps1 $env:ApVersion # prepare release strings: $env:ApReleaseMessage, $env:ApReleaseTitle - ps: . .\release.ps1 $env:ApTagName $true @@ -99,7 +111,7 @@ deploy: release: "$(ApReleaseTitle)" description: "$(ApReleaseMessage)" auth_token: $(GH_CREATE_RELEASES_TOKEN) - artifact: $(ApName) + artifact: $(ApNameDebug),$(ApNameRelease) prerelease: true on: # Do not create new releases unless this is the master branch diff --git a/package.ps1 b/package.ps1 index 87ccb1497..ed89631ee 100644 --- a/package.ps1 +++ b/package.ps1 @@ -5,7 +5,7 @@ # This script has been modified to work with our CI server param($configuration = $null) -$ErrorActionPreference = "Stop" +$ErrorActionPreference = "Continue" function script:exec { [CmdletBinding()] @@ -27,7 +27,7 @@ function Check-Command($cmdname) } -if (!(Check-Command 7za)) { +if (!(Check-Command 7z)) { throw "Cannot find needed executable dependencies"; } @@ -53,14 +53,14 @@ $env:ApVersion = $version echo "Packging files for version $version" $ApName = "$configuration.$version.zip" -$env:ApName = $ApName +Set-Item "env:AppName$Configuration" $ApName # create tar.gz for $environment -exec { 7za.exe a -tzip $ApName "./$configuration/*" -xr0!*log.txt* } +exec { 7z a -tzip $ApName "./$configuration/*" -xr0!*log.txt* } echo "Packing complete" -$env:ApPackage = Join-Path $pwd $ApName +Set-Item "env:ApPackage$Configuration" (Join-Path "AudioAnalysis\AnalysisPrograms\bin" $ApName) } finally { diff --git a/release.ps1 b/release.ps1 index c8e145f41..24487e55d 100644 --- a/release.ps1 +++ b/release.ps1 @@ -5,7 +5,7 @@ # This script has been modified to work with our CI server param($tag_name, [bool]$ci = $false, [bool]$pre_release = $true) -$ErrorActionPreference = "Stop" +$ErrorActionPreference = "Continue" function script:exec { [CmdletBinding()] @@ -32,7 +32,7 @@ if (!$ci -and !(Check-Command hub)) { echo "Creating release message" # we assumed we've already tagged before describing this release -$old_tag_name = exec { git describe --abbrev=0 --always "$tag_name^2" } +$old_tag_name = exec { git describe --abbrev=0 --always "$tag_name^" } $compare_message = "[Compare $old_tag_name...$tag_name](https://github.com/QutBioacoustics/audio-analysis/compare/$old_tag_name...$tag_name)" $commit_summary = exec { git log --no-merges --pretty=format:"%h %an - %s" "$old_tag_name...$tag_name" -- . ':(exclude,icase)*.r' } diff --git a/tag.ps1 b/tag.ps1 index ef6be8b2f..cf08e0636 100644 --- a/tag.ps1 +++ b/tag.ps1 @@ -1,7 +1,21 @@ # This script has been modified to work with our CI server param($version) -$ErrorActionPreference = "Stop" +$ErrorActionPreference = "Continue" + +function script:exec { + [CmdletBinding()] + + param( + [Parameter(Position=0,Mandatory=1)][scriptblock]$cmd, + [Parameter(Position=1,Mandatory=0)][string]$errorMessage = ("Error executing command: {0}" -f $cmd) + ) + & $cmd 2>&1 + if ($lastexitcode -ne 0) + { + throw $errorMessage + } +} @@ -17,4 +31,4 @@ if ($tags -contains $tag_name) { exec { git tag -a -m "Version $tag_name" $tag_name } echo "pushing tags" -exec { git push origin $tag_name} +exec { git push origin $tag_name } 2>&1