forked from MethodsAndPractices/vsteam
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: optimized build process and updated metadata
The recent set of changes encompass optimizations to the build process and updates to the module metadata. The build pipeline was refactored into child workflows for better organization and simplicity, alongside removal of certain caching and module installation steps which were found to be less beneficial. Additionally, the version script was simplified for non-production use. On the metadata front, the psd1 file was updated with the most recent information and optimized. A few file renamings were also part of this chore to enhance clarity. These refinements collectively contribute to a more streamlined development workflow and accurate metadata representation.
- Loading branch information
1 parent
2aa5100
commit 59b8adb
Showing
8 changed files
with
374 additions
and
341 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
pesterVersion: | ||
type: string | ||
description: 'The version of Pester to install' | ||
required: true | ||
default: '5.5.0' | ||
secrets: | ||
ghToken: | ||
required: true | ||
description: 'The GitHub token to use for publishing artifacts' | ||
|
||
jobs: | ||
testing-stage: | ||
runs-on: windows-latest | ||
strategy: | ||
matrix: | ||
api_version: [VSTS] | ||
fail-fast: true | ||
steps: | ||
|
||
- name: Download nuget package artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: VSTeamPackage | ||
path: ./module | ||
|
||
- name: Download integration tests | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: test | ||
path: ./test | ||
|
||
- name: Download pipeline scripts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: pipeline-scripts | ||
path: ./tools | ||
|
||
- name: Module test installation | ||
shell: pwsh | ||
run: | | ||
./Test-InstallFromLocalFeed.ps1 -GitHubToken $env:GITHUB_TOKEN -RunnerTempPath '${{ runner.temp }}' | ||
env: | ||
GITHUB_TOKEN: ${{secrets.ghToken}} | ||
working-directory: './tools/scripts' | ||
|
||
- name: Install Pester | ||
run: Install-Module -Name Pester -Repository PSGallery -Force -AllowPrerelease -MinimumVersion "${{ inputs.pesterVersion }}" -Scope CurrentUser -AllowClobber -SkipPublisherCheck | ||
shell: pwsh | ||
|
||
- name: Run Integration Tests | ||
run: | | ||
Import-Module VSTeam | ||
#This loads [PesterConfiguration] into scope | ||
Import-Module Pester | ||
$pesterArgs = [PesterConfiguration]::Default | ||
$pesterArgs.Run.Exit = $true | ||
$pesterArgs.Run.PassThru = $true | ||
$pesterArgs.Output.Verbosity = 'None' | ||
$pesterArgs.TestResult.Enabled = $true | ||
$pesterArgs.TestResult.OutputFormat = 'JUnitXml' | ||
$pesterArgs.TestResult.OutputPath = 'test-results.xml' | ||
$env:VSTEAM_NO_UPDATE_MESSAGE = $true | ||
$env:VSTEAM_NO_MODULE_MESSAGES = $true | ||
Invoke-Pester -Configuration $pesterArgs | ||
shell: pwsh | ||
env: | ||
PAT: ${{ secrets.RSAZDOPAT }} | ||
EMAIL: ${{ secrets.RSEMAIL }} | ||
API_VERSION: ${{ matrix.api_version }} | ||
ACCT: ${{ secrets.RSORG }} | ||
working-directory: './test/Tests/integration' | ||
|
||
- name: Prepare test result publishing | ||
run: git init | ||
shell: pwsh | ||
|
||
- name: Publish PowerShell test results | ||
uses: dorny/test-reporter@v1 | ||
with: | ||
name: PS integration-tests results - (${{ matrix.api_version }}) | ||
path: '**/test-results.xml' | ||
reporter: jest-junit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
on: | ||
workflow_call: | ||
secrets: | ||
ghToken: | ||
required: true | ||
|
||
jobs: | ||
package-stage: | ||
# run from here only if it's not a pull request | ||
if: github.event_name != 'pull_request' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download module | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: module | ||
|
||
- name: Download pipeline scripts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: pipeline-scripts | ||
path: ./tools | ||
|
||
- name: Install NuGet 5.2.0 | ||
uses: nuget/setup-nuget@v1 | ||
with: | ||
nuget-version: '5.2.0' | ||
|
||
- name: Pack and push module | ||
shell: pwsh | ||
run: | | ||
./Install-ModuleDependencies -ModulePath "./../../dist" | ||
$version = ./Get-VersionNumber.ps1 -RevisionNumber ${{ github.run_number }} -ModulePath "./../../" | ||
./Invoke-PublishModule.ps1 -GitHubToken $env:GITHUB_TOKEN -Version $version -ModulePath "./../../" | ||
env: | ||
GITHUB_TOKEN: ${{secrets.ghToken}} | ||
working-directory: './tools/scripts' | ||
|
||
- name: Upload nuget package as artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: VSTeamPackage | ||
path: ./dist/*.nupkg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[CmdletBinding(DefaultParameterSetName = 'DirectVersion')] | ||
param ( | ||
# Revision number for non-production use | ||
[Parameter(Mandatory = $true, ParameterSetName = 'Revision')] | ||
[int] | ||
$RevisionNumber, | ||
|
||
# Path to the module without the name e.g. "C:\path\without\name" and not "C:\path\without\name\VSTeam" | ||
[Parameter(Mandatory = $true)] | ||
[string] | ||
$ModulePath | ||
) | ||
|
||
if ($null -eq (Get-Module -Name Metadata -ListAvailable)) { | ||
$null = Install-Module -Name Metadata -Scope CurrentUser -Force | ||
} | ||
|
||
Write-Host 'Compute Version Number' | ||
|
||
# Load the psd1 file so you can read the version | ||
$manifest = Import-Metadata -Path "$ModulePath/dist/VSTeam.psd1" | ||
|
||
# Load as semantic version | ||
[version]$sem_version = $manifest.ModuleVersion | ||
# Build new semantic version with revision number | ||
$computedVersion = "$($sem_version.Major).$($sem_version.Minor).$($sem_version.Build).$($RevisionNumber)" | ||
|
||
$manifest.ModuleVersion = $computedVersion | ||
Write-Host "Package Version Number: $computedVersion" | ||
$null = Export-Metadata -Path "$ModulePath/dist/VSTeam.psd1" -InputObject $manifest | ||
|
||
Write-Output $computedVersion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.