mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Replace some CI scripts
They've been refactored as more generic scripts in a separate repository, use the refactored scripts instead. Closes #722.
This commit is contained in:
@@ -1,93 +0,0 @@
|
||||
function Get-HashFromBintrayVersion($version) {
|
||||
return $version.split('-')[2].split('_')[0].substring(1)
|
||||
}
|
||||
|
||||
function Get-BranchFromBintrayVersion($version) {
|
||||
return $version.substring($version.IndexOf('_') + 1)
|
||||
}
|
||||
|
||||
function Get-Branches($versions) {
|
||||
$branches = @()
|
||||
foreach ($version in $versions) {
|
||||
$branches += Get-BranchFromBintrayVersion $version
|
||||
}
|
||||
|
||||
return $branches | select -uniq
|
||||
}
|
||||
|
||||
function Is-Merged($commitId) {
|
||||
$branches = [array](git branch --contains $commitId)
|
||||
|
||||
return ($branches -contains ' dev') -Or ($branches -contains '* dev')
|
||||
}
|
||||
|
||||
function Get-VersionsForBranch($versions, $branch) {
|
||||
$branchVersions = @()
|
||||
foreach ($version in $versions) {
|
||||
$versionBranch = Get-BranchFromBintrayVersion $version
|
||||
if ($versionBranch -eq $branch) {
|
||||
$branchVersions += $version
|
||||
}
|
||||
}
|
||||
return $branchVersions
|
||||
}
|
||||
|
||||
function Get-AuthorizationHeaderValue($username, $password) {
|
||||
$credentials = "$($username):$($password)"
|
||||
return 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes($credentials))
|
||||
}
|
||||
|
||||
$currentBranch = $env:APPVEYOR_REPO_BRANCH
|
||||
$bintrayToken = $env:bintray_auth_token
|
||||
$bintrayRepoUrl = 'https://api.bintray.com/packages/wrinklyninja/loot'
|
||||
$bintrayHeaders = @{ Authorization = (Get-AuthorizationHeaderValue 'wrinklyninja' $bintrayToken) }
|
||||
$packages = @(
|
||||
'LOOT'
|
||||
'LOOT_API'
|
||||
'metadata-validator'
|
||||
)
|
||||
# The GitHub API's protected branches API is currently in preview, so hardcode
|
||||
# the branches for now.
|
||||
$protectedBranches = @(
|
||||
'dev'
|
||||
'master'
|
||||
)
|
||||
|
||||
foreach($package in $packages) {
|
||||
$bintrayPackageUrl = "$bintrayRepoUrl/$package"
|
||||
$versions = (Invoke-RestMethod -Uri $bintrayPackageUrl).versions
|
||||
|
||||
$versionsToDelete = @()
|
||||
$versionsToKeep = @()
|
||||
|
||||
foreach ($branch in (Get-Branches $versions)) {
|
||||
if ($protectedBranches -contains $branch) {
|
||||
continue
|
||||
}
|
||||
|
||||
$branchVersions = @(Get-VersionsForBranch $versions $branch)
|
||||
if (Is-Merged (Get-HashFromBintrayVersion $branchVersions[0])) {
|
||||
$versionsToDelete += $branchVersions
|
||||
} else {
|
||||
$versionsToKeep += $branchVersions[0]
|
||||
}
|
||||
}
|
||||
|
||||
# Get the versions not marked for deletion or keeping.
|
||||
$unevaluatedVersions = @()
|
||||
foreach ($version in $versions) {
|
||||
if (!($versionsToDelete -contains $version) -And !($versionsToKeep -contains $version)) {
|
||||
$unevaluatedVersions += $version
|
||||
}
|
||||
}
|
||||
|
||||
$firstOldVersionIndex = 40 - $versionsToKeep.length
|
||||
if ($unevaluatedVersions.length -gt $firstOldVersionIndex) {
|
||||
$versionsToDelete += $unevaluatedVersions[$firstOldVersionIndex..($unevaluatedVersions.length - 1)]
|
||||
}
|
||||
|
||||
foreach ($version in $versionsToDelete) {
|
||||
Write-Output "Deleting from Bintray: $version"
|
||||
Invoke-RestMethod -Method Delete -Uri "$bintrayPackageUrl/versions/$version" -Headers $bintrayHeaders
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
# Assumes that 'C:\projects' exists and that 7-zip is installed and 7z.exe is
|
||||
# available on the PATH.
|
||||
|
||||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||
|
||||
$boostUrl = 'https://downloads.sourceforge.net/project/boost/boost/1.61.0/boost_1_61_0.7z?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fboost%2Ffiles%2Fboost%2F1.61.0%2F&ts=1468862599&use_mirror=ncu'
|
||||
$boostArchive = 'C:\projects\boost_1_61_0.7z'
|
||||
$boostFolder = 'C:\projects\boost_1_61_0'
|
||||
$boostLibraries = @(
|
||||
'libboost_atomic-vc140-mt-1_61.lib'
|
||||
'libboost_chrono-vc140-mt-1_61.lib'
|
||||
'libboost_date_time-vc140-mt-1_61.lib'
|
||||
'libboost_filesystem-vc140-mt-1_61.lib'
|
||||
'libboost_iostreams-vc140-mt-1_61.lib'
|
||||
'libboost_locale-vc140-mt-1_61.lib'
|
||||
'libboost_log_setup-vc140-mt-1_61.lib'
|
||||
'libboost_log-vc140-mt-1_61.lib'
|
||||
'libboost_regex-vc140-mt-1_61.lib'
|
||||
'libboost_system-vc140-mt-1_61.lib'
|
||||
'libboost_thread-vc140-mt-1_61.lib'
|
||||
)
|
||||
|
||||
function Is-LibraryMissing {
|
||||
$libFolder = $boostFolder + '\stage\lib'
|
||||
foreach($library in $boostLibraries) {
|
||||
if (!(Test-Path ($libFolder + '\' + $library))) {
|
||||
return $true
|
||||
}
|
||||
}
|
||||
|
||||
return $false
|
||||
}
|
||||
|
||||
if (Is-LibraryMissing) {
|
||||
Write-Output 'Downloading Boost 1.61.0...'
|
||||
|
||||
$start_time = Get-Date
|
||||
(New-Object System.Net.WebClient).DownloadFile($boostUrl, $boostArchive)
|
||||
|
||||
Write-Output "Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)"
|
||||
|
||||
Remove-Item -Recurse -Force $boostFolder
|
||||
|
||||
Write-Output 'Extracting ' + $boostArchive + '...'
|
||||
cd
|
||||
7z x $boostArchive -o"C:\projects"
|
||||
|
||||
cd $boostFolder
|
||||
.\bootstrap.bat
|
||||
.\b2 toolset=msvc threadapi=win32 link=static variant=release address-model=32 --with-log --with-date_time --with-thread --with-filesystem --with-locale --with-regex --with-system --with-iostreams
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
BOOST_BASENAME=boost_1_61_0
|
||||
BOOST_LIBRARIES=(libboost_atomic.a libboost_chrono.a libboost_date_time.a libboost_filesystem.a libboost_iostreams.a libboost_locale.a libboost_log.a libboost_log_setup.a libboost_regex.a libboost_system.a libboost_thread.a)
|
||||
|
||||
function isLibraryMissing {
|
||||
for LIBRARY in $BOOST_LIBRARIES; do
|
||||
if [[ ! -e ~/$BOOST_BASENAME/stage/lib/$LIBRARY ]]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
if isLibraryMissing; then
|
||||
cd ~
|
||||
|
||||
wget https://downloads.sourceforge.net/project/boost/boost/1.61.0/${BOOST_BASENAME}.tar.bz2
|
||||
rm -rf $BOOST_BASENAME
|
||||
tar xf ${BOOST_BASENAME}.tar.bz2
|
||||
|
||||
cd $BOOST_BASENAME
|
||||
./bootstrap.sh
|
||||
./b2 toolset=gcc-5 link=static variant=release address-model=64 cxxflags="-std=c++14 -fPIC" boost.locale.icu=off --with-log --with-date_time --with-thread --with-filesystem --with-locale --with-regex --with-system --with-iostreams
|
||||
fi
|
||||
Reference in New Issue
Block a user