Skip to content

Commit

Permalink
Fix case sensitivity issue (#3)
Browse files Browse the repository at this point in the history
* fix case sensitivity issue with Linux

* fix artifact path

* fix artifact path

* fix paths in tests

* create build folder if missing in Test

* fix test artifact upload

* add newline at end of workflow yml
  • Loading branch information
wethreetrees authored Aug 11, 2021
1 parent dc21808 commit ad813d3
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ jobs:
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Perform a Pester test from the Tests.ps1 file
- name: Build module
shell: pwsh
run: .\build.ps1 -Task Build
- name: Upload build artifact
uses: actions/upload-artifact@v2
with:
name: dist
path: dist
path: dist/*
test:
needs: build
runs-on: ubuntu-latest
Expand All @@ -36,14 +36,16 @@ jobs:
uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: Test with Pester
shell: pwsh
run: .\build.ps1 -Task Test -Coverage
- name: Upload test results
uses: actions/upload-artifact@v2
with:
name: test-results
path: build\testResults.xml
path: build/*.xml
if-no-files-found: error
publish:
# Only publish when we are running against the master branch
if: ${{ github.ref == 'refs/heads/master' }}
Expand All @@ -56,8 +58,9 @@ jobs:
uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: Publish to PSGallery
env:
NUGET_KEY: ${{ secrets.NUGET_KEY }}
shell: pwsh
run: ./build.ps1 -Task Publish
run: .\build.ps1 -Task Publish
10 changes: 7 additions & 3 deletions build_tools/module.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ Enter-Build {
$Script:ModuleTests
$Script:CommonTests
)
$Script:Imports = ('public', 'private', 'Scripts')
$Script:Imports = ('Public', 'Private', 'Scripts')
$Script:Classes = (Get-ChildItem -Path "$Script:Source\Classes" -ErrorAction SilentlyContinue).Name
$Script:NeedsPublished = $false
$Script:IsPromotion = $false
Expand Down Expand Up @@ -255,7 +255,7 @@ Task BuildPSM1 {
}

[void]$StringBuilder.AppendLine("")
[void]$StringBuilder.AppendLine("`$publicFunctions = (Get-ChildItem -Path `"`$PSScriptRoot\public`" -Filter '*.ps1').BaseName")
[void]$StringBuilder.AppendLine("`$publicFunctions = (Get-ChildItem -Path `"`$PSScriptRoot\Public`" -Filter '*.ps1').BaseName")
[void]$StringBuilder.AppendLine("")
[void]$StringBuilder.AppendLine("Export-ModuleMember -Function `$publicFunctions")

Expand All @@ -276,7 +276,7 @@ Task BuildPSD1 {
if ($dlls) { Update-Metadata -Path $Script:ManifestPath -PropertyName RequiredAssemblies -Value $dlls }

Write-Output " Setting Module Functions"
$moduleFunctions = Get-ChildItem -Path "$Script:Source\public" -Filter '*.ps1' | Select-Object -ExpandProperty BaseName
$moduleFunctions = Get-ChildItem -Path "$Script:Source\Public" -Filter '*.ps1' | Select-Object -ExpandProperty BaseName
Update-Metadata -Path $Script:ManifestPath -Property FunctionsToExport -Value $moduleFunctions

Write-Output " Setting ProjectUri"
Expand Down Expand Up @@ -444,6 +444,10 @@ Task Pester {
throw "You must run the 'Build' task before running the test suite!`nTry this: .\build.ps1 -Task Build, Test`n Or this: .\build.ps1"
}

if (-not (Test-Path -Path $Script:Build)) {
New-Item -Type Directory -Path $Script:Build -ErrorAction SilentlyContinue | Out-Null
}

Write-Output " Setting up test dependencies"

if (-not (Invoke-PSDepend -Path "$Script:BuildTools\build.Depend.psd1" -Tags Test -Test -Quiet)) {
Expand Down
8 changes: 4 additions & 4 deletions tests/Public/Compare-PSObject.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ BeforeDiscovery {
Describe "Compare-PSObject Unit Tests" {

BeforeAll {
$ModuleRoot = "$PSScriptRoot\..\.."
if (Test-Path -Path $ModuleRoot\dist) {
Import-Module $ModuleRoot\dist\PSObjectTools -Force
Import-Module $ModuleRoot\build_tools\tests\TestHelpers -DisableNameChecking -Force
$ModuleRoot = "$PSScriptRoot/../.."
if (Test-Path -Path $ModuleRoot/dist) {
Import-Module $ModuleRoot/dist/PSObjectTools -Force
Import-Module $ModuleRoot/build_tools/tests/TestHelpers -DisableNameChecking -Force
} else {
Write-Warning "Testing locally, importing function directly..."
. $ModuleRoot\src\Public\Format-PSObject.ps1
Expand Down
7 changes: 4 additions & 3 deletions tests/Public/Format-PSObject.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
Describe "Format-PSObject Unit Tests" {

BeforeAll {
$ModuleRoot = "$PSScriptRoot\..\.."
if (Test-Path -Path $ModuleRoot\dist) {
Import-Module $ModuleRoot\dist\PSObjectTools -Force
$ModuleRoot = "$PSScriptRoot/../.."
if (Test-Path -Path $ModuleRoot/dist) {
Import-Module $ModuleRoot/dist/PSObjectTools -Force
Import-Module $ModuleRoot/build_tools/tests/TestHelpers -DisableNameChecking -Force
} else {
Write-Warning "Testing locally, importing function directly..."
. $ModuleRoot\src\Public\Format-PSObject.ps1
Expand Down

0 comments on commit ad813d3

Please sign in to comment.