Skip to content

Joel/7 #5

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

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
24 changes: 14 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ jobs:
submodules: true
fetch-depth: 0

- name: earthly +build
if: github.ref != 'refs/heads/main'
run: earthly --strict +build

- name: earthly +test
if: github.ref != 'refs/heads/main'
run: earthly --strict +test
Expand All @@ -34,24 +38,24 @@ jobs:

- uses: actions/upload-artifact@v4
with:
name: ModuleBuilder
path: Modules/ModuleBuilder
name: ErrorView
path: Modules/ErrorView

- uses: actions/upload-artifact@v4
with:
name: TestResults
path: Modules/ModuleBuilder-TestResults
path: Modules/ErrorView-TestResults

- uses: actions/upload-artifact@v4
with:
name: Packages
path: Modules/ModuleBuilder-Packages
path: Modules/ErrorView-Packages

- name: Upload Tests
uses: actions/upload-artifact@v4
with:
name: PesterTests
path: ${{github.workspace}}/Tests
path: ${{github.workspace}}/tests
- name: Upload RequiredModules.psd1
uses: actions/upload-artifact@v4
with:
Expand All @@ -68,8 +72,8 @@ jobs:
- name: Download Build Output
uses: actions/download-artifact@v4
with:
name: ModuleBuilder
path: Modules/ModuleBuilder
name: ErrorView
path: Modules/ErrorView
- name: Download Pester Tests
uses: actions/download-artifact@v4
with:
Expand All @@ -83,15 +87,15 @@ jobs:
- uses: PoshCode/Actions/install-requiredmodules@v1
- uses: PoshCode/Actions/pester@v1
with:
codeCoveragePath: Modules/ModuleBuilder
moduleUnderTest: ModuleBuilder
codeCoveragePath: Modules/ErrorView
moduleUnderTest: ErrorView
additionalModulePaths: ${{github.workspace}}/Modules
- name: Publish Test Results
uses: zyborg/dotnet-tests-report@v1
with:
test_results_path: results.xml
- name: Upload Results
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: Pester Results
path: ${{github.workspace}}/*.xml
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
output/
Modules/
# Ignore version number folders (I put my module in these so I can use it)
/[0-9]*/
3 changes: 2 additions & 1 deletion Build.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ $ErrorView = 'DetailedView'

# The name of the module to publish
$script:PSModuleName = "TerminalBlocks"
$script:RequiredCodeCoverage = 0.85
# Pester doesn't measure the code coverage properly, because we test things by running in a new session
$script:RequiredCodeCoverage = 0.0
# Use Env because then Earthly can override it
$Env:OUTPUT_ROOT ??= Join-Path $BuildRoot Modules

Expand Down
4 changes: 2 additions & 2 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
ARG --global EARTHLY_GIT_BRANCH
# These are my common paths, used in my shared /Tasks repo
ARG --global OUTPUT_ROOT=/Modules
ARG --global TEST_ROOT=/Tests
ARG --global TEST_ROOT=/tests
ARG --global TEMP_ROOT=/temp
# These are my common build args, used in my shared /Tasks repo
ARG --global MODULE_NAME=ErrorView
Expand Down Expand Up @@ -59,8 +59,8 @@
# BUILD +build
FROM +build
# Copy the test files here, so we can avoid rebuilding when iterating on tests
COPY --if-exists --dir Tests/ ScriptAnalyzerSettings.psd1 /work
COPY --if-exists --dir $TEST_ROOT ScriptAnalyzerSettings.psd1 /work
RUN ["pwsh", "-Command", "Invoke-Build", "-Task", "Test", "-File", "Build.build.ps1"]

Check failure on line 63 in Earthfile

View workflow job for this annotation

GitHub Actions / build

Error

The command RUN pwsh -Command Invoke-Build -Task Test -File Build.build.ps1 did not complete successfully. Exit code 1

# SAVE ARTIFACT [--keep-ts] [--keep-own] [--if-exists] [--force] <src> [<artifact-dest-path>] [AS LOCAL <local-path>]
SAVE ARTIFACT $TEST_ROOT AS LOCAL ./Modules/$MODULE_NAME-TestResults
Expand Down
14 changes: 14 additions & 0 deletions ErrorView.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"folders": [
{
"name": "ErrorView",
"path": "."
},
{
"path": "../../Tasks"
}
],
"settings": {
"powershell.cwd": "."
}
}
206 changes: 206 additions & 0 deletions Reference/FileInfo.format.ps1xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
<?xml version="1.0" encoding="utf-8"?>
<Configuration>
<ViewDefinitions>
<View>
<Name>children</Name>
<ViewSelectedBy>
<TypeName>System.IO.DirectoryInfo</TypeName>
</ViewSelectedBy>
<GroupBy>
<PropertyName>PSParentPath</PropertyName>
</GroupBy>
<TableControl>
<TableHeaders>
<TableColumnHeader>
<Label>Mode</Label>
<Width>7</Width>
<Alignment>Left</Alignment>
</TableColumnHeader>
<TableColumnHeader>
<Label>LastWriteTime</Label>
<Width>26</Width>
<Alignment>Right</Alignment>
</TableColumnHeader>
<TableColumnHeader>
<Label>Length</Label>
<Width>14</Width>
<Alignment>Right</Alignment>
</TableColumnHeader>
<TableColumnHeader>
<Label>Name</Label>
<Alignment>Left</Alignment>
</TableColumnHeader>
</TableHeaders>
<TableRowEntries>
<TableRowEntry>
<Wrap />
<TableColumnItems>
<TableColumnItem>
<PropertyName>ModeWithoutHardLink</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>LastWriteTimeString</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>LengthString</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>NameString</PropertyName>
</TableColumnItem>
</TableColumnItems>
</TableRowEntry>
</TableRowEntries>
</TableControl>
</View>
<View>
<Name>childrenWithHardlink</Name>
<ViewSelectedBy>
<TypeName>System.IO.DirectoryInfo</TypeName>
</ViewSelectedBy>
<GroupBy>
<PropertyName>PSParentPath</PropertyName>
</GroupBy>
<TableControl>
<TableHeaders>
<TableColumnHeader>
<Label>Mode</Label>
<Width>7</Width>
<Alignment>Left</Alignment>
</TableColumnHeader>
<TableColumnHeader>
<Label>LastWriteTime</Label>
<Width>26</Width>
<Alignment>Right</Alignment>
</TableColumnHeader>
<TableColumnHeader>
<Label>Length</Label>
<Width>14</Width>
<Alignment>Right</Alignment>
</TableColumnHeader>
<TableColumnHeader>
<Label>Name</Label>
<Alignment>Left</Alignment>
</TableColumnHeader>
</TableHeaders>
<TableRowEntries>
<TableRowEntry>
<Wrap />
<TableColumnItems>
<TableColumnItem>
<PropertyName>Mode</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>LastWriteTimeString</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>LengthString</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>NameString</PropertyName>
</TableColumnItem>
</TableColumnItems>
</TableRowEntry>
</TableRowEntries>
</TableControl>
</View>
<View>
<Name>children</Name>
<ViewSelectedBy>
<TypeName>System.IO.DirectoryInfo</TypeName>
</ViewSelectedBy>
<GroupBy>
<PropertyName>PSParentPath</PropertyName>
</GroupBy>
<ListControl>
<ListEntries>
<ListEntry>
<ListItems>
<ListItem>
<PropertyName>Name</PropertyName>
</ListItem>
<ListItem>
<PropertyName>CreationTime</PropertyName>
</ListItem>
<ListItem>
<PropertyName>LastWriteTime</PropertyName>
</ListItem>
<ListItem>
<PropertyName>LastAccessTime</PropertyName>
</ListItem>
<ListItem>
<PropertyName>Mode</PropertyName>
</ListItem>
<ListItem>
<PropertyName>LinkType</PropertyName>
</ListItem>
<ListItem>
<PropertyName>Target</PropertyName>
</ListItem>
</ListItems>
</ListEntry>
<ListEntry>
<EntrySelectedBy>
<TypeName>System.IO.FileInfo</TypeName>
</EntrySelectedBy>
<ListItems>
<ListItem>
<PropertyName>Name</PropertyName>
</ListItem>
<ListItem>
<Label>Length</Label>
<PropertyName>LengthString</PropertyName>
</ListItem>
<ListItem>
<PropertyName>CreationTime</PropertyName>
</ListItem>
<ListItem>
<PropertyName>LastWriteTime</PropertyName>
</ListItem>
<ListItem>
<PropertyName>LastAccessTime</PropertyName>
</ListItem>
<ListItem>
<PropertyName>Mode</PropertyName>
</ListItem>
<ListItem>
<PropertyName>LinkType</PropertyName>
</ListItem>
<ListItem>
<PropertyName>Target</PropertyName>
</ListItem>
<ListItem>
<PropertyName>VersionInfo</PropertyName>
</ListItem>
</ListItems>
</ListEntry>
</ListEntries>
</ListControl>
</View>
<View>
<Name>children</Name>
<ViewSelectedBy>
<TypeName>System.IO.DirectoryInfo</TypeName>
</ViewSelectedBy>
<GroupBy>
<PropertyName>PSParentPath</PropertyName>
</GroupBy>
<WideControl>
<WideEntries>
<WideEntry>
<WideItem>
<PropertyName>Name</PropertyName>
</WideItem>
</WideEntry>
<WideEntry>
<EntrySelectedBy>
<TypeName>System.IO.DirectoryInfo</TypeName>
</EntrySelectedBy>
<WideItem>
<PropertyName>Name</PropertyName>
</WideItem>
</WideEntry>
</WideEntries>
</WideControl>
</View>
</ViewDefinitions>
</Configuration>
1 change: 1 addition & 0 deletions Reference/LegacyErrorView.format.ps1xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?xml version="1.0" encoding="utf-8"?><Configuration><ViewDefinitions /></Configuration>
56 changes: 56 additions & 0 deletions Reference/NativeCommandError.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
$errorColor = ''
$commandPrefix = ''
if (@('NativeCommandErrorMessage','NativeCommandError') -notcontains $_.FullyQualifiedErrorId -and @('CategoryView','ConciseView','DetailedView') -notcontains $ErrorView)
{
$myinv = $_.InvocationInfo
if ($Host.UI.SupportsVirtualTerminal) {
$errorColor = $PSStyle.Formatting.Error
}

$commandPrefix = if ($myinv -and $myinv.MyCommand) {
switch -regex ( $myinv.MyCommand.CommandType )
{
([System.Management.Automation.CommandTypes]::ExternalScript)
{
if ($myinv.MyCommand.Path)
{
$myinv.MyCommand.Path + ' : '
}

break
}

([System.Management.Automation.CommandTypes]::Script)
{
if ($myinv.MyCommand.ScriptBlock)
{
$myinv.MyCommand.ScriptBlock.ToString() + ' : '
}

break
}
default
{
if ($myinv.InvocationName -match '^[&amp;\.]?$')
{
if ($myinv.MyCommand.Name)
{
$myinv.MyCommand.Name + ' : '
}
}
else
{
$myinv.InvocationName + ' : '
}

break
}
}
}
elseif ($myinv -and $myinv.InvocationName)
{
$myinv.InvocationName + ' : '
}
}

$errorColor + $commandPrefix
Loading
Loading