Skip to content
Draft
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
80 changes: 80 additions & 0 deletions .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Copilot Setup Steps for Multi-Version .NET

# This workflow sets up a multi-version .NET environment for GitHub Copilot
# It configures .NET 6, 8, and 10 SDKs with proper caching and tooling
on:
# Allow manual triggering from Actions tab
workflow_dispatch:

# Run when this workflow file is modified to validate changes
push:
paths:
- '.github/workflows/copilot-setup-steps.yml'

pull_request:
paths:
- '.github/workflows/copilot-setup-steps.yml'

# Security: Use minimum required permissions
# Only read access to repository contents is needed
permissions:
contents: read

jobs:
# Job name must be 'copilot-setup-steps' for GitHub Copilot recognition
copilot-setup-steps:
runs-on: ubuntu-latest

steps:
# Checkout with full history for better context
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

# Setup multiple .NET SDK versions in a single step for efficiency
# Using specific versions for reproducibility (not wildcards)
# Versions: .NET 6.0 LTS, .NET 8.0 LTS, .NET 9.0 (latest stable)
- name: Setup .NET SDK (Multi-Version)
uses: actions/setup-dotnet@v4
with:
# Multi-version syntax: separate versions with newlines
dotnet-version: |
6.0.428
8.0.416
9.0.101

# Enable NuGet package caching for performance optimization
cache: true

# Cache dependency path points to lock files for deterministic restores
# This ensures exact package versions are restored from cache
cache-dependency-path: '**/packages.lock.json'

# Restore dependencies with locked mode for deterministic builds
# --locked-mode ensures exact versions from packages.lock.json are used
# This prevents supply chain attacks and ensures reproducible builds
- name: Restore dependencies (locked mode)
run: dotnet restore --locked-mode

# Install dotnet-format tool globally for code formatting
# This is commonly used by Copilot for code formatting suggestions
- name: Install dotnet-format
run: dotnet tool install -g dotnet-format

# Setup .NET environment variables for optimal operation
# DOTNET_ROOT: Ensures consistent SDK discovery
# DOTNET_CLI_TELEMETRY_OPTOUT: Disables telemetry for privacy/performance
- name: Configure .NET environment variables
run: |
echo "DOTNET_ROOT=$HOME/.dotnet" >> $GITHUB_ENV
echo "DOTNET_CLI_TELEMETRY_OPTOUT=1" >> $GITHUB_ENV

# Validate the setup by building the solution
# This ensures all SDKs are properly configured and dependencies are resolved
- name: Build validation
run: dotnet build --configuration Release --no-restore

# Optional: Display .NET SDK information for troubleshooting
- name: Display .NET info
run: dotnet --info
1 change: 1 addition & 0 deletions src/Fennel/Fennel.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# 0.2.0
- Adds Prometheus.CSharp namespace with a more C# friendly API
</PackageReleaseNotes>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="Result.fs" />
Expand Down
36 changes: 36 additions & 0 deletions src/Fennel/packages.lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"version": 1,
"dependencies": {
".NETStandard,Version=v2.0": {
"FParsec": {
"type": "Direct",
"requested": "[1.1.1, )",
"resolved": "1.1.1",
"contentHash": "Wdjf/gCNLEwd+0nUCDh9jAIIcKGwfhRramySTnTcVVgNC6i4Vp5aJklUJJfvFkEZMYNZEDGcI8pCa36/TmwmSg==",
"dependencies": {
"FSharp.Core": "4.3.4"
}
},
"FSharp.Core": {
"type": "Direct",
"requested": "[10.0.100, )",
"resolved": "10.0.100",
"contentHash": "vWHaY4Pk7mUv5gJN9+rbods+QnPjhrw3sdGw2R9pFLIBzHkkN26eMgubPHZVoS7xwLA9TZuoHGLrboY5QOBcdA=="
},
"NETStandard.Library": {
"type": "Direct",
"requested": "[2.0.3, )",
"resolved": "2.0.3",
"contentHash": "st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==",
"dependencies": {
"Microsoft.NETCore.Platforms": "1.1.0"
}
},
"Microsoft.NETCore.Platforms": {
"type": "Transitive",
"resolved": "1.1.0",
"contentHash": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A=="
}
}
}
}
1 change: 1 addition & 0 deletions test/Fennel.CSharp.Tests/Fennel.CSharp.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFramework>net5.0</TargetFramework>

<IsPackable>false</IsPackable>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading