mirror of
https://code.forgejo.org/actions/go-versions
synced 2025-06-09 12:02:28 +02:00
commit
a7a24f2083
9 changed files with 15 additions and 181 deletions
7
.github/workflows/build-go-packages.yml
vendored
7
.github/workflows/build-go-packages.yml
vendored
|
@ -13,7 +13,6 @@ on:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
VERSION: ${{ github.event.inputs.VERSION }}
|
VERSION: ${{ github.event.inputs.VERSION }}
|
||||||
|
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
|
@ -108,12 +107,6 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
Install-Module Pester -Force -Scope CurrentUser
|
Install-Module Pester -Force -Scope CurrentUser
|
||||||
Import-Module Pester
|
Import-Module Pester
|
||||||
$pesterParams = @{
|
|
||||||
Path="./Go.Tests.ps1";
|
|
||||||
Parameters=@{
|
|
||||||
Version="$env:VERSION";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Invoke-Pester -Script ./Go.Tests.ps1 -EnableExit
|
Invoke-Pester -Script ./Go.Tests.ps1 -EnableExit
|
||||||
working-directory: ./tests
|
working-directory: ./tests
|
||||||
|
|
||||||
|
|
9
.github/workflows/create-pr.yml
vendored
9
.github/workflows/create-pr.yml
vendored
|
@ -1,8 +1,11 @@
|
||||||
name: Create Pull Request
|
name: Create Pull Request
|
||||||
on:
|
on:
|
||||||
repository_dispatch:
|
|
||||||
types: [create-pr]
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: pwsh
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
create_pr:
|
create_pr:
|
||||||
name: Create Pull Request
|
name: Create Pull Request
|
||||||
|
@ -13,14 +16,12 @@ jobs:
|
||||||
submodules: true
|
submodules: true
|
||||||
|
|
||||||
- name: Create versions-manifest.json
|
- name: Create versions-manifest.json
|
||||||
shell: pwsh
|
|
||||||
run: |
|
run: |
|
||||||
./helpers/packages-generation/manifest-generator.ps1 -RepositoryFullName "$env:GITHUB_REPOSITORY" `
|
./helpers/packages-generation/manifest-generator.ps1 -RepositoryFullName "$env:GITHUB_REPOSITORY" `
|
||||||
-GitHubAccessToken "${{secrets.GITHUB_TOKEN}}" `
|
-GitHubAccessToken "${{secrets.GITHUB_TOKEN}}" `
|
||||||
-OutputFile "./versions-manifest.json" `
|
-OutputFile "./versions-manifest.json" `
|
||||||
-ConfigurationFile "./config/go-manifest-config.json"
|
-ConfigurationFile "./config/go-manifest-config.json"
|
||||||
- name: Create GitHub PR
|
- name: Create GitHub PR
|
||||||
shell: pwsh
|
|
||||||
run: |
|
run: |
|
||||||
$formattedDate = Get-Date -Format "MM/dd/yyyy"
|
$formattedDate = Get-Date -Format "MM/dd/yyyy"
|
||||||
./helpers/github/create-pull-request.ps1 `
|
./helpers/github/create-pull-request.ps1 `
|
||||||
|
|
|
@ -29,22 +29,20 @@ Here are a few things you can do that will increase the likelihood of your pull
|
||||||
### Directory structure
|
### Directory structure
|
||||||
```
|
```
|
||||||
|
|
||||||
├── azure-pipelines/
|
├── .github/
|
||||||
| └──templates/
|
| └──workflows/
|
||||||
├── builders/
|
├── builders/
|
||||||
├── helpers/
|
├── helpers/
|
||||||
├── installers/
|
├── installers/
|
||||||
└── tests/
|
└── tests/
|
||||||
└──sources/
|
└──sources/
|
||||||
```
|
```
|
||||||
- `azure-pipelines*` - contains global YAML definitions for build pipelines. Reusable templates for specific jobs are located in `templates` subfolder.
|
- `.github/workflows` - contains repository workflow files.
|
||||||
- `builders` - contains Go builder classes and functions.
|
- `builders` - contains Go builder classes and functions.
|
||||||
- `helpers` - contains global helper functions and functions.
|
- `helpers` - contains global helper classes and functions.
|
||||||
- `installers` - contains installation script templates.
|
- `installers` - contains installation script templates.
|
||||||
- `tests` - contains test scripts. Required tests sources are located in `sources` subfolder.
|
- `tests` - contains test scripts. Required tests sources are located in `sources` subfolder.
|
||||||
|
|
||||||
\* _We use Azure Pipelines because there are a few features that Actions is still missing, we'll move to Actions as soon as possible_.
|
|
||||||
|
|
||||||
## Resources
|
## Resources
|
||||||
|
|
||||||
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
|
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
|
||||||
|
|
|
@ -1,65 +0,0 @@
|
||||||
name: $(date:yyyyMMdd)$(rev:.r)-Go-$(VERSION)
|
|
||||||
trigger: none
|
|
||||||
pr:
|
|
||||||
autoCancel: true
|
|
||||||
branches:
|
|
||||||
include:
|
|
||||||
- main
|
|
||||||
paths:
|
|
||||||
exclude:
|
|
||||||
- versions-manifest.json
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- stage: Build_Go_Darwin
|
|
||||||
dependsOn: []
|
|
||||||
variables:
|
|
||||||
Platform: darwin
|
|
||||||
Architecture: x64
|
|
||||||
jobs:
|
|
||||||
- template: /azure-pipelines/templates/build-job.yml
|
|
||||||
|
|
||||||
- stage: Test_Go_Darwin
|
|
||||||
condition: succeeded()
|
|
||||||
dependsOn: Build_Go_Darwin
|
|
||||||
variables:
|
|
||||||
VmImage: macOS-latest
|
|
||||||
Platform: darwin
|
|
||||||
Architecture: x64
|
|
||||||
jobs:
|
|
||||||
- template: /azure-pipelines/templates/test-job.yml
|
|
||||||
|
|
||||||
- stage: Build_Go_Linux
|
|
||||||
dependsOn: []
|
|
||||||
variables:
|
|
||||||
Platform: linux
|
|
||||||
Architecture: x64
|
|
||||||
jobs:
|
|
||||||
- template: /azure-pipelines/templates/build-job.yml
|
|
||||||
|
|
||||||
- stage: Test_Go_Linux
|
|
||||||
condition: succeeded()
|
|
||||||
dependsOn: Build_Go_Linux
|
|
||||||
variables:
|
|
||||||
VmImage: ubuntu-latest
|
|
||||||
Platform: linux
|
|
||||||
Architecture: x64
|
|
||||||
jobs:
|
|
||||||
- template: /azure-pipelines/templates/test-job.yml
|
|
||||||
|
|
||||||
- stage: Build_Go_Windows
|
|
||||||
dependsOn: []
|
|
||||||
variables:
|
|
||||||
Platform: win32
|
|
||||||
Architecture: x64
|
|
||||||
jobs:
|
|
||||||
- template: /azure-pipelines/templates/build-job.yml
|
|
||||||
|
|
||||||
- stage: Test_Go_Windows
|
|
||||||
condition: succeeded()
|
|
||||||
dependsOn: Build_Go_Windows
|
|
||||||
variables:
|
|
||||||
VmImage: windows-latest
|
|
||||||
Platform: win32
|
|
||||||
Architecture: x64
|
|
||||||
jobs:
|
|
||||||
- template: /azure-pipelines/templates/test-job.yml
|
|
|
@ -1,21 +0,0 @@
|
||||||
jobs:
|
|
||||||
- job: Build_Go
|
|
||||||
timeoutInMinutes: 90
|
|
||||||
pool:
|
|
||||||
name: Azure Pipelines
|
|
||||||
vmImage: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- checkout: self
|
|
||||||
|
|
||||||
- task: PowerShell@2
|
|
||||||
displayName: 'Build Go $(Version)'
|
|
||||||
inputs:
|
|
||||||
targetType: filePath
|
|
||||||
filePath: './builders/build-go.ps1'
|
|
||||||
arguments: '-Version $(Version) -Platform $(Platform) -Architecture $(Architecture)'
|
|
||||||
|
|
||||||
- task: PublishPipelineArtifact@1
|
|
||||||
displayName: 'Publish Artifact: Go $(Version)'
|
|
||||||
inputs:
|
|
||||||
targetPath: '$(Build.ArtifactStagingDirectory)'
|
|
||||||
artifactName: 'go-$(Version)-$(Platform)-$(Architecture)'
|
|
|
@ -1,75 +0,0 @@
|
||||||
jobs:
|
|
||||||
- job: Test_Go
|
|
||||||
pool:
|
|
||||||
name: Azure Pipelines
|
|
||||||
vmImage: $(VmImage)
|
|
||||||
steps:
|
|
||||||
- checkout: self
|
|
||||||
submodules: true
|
|
||||||
|
|
||||||
- task: PowerShell@2
|
|
||||||
displayName: Fully cleanup the toolcache directory before testing
|
|
||||||
inputs:
|
|
||||||
targetType: filePath
|
|
||||||
filePath: helpers/clean-toolcache.ps1
|
|
||||||
arguments: -ToolName "go"
|
|
||||||
|
|
||||||
- task: DownloadPipelineArtifact@2
|
|
||||||
inputs:
|
|
||||||
source: 'current'
|
|
||||||
artifact: 'go-$(Version)-$(Platform)-$(Architecture)'
|
|
||||||
path: $(Build.ArtifactStagingDirectory)
|
|
||||||
|
|
||||||
- task: ExtractFiles@1
|
|
||||||
inputs:
|
|
||||||
archiveFilePatterns: '$(Build.ArtifactStagingDirectory)/go-$(Version)-$(Platform)-$(Architecture).*'
|
|
||||||
destinationFolder: $(Build.BinariesDirectory)
|
|
||||||
cleanDestinationFolder: false
|
|
||||||
|
|
||||||
- task: PowerShell@2
|
|
||||||
displayName: 'Apply build artifact to the local machines'
|
|
||||||
inputs:
|
|
||||||
targetType: inline
|
|
||||||
script: |
|
|
||||||
if ("$(Platform)" -match 'win32') { powershell ./setup.ps1 } else { sh ./setup.sh }
|
|
||||||
workingDirectory: '$(Build.BinariesDirectory)'
|
|
||||||
|
|
||||||
- task: GoTool@0
|
|
||||||
inputs:
|
|
||||||
version: '$(Version)'
|
|
||||||
|
|
||||||
- task: PowerShell@2
|
|
||||||
displayName: 'Wait for the logs'
|
|
||||||
inputs:
|
|
||||||
targetType: inline
|
|
||||||
script: |
|
|
||||||
Write-Host "Fake step that do nothing"
|
|
||||||
Write-Host "We need it because log of previous step 'Use Go' is not available here yet."
|
|
||||||
Write-Host "In testing step (Go.Tests.ps1) we analyze build log of 'GoTool' task"
|
|
||||||
Write-Host "to determine if Go version was consumed from cache and was downloaded"
|
|
||||||
|
|
||||||
- task: PowerShell@2
|
|
||||||
displayName: 'Run tests'
|
|
||||||
inputs:
|
|
||||||
TargetType: inline
|
|
||||||
script: |
|
|
||||||
Install-Module Pester -Force -Scope CurrentUser -RequiredVersion 4.10.1
|
|
||||||
Import-Module Pester
|
|
||||||
$pesterParams = @{
|
|
||||||
Path="./Go.Tests.ps1";
|
|
||||||
Parameters=@{
|
|
||||||
Version="$(Version)";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Invoke-Pester -Script $pesterParams -OutputFile "$(Build.SourcesDirectory)/tests/test_results.xml" -OutputFormat NUnitXml
|
|
||||||
workingDirectory: '$(Build.SourcesDirectory)/tests'
|
|
||||||
|
|
||||||
- task: PublishTestResults@2
|
|
||||||
displayName: 'Publish test results'
|
|
||||||
inputs:
|
|
||||||
testResultsFiles: '*.xml'
|
|
||||||
testResultsFormat: NUnit
|
|
||||||
searchFolder: 'tests'
|
|
||||||
failTaskOnFailedTests: true
|
|
||||||
testRunTitle: "Go $(Version)-$(Platform)"
|
|
||||||
condition: always()
|
|
|
@ -18,7 +18,10 @@ class GoBuilder {
|
||||||
.PARAMETER TempFolderLocation
|
.PARAMETER TempFolderLocation
|
||||||
The location of temporary files that will be used during Node.js package generation.
|
The location of temporary files that will be used during Node.js package generation.
|
||||||
|
|
||||||
.PARAMETER ArtifactLocation
|
.PARAMETER WorkFolderLocation
|
||||||
|
The location of installation files.
|
||||||
|
|
||||||
|
.PARAMETER ArtifactFolderLocation
|
||||||
The location of generated Node.js artifact.
|
The location of generated Node.js artifact.
|
||||||
|
|
||||||
.PARAMETER InstallationTemplatesLocation
|
.PARAMETER InstallationTemplatesLocation
|
||||||
|
|
2
helpers
2
helpers
|
@ -1 +1 @@
|
||||||
Subproject commit 1314c6de07d9052cb47c157e2babe11e9396ba23
|
Subproject commit 68072bedefb41436c6b70ddfa9adb8e631a3b6cf
|
|
@ -2,7 +2,7 @@ Import-Module (Join-Path $PSScriptRoot "../helpers/pester-extensions.psm1")
|
||||||
Import-Module (Join-Path $PSScriptRoot "../helpers/common-helpers.psm1")
|
Import-Module (Join-Path $PSScriptRoot "../helpers/common-helpers.psm1")
|
||||||
|
|
||||||
BeforeAll {
|
BeforeAll {
|
||||||
function Get-UseNodeLogs {
|
function Get-UseGoLogs {
|
||||||
# GitHub Windows images don't have `HOME` variable
|
# GitHub Windows images don't have `HOME` variable
|
||||||
$homeDir = $env:HOME ?? $env:HOMEDRIVE
|
$homeDir = $env:HOME ?? $env:HOMEDRIVE
|
||||||
$logsFolderPath = Join-Path -Path $homeDir -ChildPath "runners/*/_diag/pages" -Resolve
|
$logsFolderPath = Join-Path -Path $homeDir -ChildPath "runners/*/_diag/pages" -Resolve
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue