A collection of build scripts and utilities for multi-language projects.
| Language | Version | Build Script | Status |
|---|---|---|---|
| .NET Core | 6.0, 7.0, 8.0 | dotnet-build.ps1 |
✅ |
| PowerShell | 5.1+ / 7.x | ps-build.ps1 |
✅ |
| Python | 3.9+ | python-build.ps1 |
✅ |
| Go | 1.21+ | go-build.ps1 |
✅ |
# Clone the repository
git clone https://github.com/yourorg/build-tools.git
cd build-tools
# Run a build
.\scripts\dotnet-build.ps1 -ProjectPath "C:\src\MyApp"Ensure the following are installed on your system:
- PowerShell 5.1+ or PowerShell Core 7.x
- .NET SDK 6.0+ (Download)
- Python 3.9+ (Download)
- Go 1.21+ (Download)
# Add to PATH (optional)
$env:PATH += ";C:\path\to\build-tools\scripts"
# Or import as module
Import-Module .\BuildTools.psd1# Basic build
.\dotnet-build.ps1
# Full pipeline: clean, build, test, publish
.\dotnet-build.ps1 -Clean -Test -Publish -Configuration Release
# Self-contained executable
.\dotnet-build.ps1 -Publish -Runtime win-x64 -SelfContained -SingleFile
# Target specific framework
.\dotnet-build.ps1 -Framework net8.0Parameters:
| Parameter | Description | Default |
|---|---|---|
-ProjectPath |
Path to .sln or .csproj | . |
-Configuration |
Debug or Release | Release |
-Runtime |
Target RID (win-x64, linux-x64, etc.) | - |
-Framework |
Target framework | - |
-Clean |
Clean before build | false |
-Test |
Run unit tests | false |
-Publish |
Publish artifacts | false |
-SelfContained |
Include .NET runtime | false |
-SingleFile |
Single file output | false |
# Analyze and test module
.\ps-build.ps1 -ModulePath .\src\MyModule
# Build with Pester tests
.\ps-build.ps1 -Test -CodeCoverage
# Package as .nupkg
.\ps-build.ps1 -Package -OutputDir .\artifactsParameters:
| Parameter | Description | Default |
|---|---|---|
-ModulePath |
Path to module | . |
-Test |
Run Pester tests | false |
-CodeCoverage |
Generate coverage report | false |
-Analyze |
Run PSScriptAnalyzer | false |
-Package |
Create NuGet package | false |
# Build with pip
.\python-build.ps1 -ProjectPath .\myapp
# Create virtual environment and install deps
.\python-build.ps1 -CreateVenv -Install
# Run tests with pytest
.\python-build.ps1 -Test -Coverage
# Build wheel package
.\python-build.ps1 -Package -OutputDir .\distParameters:
| Parameter | Description | Default |
|---|---|---|
-ProjectPath |
Path to project | . |
-CreateVenv |
Create virtual environment | false |
-Install |
Install dependencies | false |
-Test |
Run pytest | false |
-Coverage |
Generate coverage report | false |
-Lint |
Run flake8/pylint | false |
-Package |
Build wheel/sdist | false |
# Build binary
.\go-build.ps1 -ProjectPath .\myapp
# Build with race detection
.\go-build.ps1 -Race
# Cross-compile for Linux
.\go-build.ps1 -GOOS linux -GOARCH amd64
# Run tests with coverage
.\go-build.ps1 -Test -CoverageParameters:
| Parameter | Description | Default |
|---|---|---|
-ProjectPath |
Path to Go module | . |
-OutputName |
Binary name | project name |
-GOOS |
Target OS | current |
-GOARCH |
Target architecture | current |
-Race |
Enable race detector | false |
-Test |
Run tests | false |
-Coverage |
Generate coverage | false |
-Lint |
Run golangci-lint | false |
trigger:
- main
pool:
vmImage: 'windows-latest'
steps:
- checkout: self
- task: PowerShell@2
displayName: 'Build .NET'
inputs:
filePath: '$(Build.SourcesDirectory)/scripts/dotnet-build.ps1'
arguments: '-Clean -Test -Publish -Configuration Release'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.SourcesDirectory)/publish'
ArtifactName: 'drop'name: Build
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Build
shell: pwsh
run: .\scripts\dotnet-build.ps1 -Clean -Test -Publish
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: build-output
path: publish/build-tools/
├── scripts/
│ ├── dotnet-build.ps1 # .NET Core build script
│ ├── ps-build.ps1 # PowerShell module build
│ ├── python-build.ps1 # Python build script
│ └── go-build.ps1 # Go build script
├── templates/
│ ├── azure-pipelines.yml
│ └── github-actions.yml
├── tests/
│ └── *.Tests.ps1
├── docs/
│ └── *.md
├── BuildTools.psd1
├── BuildTools.psm1
├── LICENSE
└── README.md
Create a build-config.json in your project root:
{
"dotnet": {
"configuration": "Release",
"framework": "net8.0",
"runtime": "win-x64",
"selfContained": true
},
"python": {
"version": "3.11",
"venvPath": ".venv"
},
"go": {
"version": "1.21",
"ldflags": "-s -w"
}
}- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please read CONTRIBUTING.md for details on our code of conduct and contribution guidelines.
See CHANGELOG.md for release history.
This project is licensed under the MIT License - see the LICENSE file for details.
- 📫 Issues: GitHub Issues
- 💬 Discussions: GitHub Discussions
- 📖 Docs: Wiki