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

feat(CI): Support validation of all archived manifests #168

Merged
merged 6 commits into from
Jun 19, 2021
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
yaml support for URL; Test changed
  • Loading branch information
Ash258 committed Jun 15, 2021
commit c495cf740afda670ecf803f9670e14e812ad257f
10 changes: 7 additions & 3 deletions test/Scoop-Manifest.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Describe -Tag 'Manifests' 'manifest-validation' {
Context 'parse_json function' {
It 'fails with invalid json' {
{ parse_json "$working_dir\broken_wget.json" } | Should -Throw
{ ConvertFrom-Manifest "$working_dir\broken_wget.json" } | Should -Throw
}
}

Expand Down Expand Up @@ -52,10 +53,13 @@ Describe -Tag 'Manifests' 'manifest-validation' {
$changed_manifests = @()
if ($env:CI -eq $true) {
$commit = if ($env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT) { $env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT } else { $env:APPVEYOR_REPO_COMMIT }
# TODO: Better multiple format handling
$changed_manifests = (Get-GitChangedFile -Include '*.json' -Commit $commit)
$changed_manifests += (Get-GitChangedFile -Include '*.y*ml' -Commit $commit)
}
# TODO: YAMl
# TODO: Better multiple format handling
$manifest_files = Get-ChildItem $bucketdir '*.json' -Recurse
$manifest_files += Get-ChildItem $bucketdir '*.y*ml' -Recurse
$validator = New-Object Scoop.Validator($schema, $true)
}

Expand All @@ -66,8 +70,8 @@ Describe -Tag 'Manifests' 'manifest-validation' {
if ($env:CI -ne $true -or $changed_manifests -imatch 'schema.json') { $skip_manifest = $false }

It "$file" -Skip:$skip_manifest {
# Skip yml for now for schema validation
if (!($quota_exceeded) -or ($file.Extension -match '\.ya?ml')) {
# TODO: Skip yml for now for schema validation
if (!$quota_exceeded -and ($file.Extension -notmatch '\.ya?ml$')) {
try {
$validator.Validate($file.FullName)

Expand Down