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

build: add changelogs for Linux packaging #1185

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ This document provides a list of notable changes introduced in Devolutions Gatew

- _webapp_: the initial 401 error is shown when it should not ([#1102](https://github.com/Devolutions/devolutions-gateway/issues/1102)) ([b54a666776](https://github.com/Devolutions/devolutions-gateway/commit/b54a666776420106bb694d08700e7ae234b9ab51)) ([DGW-226](https://devolutions.atlassian.net/browse/DGW-226))

## 2024.3.4 (2024-11-8)
## 2024.3.4 (2024-11-08)

### Features

Expand Down
223 changes: 223 additions & 0 deletions ci/linux-changelog.Tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
BeforeAll {
. $PSScriptRoot/linux-changelog.ps1
}

Describe 'Format-EntryLine' {
It 'Removes markdown links enclosed in parantheses' {
$Input = '([foo](http://foo.example))'
$Expected = ''
$Actual = Format-EntryLine -Line $Input
$Actual | Should -Be $Expected
}

It 'Removes links' {
$Input = '[foo](http://foo.example)'
$Expected = ''
$Actual = Format-EntryLine -Line $Input
$Actual | Should -Be $Expected
}

It 'Removes bold formatting' {
$Input = '**foo**'
$Expected = 'foo'
$Actual = Format-EntryLine -Line $Input
$Actual | Should -Be $Expected
}

It 'Removes italics (underscore)' {
$Input = '_foo_'
$Expected = 'foo'
$Actual = Format-EntryLine -Line $Input
$Actual | Should -Be $Expected
}

It 'Removes italics (asterisk)' {
$Input = '*foo*'
$Expected = 'foo'
$Actual = Format-EntryLine -Line $Input
$Actual | Should -Be $Expected
}

It 'Removes monospace' {
$Input = '`foo`'
$Expected = 'foo'
$Actual = Format-EntryLine -Line $Input
$Actual | Should -Be $Expected
}

It 'Removes blockquote marker' {
$Input = '> foo'
$Expected = 'foo'
$Actual = Format-EntryLine -Line $Input
$Actual | Should -Be $Expected
}
}

Describe 'Format-DebEntry' {
It 'Formats a CHANGELOG.md entry into an Debian format' {
$Version = '0.1.0'
$Date = '2025-01-01'
$Packager = 'Maurice'
$Email = '[email protected]'
$PackageName = 'my-package'
$Distro = 'focal'
$Body = " * Bug fixes`n" # body already formatted

$Expected = @"
my-package (0.1.0-1) focal; urgency=medium

* Bug fixes

-- Maurice <[email protected]> Wed, 01 Jan 2025 00:00:00 +0000
"@

$Actual = Format-DebEntry -Version $Version -Date $Date -Packager $Packager -Email $Email -PackageName $PackageName -Distro $Distro -Body $Body
$Actual | Should -Be $Expected
}
}

Describe 'Format-RpmUpstreamEntry' {
It 'Formats a CHANGELOG.md entry into an upstream RPM entry' {
$Version = '0.1.0'
$Date = '2025-01-01'
$Packager = 'Maurice'
$Email = '[email protected]'
$Body = "* Bug fixes`n" # body already formatted

$Expected = @"
0.1.0 (2025-01-01) Maurice <[email protected]>

* Bug fixes
"@

$Actual = Format-RpmUpstreamEntry -Version $Version -Date $Date -Packager $Packager -Email $Email -Body $Body
$Actual | Should -Be $Expected
}
}

Describe 'Format-RpmPackagingEntry' {
It 'Formats a CHANGELOG.md entry into a packaging RPM entry' {
$Version = '0.1.0'
$Date = '2025-01-01'
$Packager = 'Maurice'
$Email = '[email protected]'
$Body = "- Removed dependency`n" # body already formatted

$Expected = @"
* Wed Jan 01 00:00:00 2025 Maurice <[email protected]> - 0.1.0-1
- Removed dependency
"@

$Actual = Format-RpmPackagingEntry -Version $Version -Date $Date -Packager $Packager -Email $Email -Body $Body
$Actual | Should -Be $Expected
}
}


Describe 'New-UpstreamChangelog' {
BeforeEach {
$tmpfile = New-TemporaryFile
Set-Content -Path $tmpfile.FullName -Value @"
## 0.2.0 (2025-01-01)

### Features
- abc
- abcabc

### Bug Fixes
- def

## 0.1.0 (2024-01-01)
- ghi
"@
}

AfterEach {
# clean up
Remove-Item -Path $tmpfile.FullName -Force
}

It 'Generates a Debian upstream changelog' {
$Date = '2025-01-01'
$Packager = 'Maurice'
$Email = '[email protected]'
$PackageName = 'my-package'
$Distro = 'focal'

$Actual = New-Changelog `
-Format 'Deb' `
-InputFile $tmpfile.FullName `
-Packager $Packager `
-Email $Email `
-PackageName $PackageName `
-Distro $Distro

$Expected = @"
my-package (0.2.0-1) focal; urgency=medium

* Features
- abc
- abcabc
* Bug Fixes
- def

-- Maurice <[email protected]> Wed, 01 Jan 2025 00:00:00 +0000

my-package (0.1.0-1) focal; urgency=medium

* ghi

-- Maurice <[email protected]> Mon, 01 Jan 2024 00:00:00 +0000
"@

$Actual | Should -Be $Expected
}

It 'Generates an RPM upstream changelog' {
$Packager = 'Maurice'
$Email = '[email protected]'

$Actual = New-Changelog `
-Format 'RpmUpstream' `
-InputFile $tmpfile.FullName `
-Packager $Packager `
-Email $Email

$Expected = @"
0.2.0 (2025-01-01) Maurice <[email protected]>

* abc
- abcabc
* def

0.1.0 (2024-01-01) Maurice <[email protected]>

* ghi
"@

$Actual | Should -Be $Expected
}

It 'Generates an RPM packaging changelog' {
$Packager = 'Maurice'
$Email = '[email protected]'

$Actual = New-Changelog `
-Format 'RpmPackaging' `
-InputFile $tmpfile.FullName `
-Packager $Packager `
-Email $Email

$Expected = @"
* Wed Jan 01 00:00:00 2025 Maurice <[email protected]> - 0.2.0-1
- abc
- abcabc
- def

* Mon Jan 01 00:00:00 2024 Maurice <[email protected]> - 0.1.0-1
- ghi
"@

$Actual | Should -Be $Expected
}
}
Loading
Loading