Skip to content

Commit

Permalink
Suppress installation Environment Variable warning (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanbergstrom authored Jan 21, 2023
1 parent f7ccab3 commit 9147a7d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 33 deletions.
39 changes: 9 additions & 30 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup PowerShell module cache
uses: actions/cache@v2
uses: actions/cache@v3
id: cacher
with:
path: "~/.local/share/powershell/Modules"
Expand All @@ -30,7 +30,7 @@ jobs:
shell: pwsh
run: ./build.ps1
- name: Bundle up module
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: module
path: ./src/
Expand All @@ -39,9 +39,9 @@ jobs:
runs-on: windows-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Download module
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: module
path: C:\Users\runneradmin\Documents\PowerShell\Modules\Foil\
Expand All @@ -51,44 +51,23 @@ jobs:
Run = @{
Exit = $true
}
TestResult = @{
Enabled = $true
OutputFormat = 'JUnitXML'
Output = @{
Verbosity = 'Detailed'
}
})
- name: Upload Pester test results
if: always()
uses: actions/upload-artifact@v2
with:
name: test-results
path: testResults.xml
- name: Upload Chocolatey logs
if: always()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: choco-logs
path: C:\ProgramData\chocolatey\logs\
Results:
needs: Test
if: success() || failure()
runs-on: ubuntu-latest
steps:
- name: Download Test Results
uses: actions/download-artifact@v2
with:
name: test-results
path: test-results
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
with:
files: test-results/**/*.xml
Publish:
needs: Test
if: github.event_name == 'release' && github.event.action == 'published'
runs-on: ubuntu-latest
steps:
- name: Download module
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: module
path: '~/.local/share/powershell/Modules/Foil'
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.2.1] - 2023-01-21
#### Fixed
* No longer emits 'Environment' packages of version 'var' when installing a package that updates environment variables

## [0.2.0] - 2022-09-28
#### Added
* Support for finding and installing prelease packages
Expand Down
2 changes: 1 addition & 1 deletion src/Foil.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ $Commands = @(
$packageRegex = "^(?<name>[\S]+)[\|\s]v(?<version>[\S]+)"
$packageReportRegex="^[0-9]*(\s*)(packages installed)"
$output | ForEach-Object {
if (($_ -match $packageRegex) -and ($_ -notmatch $packageReportRegex) -and ($_ -notmatch 'already installed') -and $Matches.name -and $Matches.version) {
if (($_ -cmatch $packageRegex) -and ($_ -notmatch $packageReportRegex) -and ($_ -notmatch 'already installed') -and $Matches.name -and $Matches.version) {
[pscustomobject]@{
Name = $Matches.name
Version = $Matches.version
Expand Down
2 changes: 1 addition & 1 deletion src/Foil.psd1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@{
RootModule = 'Foil.psm1'
ModuleVersion = '0.2.0'
ModuleVersion = '0.2.1'
GUID = '38430603-9954-45fd-949a-5f79492ffaf7'
Author = 'Ethan Bergstrom'
Copyright = '2021'
Expand Down
2 changes: 1 addition & 1 deletion test/Foil.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Describe "DSC-compliant package installation and uninstallation" {
Get-ChocoPackage -Name $package | Where-Object {$_.Name -contains $package} | Should -Not -BeNullOrEmpty
}
It 'silently installs the latest version of a package' {
Install-ChocoPackage -Name $package -Force -ParamsGlobal -Parameters "/InstallDir:$env:ProgramFiles\$package /QuickLaunchShortcut:false" | Where-Object {$_.Name -contains $package} | Should -Not -BeNullOrEmpty
Install-ChocoPackage -Name $package -Force -ParamsGlobal -Parameters "/InstallDir:$env:ProgramFiles\$package /QuickLaunchShortcut:false" | Should -HaveCount 1
}
It 'correctly passed parameters to the package' {
Get-ChildItem -Path (Join-Path -Path $env:ProgramFiles -ChildPath $package) -ErrorAction SilentlyContinue | Should -Not -BeNullOrEmpty
Expand Down

0 comments on commit 9147a7d

Please sign in to comment.