Skip to content

Commit

Permalink
CI: Ensuring deploy and release mode works
Browse files Browse the repository at this point in the history
This is a combination of 11 commits.
CI: Multiple minor fixes to release scripts
CI: Fix bad string interpolation
CI: Relative path required by artifact uploader
CI: fix missing function in tag script
CI: shots in the dark
So dark
CI: redirect git push stderr to stdout
CI: shots in the dark
CI: try not setting ErrorActionPreference
CI: stupid mistake
CI: Eliminate Release build from test matrix to simplify deploy process
Original hash: 5d8a9d3
  • Loading branch information
atruskie committed May 17, 2017
1 parent f2e27f8 commit dc0c70f
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 24 deletions.
42 changes: 27 additions & 15 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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):[email protected]`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
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions package.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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()]
Expand All @@ -27,7 +27,7 @@ function Check-Command($cmdname)
}


if (!(Check-Command 7za)) {
if (!(Check-Command 7z)) {
throw "Cannot find needed executable dependencies";
}

Expand All @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions release.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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()]
Expand All @@ -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' }
Expand Down
18 changes: 16 additions & 2 deletions tag.ps1
Original file line number Diff line number Diff line change
@@ -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
}
}



Expand All @@ -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

0 comments on commit dc0c70f

Please sign in to comment.