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

C# Compiler #3

Draft
wants to merge 223 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 203 commits
Commits
Show all changes
223 commits
Select commit Hold shift + click to select a range
69bcbeb
chore: WIP, feels like im getting somewhere.
DaRacci Apr 30, 2024
9a63319
feat: fix and complete span and span tests for now
DaRacci May 2, 2024
e9cd14c
chore: lots more work on compiler
DaRacci May 2, 2024
28bf846
test: implement tests for document and updater files
DaRacci May 3, 2024
58ee8e5
chore: debugger
DaRacci May 3, 2024
db5c929
feat(Compiler): ExactUpdater
DaRacci May 3, 2024
652018b
fix(Compiler): Ast Errors on parse
DaRacci May 3, 2024
2802932
refactor(Compiler): Add modules and some code rearranging updaters
DaRacci May 3, 2024
41008cd
chore: get logging working
DaRacci May 6, 2024
5f67ce5
test: new test for regex updater
DaRacci May 6, 2024
0f648d3
chore: work on multiline fix for regex
DaRacci May 7, 2024
94808f3
refactor: move requirements to seperate files
DaRacci May 14, 2024
5917c2f
fix: incorrect checks for errors
DaRacci May 14, 2024
7ce1e43
fix: indentation
DaRacci May 15, 2024
8a5c045
chore: debugging
DaRacci May 16, 2024
2f32f54
feat(Compiler): more tests and fixes to the regex updater
DaRacci May 16, 2024
7e79d41
fix(Compiler): Multiline regex strings
DaRacci May 20, 2024
cb5d9c8
test(Compiler): Coverage tests
DaRacci May 20, 2024
7991812
chore(Compiler): Coverage stuff
DaRacci May 21, 2024
ec48471
refactor(Compiler): lots more tests and refactoring
DaRacci May 23, 2024
e4bf649
fix(Compiler): PSVersion GetInsertableLine
DaRacci May 24, 2024
701799c
fix(Compiler): ModuleSpec MergeSpecs
DaRacci May 24, 2024
8834fe4
fix(Compiler): PSVersion IsCompatableWith tests
DaRacci May 24, 2024
426d513
fix(Compiler): Fix inline mode bug
DaRacci May 24, 2024
ea58f71
chore(Compiler): update launch.json
DaRacci May 24, 2024
b55fff7
fix(Compiler): Remove empty lines before anything else
DaRacci May 27, 2024
3c4ec55
fix(Compiler): Missaligned offset & Span issues
DaRacci May 27, 2024
cac8e69
chore: Remove coverage from git
DaRacci May 27, 2024
070c5bc
test(Compiler): Testing with entire script
DaRacci May 27, 2024
fa8952b
chore: add recommended extensions
DaRacci May 31, 2024
48713b9
refactor(Compiler): Change fix order
DaRacci May 31, 2024
410b334
chore(Compiler): Still not fully fixed
DaRacci May 31, 2024
5f1b3be
fix(Compiler): Regex for FixAndCleanLines functions
DaRacci Jun 3, 2024
2252c6d
refactor(Compiler): CompiledDocument Object
DaRacci Jun 3, 2024
abb1ce4
refactor(Compiler): Add support for using namespaces in CompiledScript
DaRacci Jun 5, 2024
4b62fad
fix: local modules are working now
DaRacci Jun 13, 2024
7f115ce
feat: big steps for remote modules and the loading process of them
DaRacci Jun 13, 2024
101aaa0
fix(Compiler): Last remaining bug in the regex updater i think.
DaRacci Jun 14, 2024
c1e2853
chore(Compiler): shorten log messages
DaRacci Jun 17, 2024
3e6eb7c
fix(Compiler): fix some edge cases for PatternUpdater and better tests
DaRacci Jun 17, 2024
a522c69
refactor(Compiler): module and namespaces cleanup and restructure
DaRacci Jun 17, 2024
b236865
fix(Compiler): Issue with multiline string fixer
DaRacci Jun 17, 2024
8ba6348
fix(Compiler): indetation should be part of the compile process not w…
DaRacci Jun 18, 2024
46a309b
feat(Compiler): Add priority to updaters.
DaRacci Jun 18, 2024
d960868
refactor(Compiler): Use of readonly compiled records
DaRacci Jun 18, 2024
a49d908
fix(Compiler): miss-spelling
DaRacci Jun 20, 2024
d4d7622
refactor(Compiler): fix requirements in imported modules and some oth…
DaRacci Jun 20, 2024
cedd3af
feat(Compiler): initial changes to ps1 env loader
DaRacci Jun 20, 2024
f5dca2b
fix(Compiler): indentation
DaRacci Jun 20, 2024
f9e5bdc
chore(Compiler): More fixes, and stuff. I did end up breaking some st…
DaRacci Jun 20, 2024
abcdbce
fix(Compiler): Some small fixes and a working hex zip extractor
DaRacci Jun 21, 2024
2efc2f0
chore: add test script for compiler testing
DaRacci Jun 25, 2024
e78af69
chore: Update module imports in common scripts
DaRacci Jun 25, 2024
bf56a38
fix(Compiler): Export modules to private path so we dont mix them wit…
DaRacci Jun 25, 2024
fab5fc7
refactor(Compiler): move weight to field that can be overriden
DaRacci Jun 28, 2024
849a83b
feat(Compiler): Lazily get remote module bytes
DaRacci Jun 28, 2024
3f3b8ce
refactor(Compiler): module hashcode is modulespecs
DaRacci Jun 28, 2024
ebbfa0f
refactor(Compiler): module resolver
DaRacci Jun 28, 2024
89a764d
refactor(Compiler): Remote Module caching and smart version lookup
DaRacci Jul 1, 2024
7dc93c0
fix(Compiler): Modules hash code not changing correctly.
DaRacci Jul 1, 2024
9801be8
fix: unrequired filtering
DaRacci Jul 3, 2024
ca0cf7e
refactor(Compiler): logging setup
DaRacci Jul 3, 2024
566eeac
feat(Compiler): More Ast Helper Methods
DaRacci Jul 3, 2024
d08c95c
test(Compiler): Some requirement tests
DaRacci Jul 3, 2024
19d3732
fix(Compiler): Exported modules detection
DaRacci Jul 4, 2024
d7d76ce
chore(Compiler): async is messing up printing order
DaRacci Jul 4, 2024
236281d
feat(Compiler): Unknown Function detection
DaRacci Jul 4, 2024
57eb538
refactor(Compiler): More analyser stuff
DaRacci Jul 4, 2024
cc3001a
chore: Update for compiler changes
DaRacci Jul 4, 2024
a077b63
test(Compiler): Update tests and fix some issues highlighted by them.
DaRacci Jul 5, 2024
f460679
chore(Compiler): Update logging for colour support and put debug/trac…
DaRacci Jul 5, 2024
67a371f
fix(Compiler): Importable command where excluding some seeminly rando…
DaRacci Jul 5, 2024
0929ef0
chore(docs): Add a little bit of documentation
DaRacci Jul 5, 2024
679128b
fix(Compiler): module comparison not correct
DaRacci Jul 5, 2024
5a7259a
refactor(Compiler): PrettyPrintAst support for multiline extents
DaRacci Jul 5, 2024
f8d2090
fix(Compiler): squigle and highlight regions
DaRacci Jul 5, 2024
99890ee
fix(Compiler): Fix returned nupkg path
DaRacci Jul 8, 2024
8204b9e
refactor(Compiler): Rewrite of module resolving and compiling.
DaRacci Jul 11, 2024
5897f88
fix(Compiler): fix documentation formatting
DaRacci Jul 11, 2024
9f825d0
chore: updates for compiler changes
DaRacci Jul 11, 2024
f2a46f2
chore(Compiler): update to testing script
DaRacci Jul 11, 2024
a74e2cc
refactor(Compiler): Remove internal Guid from modulespec
DaRacci Jul 12, 2024
6eb2cbe
refactor(Compiler): move updater to their own files
DaRacci Jul 12, 2024
1c447ec
test(Compiler): fix tests after rewrite.
DaRacci Jul 12, 2024
653a65b
feat(Compiler): Ast Updater
DaRacci Jul 15, 2024
f9a32ed
refactor(Compiler): User a template for the compiled script.
DaRacci Jul 15, 2024
b58a1d3
fix(Compiler): module comparison for pre-cached remotes
DaRacci Jul 16, 2024
aefa2a0
fix(Compiler): Formatting of last line in module definition
DaRacci Jul 16, 2024
bb51b7c
fix(Compiler): Version comparison issue
DaRacci Jul 16, 2024
8fccabf
fix(Compiler): Template, modules are a list now not a hashtable.
DaRacci Jul 16, 2024
0f74d9a
test(Compiler): more tests and fixes
DaRacci Jul 30, 2024
021e95e
refactor(Compiler): Hashing changes
DaRacci Jul 30, 2024
a99b4b6
chore: vscode stuff
DaRacci Jul 30, 2024
16c454b
fix(Compiler): Script Template
DaRacci Jul 30, 2024
11abaa1
fix(Compiler): Fix import names and add background resolving.
DaRacci Jul 30, 2024
d46a370
fix(Compiler): rename psd1 for remote modules so they actually work
DaRacci Jul 30, 2024
f9e11bc
chore: another module
DaRacci Jul 30, 2024
1e5f8ac
fix(Compiler): hash calculations
DaRacci Aug 1, 2024
7ab8160
fix(Compiler): the param block shouldn't be removed anymore
DaRacci Aug 1, 2024
23801f5
fix: environment & logging fixes
DaRacci Aug 1, 2024
91821e9
fix: script error handling
DaRacci Aug 1, 2024
e2b6df7
fix: get the actual error, no longer need to remove from here
DaRacci Aug 1, 2024
fc3c594
feat: add missing param block to script & cleanup modules better
DaRacci Aug 1, 2024
4f8434f
chore: use param for testing
DaRacci Aug 1, 2024
0430869
ci: sarif reports & c# compiler coverage
DaRacci Aug 1, 2024
e8fa95d
chore: rename common files
DaRacci Aug 1, 2024
c11f58b
chore: fix references to renamed common modules
DaRacci Aug 1, 2024
b67edfc
fix(Compiler): missreporting scoped functions as not available
DaRacci Aug 2, 2024
1fc2b67
refactor(Compiler): Implement verbosity and quiet flags
DaRacci Aug 2, 2024
e0615db
feat: WIP installer for all script requirements
DaRacci Aug 5, 2024
994162a
chore: migrate for new compiler
DaRacci Aug 5, 2024
857b1f2
refactor(Compiler): a little bit of cleaning
DaRacci Aug 5, 2024
3e46234
feat(Compiler): Analyser rules & Multi File Compiling
DaRacci Aug 5, 2024
3afeb04
feat(Compiler): Support multiple function names per suppression
DaRacci Aug 6, 2024
d895f67
feat(Compiler): Support * statements in exports from remote modules, …
DaRacci Aug 6, 2024
27a1f21
chore(Compiler): Less console spam
DaRacci Aug 6, 2024
c0ebf55
chore: more migrating
DaRacci Aug 6, 2024
32a8c0b
refactor(Compiler): Encode as base64 instead of hex for better file s…
DaRacci Aug 6, 2024
33b15f0
fix(Compiler): Keep directory tree for output
DaRacci Aug 6, 2024
e4ca161
fix(Compiler): Missing dll for some powershell modules during resolving
DaRacci Aug 6, 2024
ef5b861
chore(Compiler): no longer required
DaRacci Aug 6, 2024
2fda258
chore(Compiler): Update DotNet setup action to version 4 and add cach…
DaRacci Aug 6, 2024
2afe064
ci(Compiler): fix ci builder
DaRacci Aug 6, 2024
a7ac7ea
fix(Compiler): Get Suppressions working properly
DaRacci Aug 9, 2024
155cf0b
perf(Compiler): Cache analyser results
DaRacci Aug 9, 2024
661f569
fix(Compiler): Don't require windows only builds, include forms as a …
DaRacci Aug 9, 2024
e030bd4
refactor(ci): Upload artifact of compiler and some other fixes
DaRacci Aug 9, 2024
03ac253
fix(ci): super linter is really broken rn
DaRacci Aug 13, 2024
d978905
refactor(ci): ignore compiled
DaRacci Aug 13, 2024
cf8bb75
style(Compiler): Formatting and license headers
DaRacci Aug 26, 2024
d8718e8
feat(Compiler): Big refactor, cleanup and a few fixes.
DaRacci Aug 30, 2024
3e6729f
refactor(Compiler): Improve FindAvailableFunctions
DaRacci Sep 2, 2024
0300379
test(Compiler): Implement more tests for AstHelper methods.
DaRacci Sep 2, 2024
2fe569f
fix(Compiler): More async, fix race issues & more tests
DaRacci Sep 5, 2024
0d662bc
fix(Compiler): code coverage gen task
DaRacci Sep 5, 2024
ebd2d4d
fix(Compiler): End of Central Directory record could not be found.
DaRacci Sep 6, 2024
8b97da2
test(Compiler): More tests!
DaRacci Sep 6, 2024
64725f9
fix(Compiler): Not exiting when finished.
DaRacci Sep 6, 2024
bdd5ac1
fix(Compiler): Error when no script has no module dependencies.
DaRacci Sep 6, 2024
926c775
fix(Compiler): Compare functions ignore case
DaRacci Sep 6, 2024
aa0cdc9
fix(Compiler): Prevent error if verticies are modified while waiting.
DaRacci Sep 6, 2024
fbaabcb
fix(Compiler): Caching for Analyser
DaRacci Sep 12, 2024
f7f6a9e
refactor(Compiler): Improved Suppressions from ast
DaRacci Sep 12, 2024
100e79b
fix(Compiler): async issues and a little bit of refactoring
DaRacci Sep 12, 2024
5a07a21
fix(Compiler): module name for cleanup
DaRacci Sep 12, 2024
ac70a4f
test(Compiler): Add some new tests
DaRacci Sep 13, 2024
28d69f1
refactor(Compiler): Implement checking for aliases in UseOfUndefinedF…
DaRacci Sep 13, 2024
ac925b4
fix: Fixup modules for use with new compiler
DaRacci Sep 13, 2024
aaeadd5
fix(Compiler): Enriching of errors not actually working.
DaRacci Sep 16, 2024
3c6e712
refactor(Compiler): Read partial file when creating resolvables.
DaRacci Sep 16, 2024
e225bde
feat(Compiler): Output debuggable content when error occurs during As…
DaRacci Sep 16, 2024
e1a360a
refactor(Compiler): disable analyser dep calculation for key & better…
DaRacci Sep 20, 2024
7337fdb
fix(Compiler): Actually wait and report compiler errors
DaRacci Sep 20, 2024
2ec7f28
feat(Compiler): Add newline and comment removal updaters; refactor He…
DaRacci Sep 23, 2024
1bcd30c
fix(Compiler): Improve file deletion error handling and enhance error…
DaRacci Sep 23, 2024
3d1124f
feat(Compiler): Add support for extra module info JSON and enhance ex…
DaRacci Sep 23, 2024
6826163
fix(Compiler): Missing functions for ExchangeMangementOnline & PowerS…
DaRacci Sep 23, 2024
19b7165
fix(Compiler): misc script fixes for new compiler
DaRacci Sep 23, 2024
3538c92
fix(Compiler): fix export issue when running from powershell core
DaRacci Sep 24, 2024
49a4f61
fix(Compiler): Add Analyser.psm1 to all modules.
DaRacci Sep 26, 2024
639a684
fix(Compiler): Fix the NewLineRemovalUpdater and repurpose into White…
DaRacci Sep 26, 2024
2188ee7
fix(Compiler): Disable PublishTrimmed for compatibility with WinForms
DaRacci Sep 26, 2024
5ae30c6
fix(ci): prevent double build
DaRacci Sep 26, 2024
f4974f2
fix(ci): double builds on other workflows
DaRacci Sep 26, 2024
856770e
fix(Compiler): Update WhitespaceUpdater to include ModuleNotFoundDuri…
DaRacci Sep 26, 2024
0ff7667
fix(Compiler): Symbolic links
DaRacci Sep 26, 2024
89ea97f
fix(Compiler): Error displays
DaRacci Sep 27, 2024
207414c
fix(Compiler): Fix invalid exported resource files
DaRacci Sep 27, 2024
7e76642
feat(Compiler): Enhance error reporting with location details
DaRacci Sep 27, 2024
894bed0
chore(Compiler): Update launch and task configurations for script com…
DaRacci Sep 27, 2024
09cfad8
docs(CONTRIBUTING): add contributing guidelines and commit message fo…
DaRacci Sep 27, 2024
a59c25d
refactor(Compiler): Update SuppressAnalyserAttribute to improve error…
DaRacci Oct 21, 2024
d3b169e
fix(Compiler): Ensure only the first module is saved to the cache
DaRacci Oct 21, 2024
9bff89d
chore(Compiler): Package Lock Update
DaRacci Oct 21, 2024
9ee7bb0
feat(Analyser): Enhance rules with module support function.
DaRacci Oct 22, 2024
b827649
fix(Compiler): Fix race condition preventing all analysers to finish …
DaRacci Oct 22, 2024
ba6aaaa
feat(Analyser): Add MissingCmdlet rule to enforce CmdletBinding attri…
DaRacci Oct 22, 2024
ad84dfb
feat(Compiler): Better templating support.
DaRacci Oct 22, 2024
ac6e497
fix(Compiler): Fix assembly issues from pre-imported module versions …
DaRacci Oct 22, 2024
a5fe521
feat(Analyser): Enhance MissingCmdlet rule to provide detailed error …
DaRacci Oct 22, 2024
b2a9278
chore(Compiler): Update lock file
DaRacci Oct 22, 2024
6bec7e1
chore(Compiler): Another lock file update
DaRacci Oct 22, 2024
8d8e16d
chore(Compiler): Remove unused package references from lock files
DaRacci Oct 22, 2024
0bf202d
ci: fix build issues & update compiler workflow
DaRacci Oct 22, 2024
60ec564
Fix(Analyser): failing tests
DaRacci Oct 22, 2024
b7cb9ed
chore(Compiler): update PowerShell dependencies and clean up project …
DaRacci Oct 22, 2024
9140a05
fix(Analyser): Incorrect Variable check for compiled scripts
DaRacci Oct 23, 2024
10e43c3
refactor: If we dont have a validation check we shouldn't delete it
DaRacci Oct 23, 2024
6a41c20
fix: attribute issues
DaRacci Oct 23, 2024
55a95e3
feat: Add removal of imported modules back to non compiled scripts
DaRacci Oct 23, 2024
28bf4d2
refactor: the minimum required version is actually 2.3.2
DaRacci Oct 23, 2024
8e69dc5
fix: should not be using log in this module
DaRacci Oct 23, 2024
04e53b0
fix: Incorrect Registry Key Name
DaRacci Oct 23, 2024
6db7526
feat(Setup-Printer): Bultin Support for Konica Minolta Printers
DaRacci Oct 23, 2024
54ab1fc
feat(Get-InstalledSoftware): Allow only processing for select clients…
DaRacci Oct 23, 2024
f63f642
feat(Invoke-RebootNotice): Add time window parameter for reboot notic…
DaRacci Oct 24, 2024
c4baea0
style: formatting updates
DaRacci Oct 24, 2024
5186f5c
perf(Analyser): Cache functions and aliases between scans
DaRacci Oct 24, 2024
39330e7
refactor(Analyser): Mark the extent as the usage of PSCmdlet instead …
DaRacci Oct 24, 2024
7a5c04e
refactor(Compiler): Different colours for warnings vs errors
DaRacci Oct 24, 2024
ea65420
refactor(Connection): Enhance session management with connection IDs …
DaRacci Oct 24, 2024
43469af
chore: Script changes for new compilter
DaRacci Oct 24, 2024
98cad35
chore: Remove unfinished or scripts being replaced by CIPP
DaRacci Oct 24, 2024
f38bf69
fix: Incorrect command usage
DaRacci Oct 25, 2024
e28cd78
fix(Compiler): Prevent the template from being picked up for compiling
DaRacci Oct 25, 2024
111b11c
fix(Compiler): Fix missing parents for debuggable files
DaRacci Oct 25, 2024
981a64c
feat(Compiler): Summary of files with errors and where to find them.
DaRacci Oct 25, 2024
d5a2a37
fix: missing cmdletbinding
DaRacci Oct 25, 2024
b263ca6
feat(ExternalScripts): Add external script management with patching s…
DaRacci Oct 29, 2024
027c758
fix: error due to env being removed before possible restart of script
DaRacci Oct 29, 2024
282f6e3
fix(Compiler): Inconsistent module resolving
DaRacci Oct 29, 2024
6f50ce5
chore: upgrade target framework to net9.0-windows
DaRacci Oct 29, 2024
7b2a75f
ci: update dotnet version for building
DaRacci Oct 29, 2024
abb2a34
chore: remove deprecated script
DaRacci Oct 29, 2024
fe87f80
feat(Compiler): Add Export Definitions for AzureAD
DaRacci Oct 31, 2024
94f28e3
refactor(Compiler): Improve Thread Safety in ResolvableParent.
DaRacci Nov 1, 2024
b476205
refactor(Compiler): Cache instances of ExtraModuleInfo
DaRacci Nov 1, 2024
1e63404
fix(Compiler): Fix inconsistency of ComputedHash
DaRacci Nov 1, 2024
fa3de39
fix(Compiler): Empty name when compiling a single script
DaRacci Nov 1, 2024
8183a75
refactor: Rename schemas files to has suffixed with .schema.jsonc
DaRacci Nov 1, 2024
cd63fb5
test(Compiler): Add unit tests for Program and enhance test utilities
DaRacci Nov 1, 2024
3bdfc13
refactor(Compiler): Handle issues with input better & tests
DaRacci Nov 5, 2024
9d57ed9
fix: Fix crash while outputting file and implement additional tests
DaRacci Nov 7, 2024
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
374 changes: 374 additions & 0 deletions .editorconfig

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build Compiler

on:
push:
branches: [ master ]
paths: ["src/**", ".github/workflows/build.yaml"]
pull_request:
paths: ["src/**", ".github/workflows/build.yaml"]
workflow_call:
outputs:
artifact:
value: ${{ github.inputs.artifact }}
description: 'The artifact that was built'


jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4

- name: Setup DotNet
uses: actions/setup-dotnet@v4
with:
cache: true
dotnet-version: 8.0.x
cache-dependency-path: "src/Compiler/packages.lock.json"

- name: Install dependencies
run: dotnet restore --locked-mode -r win-x64

- name: Build
run: dotnet publish ./src/Compiler/Compiler.csproj --sc -c Release -r win-x64

- uses: actions/upload-artifact@v4
with:
name: Compiler
path: ./src/Compiler/bin/Release/win-x64/publish/Compiler.exe
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@ name: Compiler
on:
push:
branches: [master]
paths:
- "src/**"
- "compiled/**"
- "utils/Compiler.ps1"
- ".github/workflows/compiler.yaml"
paths: [ "src/**/*.ps1", ".github/workflows/compile-scripts.yaml" ]
pull_request:
paths: ["src/**", "compiled/**", "utils/Compiler.ps1"]
paths: [ "src/**/*.ps1", ".github/workflows/compile-scripts.yaml" ]

jobs:
changes:
Expand All @@ -23,8 +19,6 @@ jobs:
uses: actions/checkout@v4

# Checks for changes in the 'compiled' and 'src' directories
# We include 'utils/Compiler.ps1' in the 'src' directory incase it is modified
# As this can affect all scripts in the src directory.
# We also check for deleted files so we can cleanup the compiled directory
- name: Collect Changes for Upcoming Jobs
uses: dorny/[email protected]
Expand All @@ -35,25 +29,9 @@ jobs:
compiled:
- 'compiled/**'
src:
- 'src/**'
- 'utils/Compiler.ps1'
- 'src/**/*.(ps1|psm1)'
src_deleted:
- deleted: 'src/**'

protect-directory:
runs-on: ubuntu-latest
needs: changes
# Only run if changes have been made to the 'compiled' directory
if: ${{ needs.changes.outputs.compiled == 'true' && github.actor != 'github-actions' }}
steps:
- name: Checkout
uses: actions/checkout@v4

# Don't run if the push was forced, as this is likely a cleanup.
- if: ${{ github.event_name != 'push' && !github.event.forced }}
run: |
echo "Manual changes to 'compiled' directory are not allowed."
exit 1
- deleted: 'src/**/*.(ps1|psm1)'

cleanup-directory:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -83,19 +61,29 @@ jobs:
with:
commit_message: "chore(compiled): Remove compiled versions of deleted files"

build:
uses: ./.github/workflows/build.yaml

compile-scripts:
runs-on: ubuntu-latest
needs: changes
runs-on: windows-latest
needs: [changes, build]
if: ${{ needs.changes.outputs.src == 'true' }}
permissions:
contents: write

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Compile Scripts
shell: pwsh
run: ./utils/Invoke-CompileAllScripts.ps1 -Debug -Verbose
- name: Download Compiler Artifact
uses: dawidd6/action-download-artifact@v6
with:
workflow: build.yaml
workflow_conclusion: success
name: Compiler

- name: Run Compiler
run: .\Compiler.exe -i .\src -o .\compiled

- name: Commit Changes
if: ${{ needs.changes.outputs.src == 'true' && github.event_name == 'push' }}
Expand Down
18 changes: 12 additions & 6 deletions .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ name: Documentaion

on:
push:
branches: [ master ]
paths: [ 'docs/**', 'src/**', 'utils/Generate-Documentation.ps1', '.github/workflows/documentation.yaml' ]
pull_request:
paths: [ 'docs/**', 'src/**' ]
branches: [master]
paths:
[
"docs/**",
"src/**",
"utils/Generate-Documentation.ps1",
".github/workflows/documentation.yaml",
]

jobs:
update_docs:
Expand All @@ -23,7 +27,9 @@ jobs:

- name: Generate Documentation
shell: pwsh
run: .\utils\Generate-Documentation.ps1
run: |
Install-Module -Name platyPS -Scope CurrentUser
.\utils\Generate-Documentation.ps1

- name: Check for changes
id: changes
Expand All @@ -43,7 +49,7 @@ jobs:
name: Deploy Documentation
runs-on: ubuntu-latest
needs: update_docs
if : ${{ github.event_name == 'push' && needs.update_docs.outputs.changes.docs == 'true' }}
if: ${{ github.event_name == 'push' && needs.update_docs.outputs.changes.docs == 'true' }}
permissions:
contents: read
pull-requests: read
Expand Down
59 changes: 46 additions & 13 deletions .github/workflows/linter.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,58 @@
name: Lint

on: [workflow_dispatch]
on:
pull_request:
paths: ["src/**", "tests/**", "utils/**", ".github/workflows/**"]
push:
branches: [master]
paths: ["src/**", "tests/**", "utils/**", ".github/workflows/**"]

jobs:
lint:
name: Lint
powershell:
name: PowerShell Lint
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
statuses: write
security-events: write
actions: read
steps:
- name: Checkout repository
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Super-Linter
uses: super-linter/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
EDITORCONFIG_FILE_NAME: ".editorconfig"
POWERSHELL_CONFIG_FILE: "PSScriptAnalyzerSettings.psd1"
FILTER_REGEX_EXCLUDE: ".*compiled/.*|.*docs/.*|LICENSE"
- name: Run PSScriptAnalyzer
uses: microsoft/psscriptanalyzer-action@main
with:
path: .\
recurse: true
ignorePattern: '"n-sight/cleaners", "compiled/"'
settings: .\PSScriptAnalyzerSettings.psd1
output: results.sarif

- name: Upload SARIF results
uses: github/codeql-action/upload-sarif@v3
if: ${{ always() }}
with:
sarif_file: results.sarif

# lint:
# name: Lint
# runs-on: ubuntu-latest
# permissions:
# contents: read
# packages: read
# statuses: write
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# with:
# fetch-depth: 0

# - name: Super-Linter
# uses: super-linter/[email protected]
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# POWERSHELL_CONFIG_FILE: .\PSScriptAnalyzerSettings.psd1
# FILTER_REGEX_EXCLUDE: ".*compiled/.*|.*docs/.*|LICENSE"
# SAVE_SUPER_LINTER_OUTPUT: true
5 changes: 4 additions & 1 deletion .github/workflows/scan-secrets.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Scan for Secrets

on: [pull_request, push]
on:
push:
branches: [ master ]
pull_request:

jobs:
secrets-scan:
Expand Down
21 changes: 0 additions & 21 deletions .github/workflows/test-scripts.yaml

This file was deleted.

59 changes: 59 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Tests

on:
push:
branches: [master]
paths: ["src/**", "tests/**", ".github/workflows/test.yaml"]
pull_request:
paths: ["src/**", "tests/**", ".github/workflows/test.yaml"]

jobs:
test-compiler:
runs-on: windows-latest
permissions:
contents: read

steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup DotNet
uses: actions/setup-dotnet@v4
with:
cache: true
dotnet-version: 8.0.x
cache-dependency-path: "src/Compiler/packages.lock.json"

- name: Install dependencies
run: dotnet restore --locked-mode -r win-x64

- name: Test & Collect lcov coverage
run: dotnet test --logger trx /p:CollectCoverage=true /p:CoverletOutput=Coverage/ /p:CoverletOutputFormat=lcov

- name: Upload coverage artifact
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: dotnet-coverage
path: ./tests/Compiler/coverage.info

test-scripts:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install Dependencies
shell: pwsh
run: |
Install-Module -Name Pester -Scope CurrentUser -Force

- name: Run Pester Tests
shell: pwsh
run: .\utils\Invoke-CodeCoverage.ps1
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.direnv
obj
bin
Output
coverage_report
TestResults
coverage.info
12 changes: 8 additions & 4 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
{
"recommendations": [
"pspester.pester-test",
"markis.code-coverage",
"editorconfig.editorconfig",
"formulahendry.code-runner",
"ironmansoftware.powershellprotools",
"markis.code-coverage",
"ms-dotnettools.csdevkit",
"ms-dotnettools.csharp",
"ms-vscode.powershell",
"pspester.pester-test",
"ruschaaf.extended-embedded-languages",
"tylerleonhardt.vscode-inline-values-powershell",
"ironmansoftware.powershellprotools",
"ms-vscode.powershell"
"vadimcn.vscode-lldb",
]
}
Loading
Loading