2019-02-15 20:51:48 -05:00
|
|
|
# Include the API access functions
|
|
|
|
. .\API-Functions.ps1
|
2019-02-14 13:56:46 -05:00
|
|
|
|
|
|
|
function collectAsm {
|
|
|
|
# Create branch to merge asm into
|
|
|
|
# $asmFinalBranch = asm/$env:APPVEYOR_REPO_COMMIT/final
|
|
|
|
# git pull
|
|
|
|
# git checkout $env:APPVEYOR_REPO_BRANCH
|
|
|
|
# git checkout -b $asmFinalBranch
|
|
|
|
|
|
|
|
#collect all branches to merge
|
|
|
|
$asmBranches = @()
|
2019-02-15 14:36:40 -05:00
|
|
|
(Get-AppVeyorBuild).build.jobs | Foreach-Object {
|
|
|
|
$branchName = "asm/$($env:APPVEYOR_REPO_COMMIT)/appveyor-$($_.jobId)"
|
|
|
|
|
|
|
|
#Check that all branches exist
|
|
|
|
git ls-remote --heads --exit-code https://github.com/dadonenf/GSL.git $branchName
|
|
|
|
if(-not $?){
|
|
|
|
throw "Missing branch for job $($_.jobId)"
|
|
|
|
}
|
|
|
|
|
2019-02-15 16:10:34 -05:00
|
|
|
git checkout $branchName 2>&1
|
|
|
|
|
2019-02-15 16:20:30 -05:00
|
|
|
#Add branch to the branch list
|
|
|
|
# $branchName = "origin/"+$branchName
|
2019-02-15 14:36:40 -05:00
|
|
|
$asmBranches += $branchName
|
|
|
|
}
|
|
|
|
|
2019-02-14 13:56:46 -05:00
|
|
|
#TODO: collect asm from travis
|
|
|
|
# $travisBuild = Get-TravisBuild
|
|
|
|
# $travisJobs = @()
|
|
|
|
# $travisBuild.jobs | Foreach-Object { $travisJobs += $_.id }
|
|
|
|
|
|
|
|
#Merge all branches into master
|
|
|
|
$branchString = $asmBranches -join ' '
|
2019-02-15 20:40:12 -05:00
|
|
|
git checkout master 2>&1
|
2019-02-14 18:35:22 -05:00
|
|
|
git pull
|
2019-02-15 19:12:47 -05:00
|
|
|
git fetch --all
|
2019-02-14 18:48:27 -05:00
|
|
|
git branch -a
|
2019-02-15 14:36:40 -05:00
|
|
|
Write-Host "git merge --squash $($branchString)"
|
2019-02-14 13:56:46 -05:00
|
|
|
git merge --squash $branchString
|
2019-02-14 18:48:27 -05:00
|
|
|
if(-not $?){
|
|
|
|
throw "Failed merge"
|
|
|
|
}
|
2019-02-14 13:56:46 -05:00
|
|
|
git diff-index --cached --quiet --exit-code HEAD
|
|
|
|
if(-not $?) {
|
|
|
|
git commit -m "[skip ci] Update ASM for $($env:APPVEYOR_REPO_COMMIT)"
|
|
|
|
git push
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-14 17:46:00 -05:00
|
|
|
Write-Host "Starting asm deployment"
|
|
|
|
|
2019-02-14 13:56:46 -05:00
|
|
|
# Wait for all jobs
|
|
|
|
if(appveyorFinished) {
|
2019-02-14 17:46:00 -05:00
|
|
|
|
|
|
|
Write-Host "Appveyor Finished, collecting ASM"
|
|
|
|
|
2019-02-14 13:56:46 -05:00
|
|
|
# Collect ASM (currently from Appveyor only)
|
|
|
|
collectAsm
|
|
|
|
}
|