Skip to content

Bump System.Text.Json in /Source/ISHRemote/Trisoft.ISHRemote (#202) #213

Bump System.Text.Json in /Source/ISHRemote/Trisoft.ISHRemote (#202)

Bump System.Text.Json in /Source/ISHRemote/Trisoft.ISHRemote (#202) #213

name: Continuous Integration
on:
push:
branches: [ master ]
paths:
- 'Source/**'
- '*.TXT'
- '*.MD'
pull_request:
branches: [ master ]
env:
ISHGITHUB_RUN_NUMBER: ${{ github.run_number }}
ISHGITHUB_SERVER_URL: ${{ github.server_url }}
ISHGITHUB_REPOSITORY: ${{ github.repository }}
ISHGITHUB_RUN_ID: ${{ github.run_id }}
jobs:
build:
runs-on: windows-latest
steps:
- name: PowerShell Update to latest stable (initially because 7.2.13/lts had issues, forced latest stable 7.3.6 or higher)
uses: bjompen/[email protected]
with:
ReleaseVersion: 'Stable'
- name: "Info: My Github Workflows Setup"
shell: pwsh
run: |
echo "My Github Workflows Setup Information..."
echo ("PSVersionTable info PSEdition["+$PSVersionTable.PSEdition+"] PSVersion["+$PSVersionTable.PSVersion+"]")
echo "GITHUB_ACTIONS[$env:GITHUB_ACTIONS]"
echo "GITHUB_WORKFLOW[$env:GITHUB_WORKFLOW]"
echo "GITHUB_RUN_NUMBER[$env:GITHUB_RUN_NUMBER]"
echo "GITHUB_RUN_ATTEMPT[$env:GITHUB_RUN_ATTEMPT]"
echo "ISHGITHUB_RUN_NUMBER[$env:ISHGITHUB_RUN_NUMBER]"
echo "ISHGITHUB_SERVER_URL[$env:ISHGITHUB_SERVER_URL]"
echo "ISHGITHUB_REPOSITORY[$env:ISHGITHUB_REPOSITORY]"
echo "ISHGITHUB_RUN_ID[$env:ISHGITHUB_RUN_ID]"
- uses: actions/checkout@v4
- name: Setup .NET 6.0.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
- name: Explicit restore of multi-target/conditional ProjectReference and dependencies
shell: pwsh
run: |
# See Github #180
# dotnet restore Source/ISHRemote/Trisoft.ISHRemote.OpenApiAM10\Trisoft.ISHRemote.OpenApiAM10.NET48.csproj
# dotnet restore Source/ISHRemote/Trisoft.ISHRemote.OpenApiAM10\Trisoft.ISHRemote.OpenApiAM10.NET60.csproj
# dotnet restore Source/ISHRemote/Trisoft.ISHRemote.OpenApiISH30\Trisoft.ISHRemote.OpenApiISH30.NET48.csproj
# dotnet restore Source/ISHRemote/Trisoft.ISHRemote.OpenApiISH30\Trisoft.ISHRemote.OpenApiISH30.NET60.csproj
dotnet restore Source/ISHRemote/ISHRemote.sln
- name: Build Solution
shell: pwsh
run: dotnet build --no-restore --no-incremental --configuration release Source/ISHRemote/ISHRemote.sln
- name: Setup PowerShell PSScriptAnalyzer
shell: pwsh
run: |
Set-PSRepository PSGallery -InstallationPolicy Trusted
Install-Module PSScriptAnalyzer -ErrorAction Stop
- name: Lint with PSScriptAnalyzer
shell: pwsh
run: |
Invoke-ScriptAnalyzer -Path Source/ISHRemote/Trisoft.ISHRemote/Scripts -Recurse -Outvariable issues
$errors = $issues.Where({$_.Severity -eq 'Error'})
$warnings = $issues.Where({$_.Severity -eq 'Warning'})
if ($errors) {
Write-Warning "There were $($errors.Count) errors and $($warnings.Count) warnings total."
} else {
Write-Output "There were $($errors.Count) errors and $($warnings.Count) warnings total."
}
- name: Archive ISHRemote module
uses: actions/upload-artifact@v4
with:
name: ISHRemote-MainCI-Module
path: Source/ISHRemote/Trisoft.ISHRemote/bin/Release/ISHRemote/
- name: Pester Test Preparation (...products.com) on Windows using PowerShell 7.x
shell: pwsh
env:
ISH_BASE_URL: ${{ secrets.ISH_BASE_URL }}
ISH_USER_NAME: ${{ secrets.ISH_USER_NAME }}
ISH_PASSWORD: ${{ secrets.ISH_PASSWORD }}
ISH_CLIENT_ID: ${{ secrets.ISH_CLIENT_ID }}
ISH_CLIENT_SECRET: ${{ secrets.ISH_CLIENT_SECRET }}
run: |
$filePath = 'Source/ISHRemote/Trisoft.ISHRemote/ISHRemote.PesterSetup.Debug.ps1'
Add-Content -Path $filePath -Value '# File[$filePath] is generated through continuous-integration.yml section PowerShell 7.x'
Add-Content -Path $filePath -Value '$baseUrl = $env:ISH_BASE_URL'
Add-Content -Path $filePath -Value 'if ($baseUrl -like "*.sdlproducts.com*")'
Add-Content -Path $filePath -Value '{'
Add-Content -Path $filePath -Value ' $ishEventTypeToPurge = ''TESTBACKGROUNDTASK''' # before 14SP4 use ''PUSHTRANSLATIONS'''
Add-Content -Path $filePath -Value ' $ishLngLabel = ''en-us'''
Add-Content -Path $filePath -Value ' $ishLngTarget1 = ''VLANGUAGEESES'''
Add-Content -Path $filePath -Value ' $ishLngTarget1Label = ''es-es'''
Add-Content -Path $filePath -Value ' $ishLngTarget2 = ''VLANGUAGEDEDE'''
Add-Content -Path $filePath -Value ' $ishLngTarget2Label = ''de-de'''
Add-Content -Path $filePath -Value ' $ishLngCombination = ''en-us'''
Add-Content -Path $filePath -Value '}'
- name: Pester Test Prerequisites on Windows using PowerShell 7.x
shell: pwsh
env:
ISH_BASE_URL: ${{ secrets.ISH_BASE_URL }}
ISH_USER_NAME: ${{ secrets.ISH_USER_NAME }}
ISH_PASSWORD: ${{ secrets.ISH_PASSWORD }}
ISH_CLIENT_ID: ${{ secrets.ISH_CLIENT_ID }}
ISH_CLIENT_SECRET: ${{ secrets.ISH_CLIENT_SECRET }}
run: Invoke-Pester -Path Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/_TestEnvironment/TestPrerequisite.Tests.ps1 -Output Detailed -Passthru | Export-CliXml -Path Cmdlets.Pester.Tests.xml
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: ISHRemote-MainCI-PesterPrerequisiteOnPowerShellCore
path: Cmdlets.Pester.Tests.xml
- name: Pester Test Cmdlets on Windows using PowerShell 7.x
shell: pwsh
env:
ISH_BASE_URL: ${{ secrets.ISH_BASE_URL }}
ISH_USER_NAME: ${{ secrets.ISH_USER_NAME }}
ISH_PASSWORD: ${{ secrets.ISH_PASSWORD }}
ISH_CLIENT_ID: ${{ secrets.ISH_CLIENT_ID }}
ISH_CLIENT_SECRET: ${{ secrets.ISH_CLIENT_SECRET }}
run: Invoke-Pester -Path Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/ -Output Detailed -Passthru | Export-CliXml -Path Cmdlets.Pester.Tests.xml
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: ISHRemote-MainCI-PesterOnPowerShellCore
path: Cmdlets.Pester.Tests.xml
if: ${{ always() }}
- name: Pester Test Preparation (...products.com) using Windows PowerShell 5.1
shell: powershell
env:
ISH_BASE_URL: ${{ secrets.ISH_BASE_URL }}
ISH_USER_NAME: ${{ secrets.ISH_USER_NAME }}
ISH_PASSWORD: ${{ secrets.ISH_PASSWORD }}
ISH_CLIENT_ID: ${{ secrets.ISH_CLIENT_ID }}
ISH_CLIENT_SECRET: ${{ secrets.ISH_CLIENT_SECRET }}
run: |
$filePath = 'Source/ISHRemote/Trisoft.ISHRemote/ISHRemote.PesterSetup.Debug.ps1'
Add-Content -Path $filePath -Value '# File[$filePath] is generated through continuous-integration.yml section Windows PowerShell 5.1'
Add-Content -Path $filePath -Value '$baseUrl = $env:ISH_BASE_URL'
Add-Content -Path $filePath -Value 'if ($baseUrl -like "*.sdlproducts.com*")'
Add-Content -Path $filePath -Value '{'
Add-Content -Path $filePath -Value ' $ishEventTypeToPurge = ''TESTBACKGROUNDTASK''' # before 14SP4 use ''PUSHTRANSLATIONS'''
Add-Content -Path $filePath -Value ' $ishLngLabel = ''en-us'''
Add-Content -Path $filePath -Value ' $ishLngTarget1 = ''VLANGUAGEESES'''
Add-Content -Path $filePath -Value ' $ishLngTarget1Label = ''es-es'''
Add-Content -Path $filePath -Value ' $ishLngTarget2 = ''VLANGUAGEDEDE'''
Add-Content -Path $filePath -Value ' $ishLngTarget2Label = ''de-de'''
Add-Content -Path $filePath -Value ' $ishLngCombination = ''en-us'''
Add-Content -Path $filePath -Value '}'
- name: Pester Test Prerequisites using Windows PowerShell 5.1
shell: powershell
env:
ISH_BASE_URL: ${{ secrets.ISH_BASE_URL }}
ISH_USER_NAME: ${{ secrets.ISH_USER_NAME }}
ISH_PASSWORD: ${{ secrets.ISH_PASSWORD }}
ISH_CLIENT_ID: ${{ secrets.ISH_CLIENT_ID }}
ISH_CLIENT_SECRET: ${{ secrets.ISH_CLIENT_SECRET }}
run: Invoke-Pester -Path Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/_TestEnvironment/TestPrerequisite.Tests.ps1 -Output Detailed -Passthru | Export-CliXml -Path Cmdlets.Pester.Tests.xml
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: ISHRemote-MainCI-PesterPrerequisiteOnWindowsPowerShell
path: Cmdlets.Pester.Tests.xml
- name: Pester Test Cmdlets using Windows PowerShell 5.1
shell: powershell
env:
ISH_BASE_URL: ${{ secrets.ISH_BASE_URL }}
ISH_USER_NAME: ${{ secrets.ISH_USER_NAME }}
ISH_PASSWORD: ${{ secrets.ISH_PASSWORD }}
ISH_CLIENT_ID: ${{ secrets.ISH_CLIENT_ID }}
ISH_CLIENT_SECRET: ${{ secrets.ISH_CLIENT_SECRET }}
run: Invoke-Pester -Path Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/ -Output Detailed -Passthru | Export-CliXml -Path Cmdlets.Pester.Tests.xml
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: ISHRemote-MainCI-PesterOnWindowsPowerShell
path: Cmdlets.Pester.Tests.xml
if: ${{ always() }}
- name: "Publish to PowerShellGallery if commit holds [PublishToPSGalleryAsPreview]"
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
if: ${{ success() && contains(github.event.head_commit.message, '[PublishToPSGalleryAsPreview]') }}
shell: pwsh
run: |
$packageRootFolderPath = "Source/ISHRemote/Trisoft.ISHRemote/bin/Release/ISHRemote/"
$manifestFilePath = Join-Path -Path $packageRootFolderPath -ChildPath "ISHRemote.psd1"
$manifestFileInfo = Get-ChildItem $manifestFilePath
if ($manifestFileInfo -eq $null) { echo "File[$manifestFilePath] not found" }
$moduleManifest = Test-ModuleManifest -Path $manifestFileInfo.FullName
$moduleManifestFileVersion = $moduleManifest.Version
$moduleManifestFileUpdateVersion = $moduleManifest.PrivateData.PSData['Prerelease']
$fullVersion = "$moduleManifestFileVersion-$moduleManifestFileUpdateVersion"
$remoteModule = Find-Module -Name ISHRemote -Repository PSGallery -AllowPrerelease
if($remoteModule.Version -ne $fullVersion)
{
echo ("Found earlier module[ISHRemote] of version["+($remoteModule.Version)+"]. Publishing module with version[$fullVersion]!")
Publish-Module -Path $packageRootFolderPath -Repository PSGallery -NuGetApiKey $env:NUGET_API_KEY -Verbose -Force #-WhatIf -ErrorAction:Continue
}
else
{
echo ("Found recent module[ISHRemote] of version["+($remoteModule.Version)+"]. Skipping publish of module with version[$fullVersion]!")
}
- name: "Publish to PowerShellGallery if commit holds [PublishToPSGalleryAsRelease]"
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
if: ${{ success() && contains(github.event.head_commit.message, '[PublishToPSGalleryAsRelease]') }}
shell: pwsh
run: |
$packageRootFolderPath = "Source/ISHRemote/Trisoft.ISHRemote/bin/Release/ISHRemote/"
$manifestFilePath = Join-Path -Path $packageRootFolderPath -ChildPath "ISHRemote.psd1"
$manifestFileInfo = Get-ChildItem $manifestFilePath
if ($manifestFileInfo -eq $null) { echo "File[$manifestFilePath] not found" }
(Get-Content -Raw -Path $ManifestFilePath).Replace('Prerelease = ','# Prerelease = ') | Set-Content -Path $ManifestFilePath
$moduleManifest = Test-ModuleManifest -Path $manifestFileInfo.FullName
$moduleManifestFileVersion = $moduleManifest.Version
$fullVersion = "$moduleManifestFileVersion"
$remoteModule = Find-Module -Name ISHRemote -Repository PSGallery
if($remoteModule.Version -ne $fullVersion)
{
echo ("Found earlier module[ISHRemote] of version["+($remoteModule.Version)+"]. Publishing module with version[$fullVersion]!")
Publish-Module -Path $packageRootFolderPath -Repository PSGallery -NuGetApiKey $env:NUGET_API_KEY -Verbose -Force -WhatIf #-ErrorAction:Continue
}
else
{
echo ("Found recent module[ISHRemote] of version["+($remoteModule.Version)+"]. Skipping publish of module with version[$fullVersion]!")
}
- name: "Info: How to publish to Internal/Nexus Repositories"
shell: pwsh
run: |
echo "Either the steps below or in-house https://jenkins-docs.web.sdldev.net/job/Publish-ISHRemote/ job that downloads and publishes to Nexus"
echo "1. Login to Github, navigate to $env:ISHGITHUB_SERVER_URL/$env:ISHGITHUB_REPOSITORY/actions/runs/$env:ISHGITHUB_RUN_ID"
echo "2. Download ISHRemote-MainCI-Module artefact to C:\TEMP\ISHRemote\ISHRemote-MainCI-Module.zip"
echo "3. In a PowerShell Session..."
echo "3a. Remove-Item -Path C:\TEMP\ISHRemote\ToPublish -Recurse -Force"
echo "3b. Expand-Archive -Path C:\TEMP\ISHRemote\ISHRemote-MainCI-Module.zip -DestinationPath C:\TEMP\ISHRemote\ToPublish\ -Force"
echo "3c. Publish-Module -Path C:\TEMP\ISHRemote\ToPublish\ISHRemote.psd1 -Repository $psRepository -NuGetApiKey $nuGetApiKey -Force"
echo "3d. Find-Module -Name ISHRemote -Repository $psRepository -AllowPrerelease"