Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added PowerShell scripts required by CI/CD #27

Merged
merged 3 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 2 additions & 54 deletions .github/workflows/pr_validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,58 +51,6 @@ jobs:
- name: "dotnet pack"
run: dotnet pack -c Release

- name: "dotnet test (Linux)"
if: runner.os == 'Linux'
- name: "dotnet test"
run: dotnet test --configuration Release --verbosity normal --logger trx --collect:"XPlat Code Coverage"

- name: "dotnet test (Windows)"
if: runner.os == 'Windows'
run: dotnet test --configuration Release --verbosity normal --logger trx --collect:"XPlat Code Coverage" ./tests/TurboMqtt.Tests/TurboMqtt.Tests.csproj

- name: Combine Coverage Reports
if: runner.os == 'Linux'
uses: danielpalme/[email protected]
with:
reports: "**/*.cobertura.xml"
targetdir: "${{ github.workspace }}"
reporttypes: "Cobertura"
verbosity: "Info"
title: "Code Coverage"
tag: "${{ github.run_number }}_${{ github.run_id }}"
customSettings: ""
toolpath: "reportgeneratortool"

- name: Publish Code Coverage Report
if: runner.os == 'Linux'
uses: irongut/[email protected]
with:
filename: "Cobertura.xml"
badge: true
fail_below_min: false
format: markdown
hide_branch_rate: false
hide_complexity: false
indicators: true
output: both
thresholds: "10 30"

- name: Add Coverage PR Comment
if: github.event_name == 'pull_request_target' && runner.os == 'Linux'
uses: marocchino/sticky-pull-request-comment@v2
with:
recreate: true
path: code-coverage-results.md

- name: Upload Test Result Files
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: test-results
path: ${{ github.workspace }}/**/TestResults/**/*
retention-days: 5

- name: Publish Test Results
if: always() && runner.os == 'Linux'
uses: EnricoMi/[email protected]
with:
trx_files: "${{ github.workspace }}/**/*.trx"

18 changes: 18 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project>
<PropertyGroup>
<Copyright>Copyright © 2015-2024 Petabridge</Copyright>
<Authors>Petabridge</Authors>
<VersionPrefix>0.2.2</VersionPrefix>
<PackageReleaseNotes>Added footer that displays assembly version on Pricing UI</PackageReleaseNotes>
<PackageIconUrl>
</PackageIconUrl>
<PackageProjectUrl>
</PackageProjectUrl>
<PackageLicenseUrl>
</PackageLicenseUrl>
<NoWarn>$(NoWarn);CS1591</NoWarn>
</PropertyGroup>
<PropertyGroup>
<NetVersion>net8.0</NetVersion>
</PropertyGroup>
</Project>
File renamed without changes.
28 changes: 28 additions & 0 deletions scripts/bumpVersion.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
function UpdateVersionAndReleaseNotes {
param (
[Parameter(Mandatory=$true)]
[PSCustomObject]$ReleaseNotesResult,

[Parameter(Mandatory=$true)]
[string]$XmlFilePath
)

# Load XML
$xmlContent = New-Object XML
$xmlContent.Load($XmlFilePath)

# Update VersionPrefix and PackageReleaseNotes
$versionPrefixElement = $xmlContent.SelectSingleNode("//VersionPrefix")
$versionPrefixElement.InnerText = $ReleaseNotesResult.Version

$packageReleaseNotesElement = $xmlContent.SelectSingleNode("//PackageReleaseNotes")
$packageReleaseNotesElement.InnerText = $ReleaseNotesResult.ReleaseNotes

# Save the updated XML
$xmlContent.Save($XmlFilePath)
}

# Usage example:
# $notes = Get-ReleaseNotes -MarkdownFile "$PSScriptRoot\RELEASE_NOTES.md"
# $propsPath = Join-Path -Path (Get-Item $PSScriptRoot).Parent.FullName -ChildPath "Directory.Build.props"
# UpdateVersionAndReleaseNotes -ReleaseNotesResult $notes -XmlFilePath $propsPath
44 changes: 44 additions & 0 deletions scripts/getReleaseNotes.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
function Get-ReleaseNotes {
param (
[Parameter(Mandatory=$true)]
[string]$MarkdownFile
)

# Read markdown file content
$content = Get-Content -Path $MarkdownFile -Raw

# Split content based on headers
$sections = $content -split "####"

# Output object to store result
$outputObject = [PSCustomObject]@{
Version = $null
Date = $null
ReleaseNotes = $null
}

# Check if we have at least 3 sections (1. Before the header, 2. Header, 3. Release notes)
if ($sections.Count -ge 3) {
$header = $sections[1].Trim()
$releaseNotes = $sections[2].Trim()

# Extract version and date from the header
$headerParts = $header -split " ", 2
if ($headerParts.Count -eq 2) {
$outputObject.Version = $headerParts[0]
$outputObject.Date = $headerParts[1]
}

$outputObject.ReleaseNotes = $releaseNotes
}

# Return the output object
return $outputObject
}

# Call function example:
#$result = Get-ReleaseNotes -MarkdownFile "$PSScriptRoot\RELEASE_NOTES.md"
#Write-Output "Version: $($result.Version)"
#Write-Output "Date: $($result.Date)"
#Write-Output "Release Notes:"
#Write-Output $result.ReleaseNotes
32 changes: 0 additions & 32 deletions src/Directory.Build.props

This file was deleted.

Loading