Skip to content

Commit 7c054d4

Browse files
authored
Add GitHub Actions workflow for Copilot environment setup with reusable .NET build action (#75)
1 parent b77c990 commit 7c054d4

3 files changed

Lines changed: 72 additions & 10 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: 'Setup .NET and Build'
2+
description: 'Sets up .NET environment, restores dependencies, and builds the project'
3+
inputs:
4+
dotnet-version:
5+
description: '.NET versions to install'
6+
required: false
7+
default: |
8+
3.1.x
9+
6.x
10+
configuration:
11+
description: 'Build configuration'
12+
required: false
13+
default: 'Release'
14+
build-args:
15+
description: 'Additional build arguments'
16+
required: false
17+
default: '-p:ContinuousIntegrationBuild=True --no-restore'
18+
19+
runs:
20+
using: 'composite'
21+
steps:
22+
- name: Setup .NET
23+
uses: actions/setup-dotnet@v4
24+
with:
25+
dotnet-version: ${{ inputs.dotnet-version }}
26+
27+
- name: Restore dependencies
28+
run: dotnet restore
29+
shell: pwsh
30+
31+
- name: Build
32+
run: dotnet build --configuration ${{ inputs.configuration }} ${{ inputs.build-args }}
33+
shell: pwsh

.github/workflows/build-and-test.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,8 @@ jobs:
2020
os: [ubuntu-latest, windows-latest, macOS-latest]
2121
steps:
2222
- uses: actions/checkout@v4
23-
- name: Setup .NET
24-
uses: actions/setup-dotnet@v4
25-
with:
26-
dotnet-version: |
27-
3.1.x
28-
6.x
29-
- name: Restore dependencies
30-
run: dotnet restore
31-
- name: Build
32-
run: dotnet build -p:ContinuousIntegrationBuild=True --no-restore --configuration Release
23+
- name: Setup .NET and Build
24+
uses: ./.github/actions/setup-dotnet-build
3325
- name: Test
3426
run: dotnet test --no-build --configuration Release --verbosity normal
3527

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Copilot Setup Steps
2+
3+
on:
4+
push:
5+
paths:
6+
- '.github/workflows/copilot-setup-steps.yml'
7+
pull_request:
8+
paths:
9+
- '.github/workflows/copilot-setup-steps.yml'
10+
workflow_dispatch:
11+
12+
defaults:
13+
run:
14+
shell: pwsh
15+
16+
jobs:
17+
copilot-setup-steps:
18+
name: copilot-setup-steps
19+
runs-on: ubuntu-latest
20+
21+
permissions:
22+
contents: read
23+
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v5
27+
28+
- name: Setup .NET and Build
29+
uses: ./.github/actions/setup-dotnet-build
30+
with:
31+
configuration: 'Debug'
32+
33+
- name: Setup Copilot environment
34+
run: |
35+
echo "Setting up Copilot-specific environment variables..."
36+
echo "COPILOT_SETUP_COMPLETE=true" >> $env:GITHUB_ENV
37+
echo "Copilot environment setup completed"

0 commit comments

Comments
 (0)