1
0
Fork 0
mirror of https://code.forgejo.org/actions/go-versions synced 2025-06-08 11:38:22 +02:00

Remove Create-ArtifactDirectories function

This commit is contained in:
Nikita Bykov 2020-08-24 17:59:30 +03:00
parent 8daa2b0ac5
commit e3b3c821ce
3 changed files with 14 additions and 21 deletions

View file

@ -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 "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 {
<#
.SYNOPSIS
@ -74,8 +66,6 @@ function Get-GoBuilder {
return $builder
}
Create-ArtifactDirectories
### Create Go builder instance, and build artifact
$Builder = Get-GoBuilder -Version $Version -Platform $Platform -Architecture $Architecture
$Builder.Build()

View file

@ -1,25 +1,25 @@
class GoBuilder {
<#
.SYNOPSIS
Base Go builder class.
Base Node.js builder class.
.DESCRIPTION
Base Go builder class that contains general builder methods.
Base Node.js builder class that contains general builder methods.
.PARAMETER Version
The version of Go that should be built.
The version of Node.js that should be built.
.PARAMETER Platform
The platform of Go that should be built.
The platform of Node.js that should be built.
.PARAMETER Architecture
The architecture with which Go should be built.
The architecture with which Node.js should be built.
.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
The location of generated Go artifact. Using system environment BUILD_BINARIESDIRECTORY variable value.
The location of generated Node.js artifact.
.PARAMETER InstallationTemplatesLocation
The location of installation script template. Using "installers" folder from current repository.
@ -40,9 +40,8 @@ class GoBuilder {
$this.Architecture = $architecture
$this.TempFolderLocation = [IO.Path]::GetTempPath()
$this.WorkFolderLocation = $env:BINARIES_DIRECTORY
$this.ArtifactFolderLocation = $env:ARTIFACT_DIRECTORY
$this.WorkFolderLocation = Join-Path $env:RUNNER_TEMP "binaries"
$this.ArtifactFolderLocation = Join-Path $env:RUNNER_TEMP "artifact"
$this.InstallationTemplatesLocation = Join-Path -Path $PSScriptRoot -ChildPath "../installers"
}
@ -95,6 +94,10 @@ class GoBuilder {
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..."
$binariesArchivePath = $this.Download()

View file

@ -24,7 +24,7 @@ Describe "Go" {
}
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
}