Skip to content

Commit aeefe54

Browse files
Add build step and create reusable .NET setup action
Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com>
1 parent bafe2f1 commit aeefe54

3 files changed

Lines changed: 38 additions & 18 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

.github/workflows/copilot-setup-steps.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,10 @@ jobs:
2525
- name: Checkout code
2626
uses: actions/checkout@v5
2727

28-
- name: Setup .NET
29-
uses: actions/setup-dotnet@v4
28+
- name: Setup .NET and Build
29+
uses: ./.github/actions/setup-dotnet-build
3030
with:
31-
dotnet-version: |
32-
3.1.x
33-
6.x
34-
35-
- name: Restore .NET dependencies
36-
run: dotnet restore
31+
configuration: 'Release'
3732

3833
- name: Setup Copilot environment
3934
run: |

0 commit comments

Comments
 (0)