Skip to content

Commit

Permalink
Use a powershell script for release packaging (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
trflynn89 authored Mar 15, 2019
1 parent 9646e62 commit 8482b75
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 64 deletions.
4 changes: 0 additions & 4 deletions build/ci/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,3 @@ jobs:
- template: package.yml
parameters:
contents: 'build/nix/release-*/etc/libfly-*.tar.bz2'

- template: release.yml
parameters:
contents: 'libfly-*.tar.bz2'
13 changes: 13 additions & 0 deletions build/ci/package.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
parameters:
contents: ''
release: ''

steps:
- task: CopyFiles@2
Expand All @@ -14,3 +15,15 @@ steps:
pathtoPublish: $(Build.ArtifactStagingDirectory)
artifactName: libfly
displayName: 'Publish'

- task: GitHubRelease@0
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
inputs:
action: 'edit'
tag: $(Build.SourceBranchName)
tagSource: 'Git tag'
gitHubConnection: libfly
repositoryName: trflynn89/libfly
assets: $(Build.ArtifactStagingDirectory)/*
assetUploadMode: 'replace'
displayName: Release
15 changes: 0 additions & 15 deletions build/ci/release.yml

This file was deleted.

9 changes: 4 additions & 5 deletions build/ci/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@ jobs:
displayName: 'Test'

- ${{ if eq(parameters.configuration, 'Release') }}:
- script: build\win\release.bat
- task: PowerShell@2
inputs:
filePath: build\win\release.ps1
arguments: -arch ${{ parameters.arch }}
displayName: 'Package'

- template: package.yml
parameters:
contents: 'build\win\libfly-*.zip'

- template: release.yml
parameters:
contents: 'libfly-*.zip'
37 changes: 0 additions & 37 deletions build/win/release.bat

This file was deleted.

29 changes: 29 additions & 0 deletions build/win/release.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
param (
[Parameter(Mandatory=$true)][string]$arch
)

# Create a release package for an architecture.
function Create-Libfly-Package($arch)
{
Write-Output "Creating $arch package"

$version = Get-Content -Path ($PSScriptRoot + "\..\..\VERSION.md")

$package_src_path = $PSScriptRoot + "\..\..\fly"
$package_lib_path = $PSScriptRoot + "\Release-" + $arch + "\libfly"
$package_tmp_path = $PSScriptRoot + "\libfly-win-" + $version + "." + $arch
$package_zip_path = $package_tmp_path + ".zip"

Remove-Item -Path $package_tmp_path -Recurse -ErrorAction SilentlyContinue
Remove-Item -Path $package_zip_path -ErrorAction SilentlyContinue
New-Item -Path $package_tmp_path -ItemType Directory

Copy-Item -Path ($package_lib_path + "\libfly." + $arch + ".lib") -Destination $package_tmp_path
Copy-Item -Path $package_src_path -Destination $package_tmp_path -Recurse -Exclude @("*.mk", "*.cpp")

Compress-Archive -Path ($package_tmp_path + "\*") -Destination $package_zip_path -CompressionLevel Optimal
Remove-Item -Path $package_tmp_path -Recurse -ErrorAction SilentlyContinue
}

# Create the package
Create-Libfly-Package $arch
6 changes: 3 additions & 3 deletions build/win/test.ps1
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
param (
[Parameter(Mandatory=$true)][string]$arch
)
)

# Run all unit tests for an architecture and upload results to appveyor.
# Run all unit tests for an architecture.
function Run-Libfly-Test($arch)
{
Write-Output "Running $arch tests"

$full_path = $PSScriptRoot + "\\Debug-" + $arch
$full_path = $PSScriptRoot + "\Debug-" + $arch
$tests_passed = 0
$tests_failed = 0

Expand Down

0 comments on commit 8482b75

Please sign in to comment.