зеркало из https://github.com/microsoft/PSRule.git
Add binary build for tool (#1871)
This commit is contained in:
Родитель
809f0e4cc1
Коммит
2a844a7f03
|
@ -24,7 +24,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PSRule.Types", "src\PSRule.Types\PSRule.Types.csproj", "{5FE4DB0B-63D1-4DDB-9762-9C0D29168BC9}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PSRule.BuildTask", "src\PSRule.BuildTask\PSRule.BuildTask.csproj", "{872D2648-2F00-475E-84B5-F08BE07385B7}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PSRule.MSBuild", "src\PSRule.MSBuild\PSRule.MSBuild.csproj", "{872D2648-2F00-475E-84B5-F08BE07385B7}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{E0EA0CBA-96C5-4447-8B69-BC13EF0D7A4A}"
|
||||
EndProject
|
||||
|
|
|
@ -131,12 +131,31 @@ task TestDotNet {
|
|||
task BuildCLI BuildModule, {
|
||||
exec {
|
||||
# Build library
|
||||
dotnet publish src/PSRule.Tool -c $Configuration --self-contained /p:DebugType=None /p:DebugSymbols=false -r win-x64 -o ./out/cli/win-x64/ -p:version=$Build
|
||||
# dotnet publish src/PSRule.Tool -c $Configuration --no-self-contained -r win-x64 -o ./out/cli/win-x64/ -p:version=$Build
|
||||
# dotnet publish --self-contained true -p:PublishTrimmed=true -p:PublishSingleFile=true -r win-x64 .\src\PSRule.Tool\PSRule.Tool.csproj -o .\out\cli
|
||||
dotnet publish src/PSRule.Tool -c $Configuration --self-contained true -o ./out/cli/build/ -p:version=$Build
|
||||
}
|
||||
}
|
||||
|
||||
task ReleaseCLI BuildModule, {
|
||||
|
||||
# Build win-x64
|
||||
exec {
|
||||
dotnet publish src/PSRule.Tool -c $Configuration --self-contained true --runtime win-x64 -o ./out/cli/win-x64/ -p:version=$Build
|
||||
}
|
||||
|
||||
# Copy-Item -Path out/modules/PSRule/ -Destination out/cli/win-x64/modules/ -Recurse -Force;
|
||||
# Build linux-x64
|
||||
exec {
|
||||
dotnet publish src/PSRule.Tool -c $Configuration --self-contained true --runtime linux-x64 -o ./out/cli/linux-x64/ -p:version=$Build
|
||||
}
|
||||
|
||||
# Build linux-musl-x64
|
||||
exec {
|
||||
dotnet publish src/PSRule.Tool -c $Configuration --self-contained true --runtime linux-musl-x64 -o ./out/cli/linux-musl-x64/ -p:version=$Build
|
||||
}
|
||||
|
||||
# Build osx-x64
|
||||
exec {
|
||||
dotnet publish src/PSRule.Tool -c $Configuration --self-contained true --runtime osx-x64 -o ./out/cli/osx-x64/ -p:version=$Build
|
||||
}
|
||||
}
|
||||
|
||||
task CopyModule {
|
||||
|
@ -313,7 +332,7 @@ task TestModule Dependencies, {
|
|||
}
|
||||
}
|
||||
|
||||
# Synopsis: Run validation
|
||||
# Synopsis: Run self-test validation.
|
||||
task Rules {
|
||||
$assertParams = @{
|
||||
Path = './.ps-rule/'
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
|
||||
info:
|
||||
name: PSRule
|
||||
description: |
|
||||
A cross-platform PowerShell module (Windows, Linux, and MacOS) with commands to validate objects on the pipeline using PowerShell syntax.
|
||||
url: https://microsoft.github.io/PSRule/
|
||||
|
||||
repository:
|
||||
type: git
|
||||
url: https://github.com/Microsoft/PSRule.git
|
||||
|
||||
bugs:
|
||||
url: https://github.com/Microsoft/PSRule/issues
|
||||
|
||||
tasks:
|
||||
clear:
|
||||
steps:
|
||||
- gitPrune:
|
||||
name: origin
|
||||
removeGone: true
|
||||
build:
|
||||
steps:
|
||||
- powershell: Invoke-Build Build
|
|
@ -3,9 +3,6 @@
|
|||
"modules": {
|
||||
"PSRule.Rules.MSFT.OSS": {
|
||||
"version": "1.1.0"
|
||||
},
|
||||
"PSRule.Rules.Azure": {
|
||||
"version": "1.30.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
28
ps-rule.yaml
28
ps-rule.yaml
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# PSRule configuration
|
||||
# PSRule configuration.
|
||||
#
|
||||
|
||||
# Please see the documentation for all configuration options:
|
||||
|
@ -11,32 +11,26 @@ repository:
|
|||
|
||||
output:
|
||||
culture:
|
||||
- 'en-US'
|
||||
- en-US
|
||||
|
||||
input:
|
||||
pathIgnore:
|
||||
- '.vscode/'
|
||||
- '.github/workflows/'
|
||||
- .vscode/
|
||||
- .github/
|
||||
- docs/
|
||||
- overrides/
|
||||
- '*.md'
|
||||
- '*.Designer.cs'
|
||||
- '*.resx'
|
||||
- '*.sln'
|
||||
- '*.txt'
|
||||
- '*.html'
|
||||
- '*.ico'
|
||||
- '*.png'
|
||||
- 'ps-docs.yaml'
|
||||
- 'ps-project.yaml'
|
||||
- 'ps-rule.yaml'
|
||||
- 'mkdocs.yml'
|
||||
- '**/.editorconfig'
|
||||
- '.markdownlint.json'
|
||||
- '.github/dependabot.yml'
|
||||
|
||||
- '**/launchSettings.json'
|
||||
- '**/Resources/*.json'
|
||||
|
||||
# Bug #1269: There is an issue preventing #1259 from being merged. Ignore this until bug is fixed.
|
||||
- 'docs/scenarios/containers/dockerfile'
|
||||
- '**/tests/**/*.json'
|
||||
- ps-rule.yaml
|
||||
- mkdocs.yml
|
||||
- .markdownlint.json
|
||||
|
||||
include:
|
||||
path: []
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
|
||||
<RestoreLockedMode Condition="'$(CI)' == 'true'">true</RestoreLockedMode>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Package metadata -->
|
|
@ -1,5 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\PSRule.Common.props" />
|
||||
<PropertyGroup>
|
||||
<AssemblyName>Microsoft.PSRule.Badges</AssemblyName>
|
||||
<RootNamespace>PSRule.Badges</RootNamespace>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\PSRule.Common.props" />
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
|
@ -10,19 +9,12 @@
|
|||
<GenerateDocumentationFile>false</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'">
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
|
||||
<DefineConstants>TRACE;BENCHMARK</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(OS)' != 'Windows_NT'">
|
||||
<PackageReference Include="BenchmarkDotNet" Version="0.13.12" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(OS)' == 'Windows_NT'">
|
||||
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.13.12" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BenchmarkDotNet" Version="0.13.12" />
|
||||
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.4.1" />
|
||||
<PackageReference Include="System.Management.Automation" Version="7.4.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.CommandLineUtils" Version="1.1.1" />
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
# PSRule benchmarks
|
||||
|
||||
This is used to perform internal benchmarks of the PSRule engine under various scenarios.
|
|
@ -2,14 +2,22 @@
|
|||
"version": 1,
|
||||
"dependencies": {
|
||||
"net8.0": {
|
||||
"BenchmarkDotNet.Diagnostics.Windows": {
|
||||
"BenchmarkDotNet": {
|
||||
"type": "Direct",
|
||||
"requested": "[0.13.12, )",
|
||||
"resolved": "0.13.12",
|
||||
"contentHash": "HdARbwcGFymgrSFoLVtuJaacyNW9WLuGljX0hsTarSO+80nI2OmbDS09R+I9kIeJ8Gn/1zJFjKgefmAlADhlww==",
|
||||
"contentHash": "aKnzpUZJJfLBHG7zcfQZhCexZQKcJgElC8qcFUTXPMYFlVauJBobuOmtRnmrapqC2j7EjjZCsPxa3yLvFLx5/Q==",
|
||||
"dependencies": {
|
||||
"BenchmarkDotNet": "0.13.12",
|
||||
"Microsoft.Diagnostics.Tracing.TraceEvent": "3.0.2"
|
||||
"BenchmarkDotNet.Annotations": "0.13.12",
|
||||
"CommandLineParser": "2.9.1",
|
||||
"Gee.External.Capstone": "2.3.0",
|
||||
"Iced": "1.17.0",
|
||||
"Microsoft.CodeAnalysis.CSharp": "4.1.0",
|
||||
"Microsoft.Diagnostics.Runtime": "2.2.332302",
|
||||
"Microsoft.Diagnostics.Tracing.TraceEvent": "3.0.2",
|
||||
"Microsoft.DotNet.PlatformAbstractions": "3.1.6",
|
||||
"Perfolizer": "[0.2.1]",
|
||||
"System.Management": "5.0.0"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.CommandLineUtils": {
|
||||
|
@ -83,23 +91,6 @@
|
|||
"System.Text.Encoding.CodePages": "8.0.0"
|
||||
}
|
||||
},
|
||||
"BenchmarkDotNet": {
|
||||
"type": "Transitive",
|
||||
"resolved": "0.13.12",
|
||||
"contentHash": "aKnzpUZJJfLBHG7zcfQZhCexZQKcJgElC8qcFUTXPMYFlVauJBobuOmtRnmrapqC2j7EjjZCsPxa3yLvFLx5/Q==",
|
||||
"dependencies": {
|
||||
"BenchmarkDotNet.Annotations": "0.13.12",
|
||||
"CommandLineParser": "2.9.1",
|
||||
"Gee.External.Capstone": "2.3.0",
|
||||
"Iced": "1.17.0",
|
||||
"Microsoft.CodeAnalysis.CSharp": "4.1.0",
|
||||
"Microsoft.Diagnostics.Runtime": "2.2.332302",
|
||||
"Microsoft.Diagnostics.Tracing.TraceEvent": "3.0.2",
|
||||
"Microsoft.DotNet.PlatformAbstractions": "3.1.6",
|
||||
"Perfolizer": "[0.2.1]",
|
||||
"System.Management": "5.0.0"
|
||||
}
|
||||
},
|
||||
"BenchmarkDotNet.Annotations": {
|
||||
"type": "Transitive",
|
||||
"resolved": "0.13.12",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\PSRule.Common.props" />
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
# PSRule Build Tool
|
||||
|
||||
This tool is used for preparing specific artifacts prior to building PSRule solution.
|
|
@ -1,5 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\PSRule.Common.props" />
|
||||
<PropertyGroup>
|
||||
<AssemblyName>Microsoft.PSRule.CommandLine</AssemblyName>
|
||||
<PackageId>Microsoft.PSRule.CommandLine</PackageId>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
using Microsoft.CodeAnalysis;
|
||||
|
||||
namespace PSRule.BuildTask.Generators;
|
||||
namespace PSRule.MSBuild.Generators;
|
||||
|
||||
/// <summary>
|
||||
/// Generator constants for PSRule engine version.
|
|
@ -1,7 +1,6 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\PSRule.Common.props" />
|
||||
<PropertyGroup>
|
||||
<AssemblyTitle>PSRule.BuildTask</AssemblyTitle>
|
||||
<AssemblyTitle>PSRule.MSBuild</AssemblyTitle>
|
||||
<EnableNuget>false</EnableNuget>
|
||||
<IsPackable>false</IsPackable>
|
||||
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
|
|
@ -0,0 +1,3 @@
|
|||
# PSRule MSBuild tasks
|
||||
|
||||
This library exposes some internal build tasks used during PSRule build process.
|
|
@ -1,5 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\PSRule.Common.props" />
|
||||
<PropertyGroup>
|
||||
<AssemblyName>Microsoft.PSRule.SDK</AssemblyName>
|
||||
<PackageId>Microsoft.PSRule.SDK</PackageId>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\PSRule.Common.props" />
|
||||
<PropertyGroup>
|
||||
<AssemblyName>Microsoft.PSRule.Tool</AssemblyName>
|
||||
<PackageId>Microsoft.PSRule.Tool</PackageId>
|
||||
|
@ -16,12 +15,10 @@
|
|||
<PackAsTool>true</PackAsTool>
|
||||
<ToolCommandName>ps-rule</ToolCommandName>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
<RuntimeIdentifiers>win-x64;linux-x64;linux-musl-x64;osx-x64</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- <PackageReference Include="Microsoft.PowerShell.SDK" Version="7.4.1" />
|
||||
<PackageReference Include="System.Management.Automation" Version="7.4.1" />
|
||||
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" /> -->
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,5 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\PSRule.Common.props" />
|
||||
<PropertyGroup>
|
||||
<AssemblyName>Microsoft.PSRule.Types</AssemblyName>
|
||||
<RootNamespace>PSRule</RootNamespace>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\PSRule.Common.props" />
|
||||
<PropertyGroup>
|
||||
<AssemblyName>Microsoft.PSRule.Core</AssemblyName>
|
||||
<RootNamespace>PSRule</RootNamespace>
|
||||
|
@ -24,9 +23,9 @@
|
|||
<!-- Add code generators -->
|
||||
<ItemGroup>
|
||||
<CompilerVisibleProperty Include="PSRule_Version" />
|
||||
<ProjectReference Include="..\PSRule.BuildTask\PSRule.BuildTask.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
|
||||
<ProjectReference Include="..\PSRule.MSBuild\PSRule.MSBuild.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<PropertyGroup>
|
||||
<PSRule_Version>$(version)</PSRule_Version>
|
||||
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
|
||||
|
|
|
@ -1565,9 +1565,9 @@ Describe 'Test-PSRuleTarget' -Tag 'Test-PSRuleTarget','Common' {
|
|||
Describe 'Get-PSRuleTarget' -Tag 'Get-PSRuleTarget','Common' {
|
||||
Context 'With defaults' {
|
||||
It 'Yaml' {
|
||||
$result = @(Get-PSRuleTarget -InputPath (Join-Path -Path $rootPath -ChildPath 'ps-project.yaml'));
|
||||
$result = @(Get-PSRuleTarget -InputPath (Join-Path -Path $rootPath -ChildPath 'GitVersion.yml'));
|
||||
$result.Length | Should -Be 1;
|
||||
$result[0].info.name | Should -Be 'PSRule';
|
||||
$result[0].increment | Should -Be 'Inherit';
|
||||
|
||||
$result = @(Get-PSRuleTarget -InputPath (Join-Path -Path $here -ChildPath 'PSRule.Tests.yml'));
|
||||
$result.Length | Should -Be 1;
|
||||
|
|
Загрузка…
Ссылка в новой задаче