1+ name : Setup GitHub Copilot Agent Environment
2+
3+ # This workflow configures the environment for GitHub Copilot agents
4+ # It reuses configuration from the main Build-Test-And-Deploy workflow
5+ # to ensure consistency and reduce duplication
6+
7+ on :
8+ workflow_dispatch :
9+
10+ permissions :
11+ contents : read
12+
13+ jobs :
14+ setup-environment :
15+ runs-on : ubuntu-latest
16+ environment : " BuildAndUploadImage"
17+
18+ steps :
19+ - uses : actions/checkout@v5
20+
21+ - name : Set up .NET Core
22+ uses : actions/setup-dotnet@v4
23+ with :
24+ global-json-file : global.json
25+ source-url : https://pkgs.dev.azure.com/intelliTect/_packaging/EssentialCSharp/nuget/v3/index.json
26+ env :
27+ NUGET_AUTH_TOKEN : ${{ secrets.AZURE_DEVOPS_PAT }}
28+
29+ - name : Set up dependency caching for faster builds
30+ uses : actions/cache@v4
31+ id : nuget-cache
32+ with :
33+ path : |
34+ ~/.nuget/packages
35+ ${{ github.workspace }}/**/obj/project.assets.json
36+ key : ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
37+ restore-keys : |
38+ ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
39+ ${{ runner.os }}-nuget-
40+
41+ - name : Restore with dotnet
42+ run : dotnet restore
43+
44+ - name : Build with dotnet
45+ run : dotnet build -p:ContinuousIntegrationBuild=True -p:ReleaseDateAttribute=True --configuration Release --no-restore
46+
47+ - name : Run .NET Tests
48+ run : dotnet test --no-build --configuration Release
49+
50+ - name : Set up Docker Buildx
51+ uses : docker/setup-buildx-action@v3
52+
53+ - name : Validate Docker build
54+ uses : docker/build-push-action@v6
55+ with :
56+ push : false
57+ tags : copilot-env-validation
58+ file : ./EssentialCSharp.Web/Dockerfile
59+ context : .
60+ secrets : |
61+ "nuget_auth_token=${{ secrets.AZURE_DEVOPS_PAT }}"
62+ cache-from : type=gha
63+ cache-to : type=gha,mode=max
64+
65+ - name : Display environment information
66+ run : |
67+ echo "✅ Environment setup complete for GitHub Copilot agents"
68+ echo "📦 .NET Version: $(dotnet --version)"
69+ echo "🏗️ Build Status: Success"
70+ echo "🐳 Docker Status: Ready"
71+ echo "📂 Repository: ${{ github.repository }}"
72+ echo "🔧 This environment is configured for:"
73+ echo " - .NET 9.0 development"
74+ echo " - ASP.NET Core web applications"
75+ echo " - Entity Framework"
76+ echo " - Semantic Kernel AI integration"
77+ echo " - Docker containerization"
78+ echo " - NuGet package management (public and private feeds)"
0 commit comments