Remove Create-ArtifactDirectories function

pull/10/head^2
Nikita Bykov 5 years ago
parent 8daa2b0ac5
commit e3b3c821ce

@ -28,14 +28,6 @@ param(
Import-Module (Join-Path $PSScriptRoot "../helpers" | Join-Path -ChildPath "nix-helpers.psm1") -DisableNameChecking Import-Module (Join-Path $PSScriptRoot "../helpers" | Join-Path -ChildPath "nix-helpers.psm1") -DisableNameChecking
Import-Module (Join-Path $PSScriptRoot "../helpers" | Join-Path -ChildPath "win-helpers.psm1") -DisableNameChecking Import-Module (Join-Path $PSScriptRoot "../helpers" | Join-Path -ChildPath "win-helpers.psm1") -DisableNameChecking
function Create-ArtifactDirectories {
$env:BINARIES_DIRECTORY = Join-Path $env:RUNNER_TEMP "binaries"
New-Item -Path $env:BINARIES_DIRECTORY -ItemType "directory"
$env:ARTIFACT_DIRECTORY = Join-Path $env:RUNNER_TEMP "artifact"
New-Item -Path $env:ARTIFACT_DIRECTORY -ItemType "directory"
}
function Get-GoBuilder { function Get-GoBuilder {
<# <#
.SYNOPSIS .SYNOPSIS
@ -74,8 +66,6 @@ function Get-GoBuilder {
return $builder return $builder
} }
Create-ArtifactDirectories
### Create Go builder instance, and build artifact ### Create Go builder instance, and build artifact
$Builder = Get-GoBuilder -Version $Version -Platform $Platform -Architecture $Architecture $Builder = Get-GoBuilder -Version $Version -Platform $Platform -Architecture $Architecture
$Builder.Build() $Builder.Build()

@ -1,25 +1,25 @@
class GoBuilder { class GoBuilder {
<# <#
.SYNOPSIS .SYNOPSIS
Base Go builder class. Base Node.js builder class.
.DESCRIPTION .DESCRIPTION
Base Go builder class that contains general builder methods. Base Node.js builder class that contains general builder methods.
.PARAMETER Version .PARAMETER Version
The version of Go that should be built. The version of Node.js that should be built.
.PARAMETER Platform .PARAMETER Platform
The platform of Go that should be built. The platform of Node.js that should be built.
.PARAMETER Architecture .PARAMETER Architecture
The architecture with which Go should be built. The architecture with which Node.js should be built.
.PARAMETER TempFolderLocation .PARAMETER TempFolderLocation
The location of temporary files that will be used during Go package generation. Using system BUILD_STAGINGDIRECTORY variable value. The location of temporary files that will be used during Node.js package generation.
.PARAMETER ArtifactLocation .PARAMETER ArtifactLocation
The location of generated Go artifact. Using system environment BUILD_BINARIESDIRECTORY variable value. The location of generated Node.js artifact.
.PARAMETER InstallationTemplatesLocation .PARAMETER InstallationTemplatesLocation
The location of installation script template. Using "installers" folder from current repository. The location of installation script template. Using "installers" folder from current repository.
@ -40,9 +40,8 @@ class GoBuilder {
$this.Architecture = $architecture $this.Architecture = $architecture
$this.TempFolderLocation = [IO.Path]::GetTempPath() $this.TempFolderLocation = [IO.Path]::GetTempPath()
$this.WorkFolderLocation = $env:BINARIES_DIRECTORY $this.WorkFolderLocation = Join-Path $env:RUNNER_TEMP "binaries"
$this.ArtifactFolderLocation = $env:ARTIFACT_DIRECTORY $this.ArtifactFolderLocation = Join-Path $env:RUNNER_TEMP "artifact"
$this.InstallationTemplatesLocation = Join-Path -Path $PSScriptRoot -ChildPath "../installers" $this.InstallationTemplatesLocation = Join-Path -Path $PSScriptRoot -ChildPath "../installers"
} }
@ -95,6 +94,10 @@ class GoBuilder {
Generates Go artifact from downloaded binaries. Generates Go artifact from downloaded binaries.
#> #>
Write-Host "Create WorkFolderLocation and ArtifactFolderLocation folders"
New-Item -Path $this.WorkFolderLocation -ItemType "directory"
New-Item -Path $this.ArtifactFolderLocation -ItemType "directory"
Write-Host "Download Go $($this.Version) [$($this.Architecture)] executable..." Write-Host "Download Go $($this.Version) [$($this.Architecture)] executable..."
$binariesArchivePath = $this.Download() $binariesArchivePath = $this.Download()

@ -24,7 +24,7 @@ Describe "Go" {
} }
It "version is correct" { It "version is correct" {
$versionOutput = '$(go version) -match "go(?<version>\d+\.\d+\.\d+)" | Out-Null', ' $Matches.Version' | Invoke-Expression $versionOutput = '$(go version) -match "go(?<version>\d+\.\d+\.\d+)" | Out-Null', '$Matches.Version' | Invoke-Expression
$versionOutput | Should -Match $Version $versionOutput | Should -Match $Version
} }

Loading…
Cancel
Save