Skip to content

Commit 5c75413

Browse files
committed
Add tools to CI
1 parent 079c4a5 commit 5c75413

File tree

2 files changed

+34
-13
lines changed

2 files changed

+34
-13
lines changed

test/Scoop-Decompress.Tests.ps1

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
11
. "$psscriptroot\Scoop-TestLib.ps1"
2-
. "$psscriptroot\..\lib\core.ps1"
32
. "$psscriptroot\..\lib\decompress.ps1"
43
. "$psscriptroot\..\lib\unix.ps1"
4+
. "$psscriptroot\..\lib\install.ps1"
5+
. "$psscriptroot\..\lib\manifest.ps1"
6+
. "$psscriptroot\..\lib\config.ps1"
57

68
$isUnix = is_unix
79

8-
describe "extract_zip" -Tag 'Scoop' {
10+
function install_app_ci($app, $architecture) {
11+
$manifest = manifest $app
12+
$version = $manifest.version
13+
$dir = ensure (versiondir $app $version)
14+
$fname = dl_urls $app $version $manifest $null $architecture $dir
15+
$dir = link_current $dir
16+
success "'$app' ($version) was installed successfully!"
17+
}
18+
19+
install_app_ci 7zip 64bit
20+
install_app_ci lessmsi
21+
install_app_ci innounp
22+
23+
describe "extract_zip" -Tag 'Scoop', 'Decompress' {
924
beforeall {
1025
$working_dir = setup_working "decompress"
1126
}

test/bin/test.ps1

+17-11
Original file line numberDiff line numberDiff line change
@@ -10,40 +10,46 @@ $resultsXml = "$PSScriptRoot/TestResults.xml"
1010
$excludes = @()
1111

1212
$splat = @{
13-
Path = $TestPath
14-
OutputFile = $resultsXml
13+
Path = $TestPath
14+
OutputFile = $resultsXml
1515
OutputFormat = 'NUnitXML'
16-
PassThru = $true
16+
PassThru = $true
1717
}
1818

19-
if($env:CI -eq $true) {
20-
$commit = if($env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT) { $env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT } else { $env:APPVEYOR_REPO_COMMIT }
19+
if ($env:CI -eq $true) {
20+
$commit = if ($env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT) { $env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT } else { $env:APPVEYOR_REPO_COMMIT }
2121
$commitMessage = "$env:APPVEYOR_REPO_COMMIT_MESSAGE $env:APPVEYOR_REPO_COMMIT_MESSAGE_EXTENDED".TrimEnd()
2222

23-
if($commitMessage -match '!linter') {
23+
if ($commitMessage -match '!linter') {
2424
Write-Warning "Skipping code linting per commit flag '!linter'"
2525
$excludes += 'Linter'
2626
}
2727

2828
$changed_scripts = (Get-GitChangedFile -Include '*.ps1' -Commit $commit)
29-
if(!$changed_scripts) {
29+
if (!$changed_scripts) {
3030
Write-Warning "Skipping tests and code linting for *.ps1 files because they didn't change"
3131
$excludes += 'Linter'
3232
$excludes += 'Scoop'
3333
}
3434

35-
if($commitMessage -match '!manifests') {
35+
$changed_scripts = (Get-GitChangedFile -Include 'decompress.ps1' -Commit $commit)
36+
if (!$changed_scripts) {
37+
Write-Warning "Skipping tests and code linting for decompress.ps1 files because it didn't change"
38+
$excludes += 'Decompress'
39+
}
40+
41+
if ($commitMessage -match '!manifests') {
3642
Write-Warning "Skipping manifest validation per commit flag '!manifests'"
3743
$excludes += 'Manifests'
3844
}
3945

4046
$changed_manifests = (Get-GitChangedFile -Include '*.json' -Commit $commit)
41-
if(!$changed_manifests) {
47+
if (!$changed_manifests) {
4248
Write-Warning "Skipping tests and validation for manifest files because they didn't change"
4349
$excludes += 'Manifests'
4450
}
4551

46-
if($excludes.Length -gt 0) {
52+
if ($excludes.Length -gt 0) {
4753
$splat.ExcludeTag = $excludes
4854
}
4955
}
@@ -53,6 +59,6 @@ $result = Invoke-Pester @splat
5359

5460
(New-Object Net.WebClient).UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", $resultsXml)
5561

56-
if($result.FailedCount -gt 0) {
62+
if ($result.FailedCount -gt 0) {
5763
exit $result.FailedCount
5864
}

0 commit comments

Comments
 (0)