-
Notifications
You must be signed in to change notification settings - Fork 519
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Add LZ Child MG Flex for ALZ Default Policy Assignments & Ad…
…d Release Checks (#559) Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
4e74606
commit b0fb31f
Showing
5 changed files
with
119 additions
and
6 deletions.
There are no files selected for viewing
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,57 @@ | ||
[CmdletBinding()] | ||
param ( | ||
[Parameter(Mandatory = $false)] | ||
[string] | ||
$versionFilePath = "./version.json" | ||
) | ||
|
||
Describe "version.json file tests" { | ||
|
||
Context "version.json file tests" { | ||
|
||
BeforeAll { | ||
$versionFile = Get-Content $versionFilePath -Raw | ConvertFrom-Json | ||
$gitRepoLatestTag = git describe --tags --abbrev=0 | ||
$releaseNotesUrlSplitLast = $versionFile.releaseNotes.Split("/")[-1] | ||
$releaseNotesUrlStart = "https://github.com/Azure/alz-bicep/releases/tag/v" | ||
|
||
# Download the previous version.json file from the repo | ||
$previousVersionRawUrl = "https://raw.githubusercontent.com/Azure/alz-bicep/$gitRepoLatestTag/version.json" | ||
$previousVersionOutputFile = "./previousVersion.json" | ||
Invoke-WebRequest -Uri $previousVersionRawUrl -OutFile $previousVersionOutputFile | ||
$PreviousVersionFile = Get-Content $previousVersionOutputFile -Raw | ConvertFrom-Json | ||
} | ||
|
||
It "version.json file exists" { | ||
$versionFile | Should -Not -BeNullOrEmpty | ||
} | ||
|
||
It "version.json file contains the required properties" { | ||
$versionFile.version | Should -Not -BeNullOrEmpty | ||
$versionFile.gitTag | Should -Not -BeNullOrEmpty | ||
$versionFile.releaseNotes | Should -Not -BeNullOrEmpty | ||
$versionFile.releaseDateTimeUTC | Should -Not -BeNullOrEmpty | ||
} | ||
|
||
It "version.json file version property has been updated and increased from the latest git tag" { | ||
$versionFile.version | Should -BeGreaterThan $PreviousVersionFile.version | ||
} | ||
|
||
It "version.json file gitTag property has been updated and increased from the latest git tag" { | ||
$versionFile.gitTag | Should -BeGreaterThan $PreviousVersionFile.gitTag | ||
} | ||
|
||
It "version.json file releaseNotes property has been updated and URL last split on / does not match the latest git tag" { | ||
$releaseNotesUrlSplitLast | Should -Not -Be $gitRepoLatestTag | ||
} | ||
|
||
It "version.json file releaseNotes property is a valid URL and has the correct format" { | ||
$versionFile.releaseNotes | Should -BeLike "$releaseNotesUrlStart*" | ||
} | ||
|
||
It "version.json file releaseDateTimeUTC property has been updated and UTC time/date stamp if newer than the last value" { | ||
$versionFile.releaseDateTimeUTC | Should -BeGreaterThan $PreviousVersionFile.releaseDateTimeUTC | ||
} | ||
|
||
} | ||
} |
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,41 @@ | ||
name: Pre-Release Tests | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
workflow_dispatch: {} | ||
|
||
jobs: | ||
release-tests: | ||
name: Pre-Release Tests | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repo | ||
id: checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Pester Tests | ||
id: pester | ||
if: contains(github.head_ref, 'release') | ||
uses: azure/powershell@v1 | ||
with: | ||
inlineScript: | | ||
Import-Module Pester -Force | ||
$pesterConfiguration = @{ | ||
Run = @{ | ||
Container = New-PesterContainer -Path "./.github/pester/release.tests.ps1" | ||
PassThru = $true | ||
} | ||
Output = @{ | ||
Verbosity = 'Detailed' | ||
} | ||
} | ||
$result = Invoke-Pester -Configuration $pesterConfiguration | ||
exit $result.FailedCount | ||
azPSVersion: "latest" | ||
|
||
|
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