Skip to content

Commit b96fd92

Browse files
CopilotCopilotJustinGrote
authored
✨ Convert to binary module (#114)
Transition the project to C# by implementing core functionalities as binary cmdlets, enhancing performance and maintainability. This includes the addition of a new project structure, improved caching mechanisms, and support for NuGet package management. Update tests and documentation to reflect these changes. Also add initial AOT support Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: JustinGrote <15258962+JustinGrote@users.noreply.github.com> Co-authored-by: Justin Grote <justingrote@users.noreply.github.com>
1 parent 4e1c2f8 commit b96fd92

40 files changed

Lines changed: 4667 additions & 2503 deletions

‎.devcontainer/devcontainer.json‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/dotnet
3+
{
4+
"name": "ModuleFast",
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
"image": "mcr.microsoft.com/devcontainers/dotnet:2-10.0-noble",
7+
"features": {
8+
// "ghcr.io/devcontainers-extra/features/powershell:1": {}
9+
}
10+
11+
// Features to add to the dev container. More info: https://containers.dev/features.
12+
// "features": {},
13+
14+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
15+
// "forwardPorts": [5000, 5001],
16+
// "portsAttributes": {
17+
// "5001": {
18+
// "protocol": "https"
19+
// }
20+
// }
21+
22+
// Use 'postCreateCommand' to run commands after the container is created.
23+
// "postCreateCommand": "dotnet restore",
24+
25+
// Configure tool-specific properties.
26+
// "customizations": {},
27+
28+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
29+
// "remoteUser": "root"
30+
}

‎.editorconfig‎

Lines changed: 390 additions & 0 deletions
Large diffs are not rendered by default.

‎.github/copilot-instructions.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Testing
2+
- Run `Invoke-Build Test` for tests. To run an individual test, run `Invoke-Build Test -TestName <test name>`.
3+
- To run ModuleFast directly, use `Start-Job -ScriptBlock { Import-Module .\modulefast.psm1; <Your test code here> } | Receive-Job -Wait -AutoRemoveJob` to avoid module locking issues.
4+
5+
# Style
6+
Read `.editorconfig` for style rules and indentation. Run `dotnet format` after making changes to C# files to update the formatting.

‎.github/dependabot.yml‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for more information:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
# https://containers.dev/guide/dependabot
6+
7+
version: 2
8+
updates:
9+
- package-ecosystem: devcontainers
10+
directory: /
11+
schedule:
12+
interval: weekly
13+
- package-ecosystem: nuget
14+
directory: /
15+
schedule:
16+
interval: weekly
17+
- package-ecosystem: dotnet-sdk
18+
directory: /
19+
schedule:
20+
interval: weekly

‎.github/workflows/ci.yml‎

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: ♻️ ModuleFast CI
2+
3+
on:
4+
push:
5+
branches:
6+
- '*'
7+
tags:
8+
- 'v[0-9]*.[0-9]*.[0-9]*'
9+
pull_request:
10+
branches: [ main ]
11+
12+
defaults:
13+
run:
14+
shell: pwsh
15+
16+
jobs:
17+
build:
18+
name: 👷 Build
19+
runs-on: ubuntu-24.04
20+
outputs:
21+
nupkg_artifact_id: ${{ steps.upload_nupkg.outputs.artifact-id }}
22+
steps:
23+
- name: 🚚 Checkout
24+
uses: actions/checkout@v7
25+
with:
26+
fetch-depth: 0
27+
- name: ⚡ Setup .NET
28+
uses: actions/setup-dotnet@v5
29+
30+
- name: ⚡ Cache NuGet packages
31+
uses: actions/cache@v6
32+
with:
33+
path: |
34+
~/.nuget/packages
35+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json', '**/Directory.Packages.props') }}
36+
restore-keys: |
37+
${{ runner.os }}-nuget-
38+
- name: 👷 Build & Package
39+
env:
40+
MODULEVERSION: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || null }}
41+
run: |
42+
try { ./build.ps1 BuildNoTest }
43+
catch {
44+
"::error::Build failed: $($_.Exception.Message)`n$(Get-Error | Out-String)" -replace "`n","%0A"
45+
throw
46+
}
47+
- name: 📤 Upload Module
48+
uses: actions/upload-artifact@v7
49+
with:
50+
name: ModuleFast
51+
path: ./Artifacts/Module
52+
- name: 📤 Upload Nupkg
53+
id: upload_nupkg
54+
uses: actions/upload-artifact@v7
55+
with:
56+
name: ModuleFast-nupkg
57+
path: ./Artifacts/*.nupkg
58+
archive: false
59+
60+
test:
61+
name: 🧪 Test (${{ matrix.os }})
62+
needs: build
63+
strategy:
64+
fail-fast: false
65+
matrix:
66+
os: [ubuntu-24.04, windows-2025]
67+
runs-on: ${{ matrix.os }}
68+
steps:
69+
- name: 🚚 Checkout
70+
uses: actions/checkout@v7
71+
- name: 📥 Download Module
72+
uses: actions/download-artifact@v8
73+
with:
74+
name: ModuleFast
75+
path: ./Artifacts/Module
76+
- name: 🧪 Test
77+
run: |
78+
$errorView = 'DetailedView'
79+
.\build.ps1 Pester
80+
81+
publish:
82+
name: 🚢 Publish to PowerShell Gallery
83+
if: startsWith(github.ref, 'refs/tags/v')
84+
needs: [build, test]
85+
environment:
86+
name: PowerShell Gallery
87+
url: https://www.powershellgallery.com/packages/ModuleFast
88+
runs-on: ubuntu-24.04
89+
steps:
90+
- name: 📥 Download Nupkg
91+
uses: actions/download-artifact@v8
92+
with:
93+
artifact-ids: ${{ needs.build.outputs.nupkg_artifact_id }}
94+
path: ./Release
95+
- name: 🚢 Publish to PowerShell Gallery
96+
env:
97+
PSGALLERY_API_KEY: ${{ secrets.PSGALLERY }}
98+
run: |
99+
$DebugPreference = 'Continue'
100+
$VerbosePreference = 'Continue'
101+
102+
$nupkg = Get-ChildItem -Path ./Release/*.nupkg
103+
if ($nupkg.Count -eq 0) {
104+
throw "No nupkg found in Release directory"
105+
} elseif ($nupkg.Count -gt 1) {
106+
throw "Multiple nupkg files found: $($nupkg.FullName -join ', ')"
107+
}
108+
109+
Register-PSResourceRepository -PSGallery -Force
110+
Publish-PSResource -Nupkg $nupkg.FullName -ApiKey $env:PSGALLERY_API_KEY

‎.gitignore‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
Build
2-
artifacts
1+
/[aA]rtifacts

‎.vscode/launch.json‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "PowerShell: Binary Module Interactive",
5+
"type": "PowerShell",
6+
"request": "launch",
7+
"createTemporaryIntegratedConsole": true,
8+
"attachDotnetDebugger": true
9+
},
10+
{
11+
"name": "ModuleFast: Pester",
12+
"type": "PowerShell",
13+
"request": "launch",
14+
"script": "Invoke-Build Test",
15+
"createTemporaryIntegratedConsole": true
16+
}
17+
]
18+
}

‎.vscode/tasks.json‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "build",
6+
"type": "shell",
7+
"command": "Invoke-Build",
8+
"args": [
9+
"Build"
10+
],
11+
"group": {
12+
"isDefault": true,
13+
"kind": "build"
14+
},
15+
"presentation": {
16+
"reveal": "silent"
17+
},
18+
"problemMatcher": "$msCompile"
19+
}
20+
]
21+
}

‎Directory.Build.props‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<Project>
2+
<PropertyGroup>
3+
<!-- Use the .NET SDK Artifacts Output Layout: all bin/obj go to artifacts/ -->
4+
<UseArtifactsOutput>true</UseArtifactsOutput>
5+
<ArtifactsPath>$(MSBuildThisFileDirectory)/Artifacts</ArtifactsPath>
6+
</PropertyGroup>
7+
</Project>

‎Directory.Packages.props‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Project>
2+
<PropertyGroup>
3+
<!-- Central Package Management: all NuGet versions defined here -->
4+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
5+
</PropertyGroup>
6+
<ItemGroup>
7+
<PackageVersion Include="System.Management.Automation" Version="7.6.0" />
8+
<PackageVersion Include="NuGet.Protocol" Version="7.6.0" />
9+
<PackageVersion Include="NuGet.Versioning" Version="7.6.0" />
10+
<PackageVersion Include="Polly.Core" Version="8.7.0" />
11+
</ItemGroup>
12+
</Project>

0 commit comments

Comments
 (0)