Skip to content

Commit af03b79

Browse files
refactor: split setup composite action into setup-node and setup-dotnet
Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com>
1 parent cf16cc1 commit af03b79

File tree

4 files changed

+57
-36
lines changed

4 files changed

+57
-36
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: 'Setup .NET Environment'
2+
description: 'Set up .NET SDK, configure dependency caching, restore, and optionally build'
3+
inputs:
4+
build:
5+
description: 'Whether to run dotnet build after restore'
6+
required: false
7+
default: 'true'
8+
runs:
9+
using: 'composite'
10+
steps:
11+
- name: Set up .NET
12+
uses: actions/setup-dotnet@v5
13+
with:
14+
global-json-file: global.json
15+
16+
- name: Set up dependency caching for faster builds
17+
uses: actions/cache@v5
18+
with:
19+
path: |
20+
~/.nuget/packages
21+
${{ github.workspace }}/**/obj/project.assets.json
22+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
23+
restore-keys: |
24+
${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
25+
${{ runner.os }}-nuget-
26+
27+
- name: Restore .NET dependencies
28+
shell: bash
29+
run: dotnet restore
30+
31+
- name: Build with dotnet
32+
if: inputs.build == 'true'
33+
shell: bash
34+
run: dotnet build -p:ContinuousIntegrationBuild=True -p:ReleaseDateAttribute=True --configuration Release --no-restore
Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
name: 'Setup Environment'
2-
description: 'Set up Node.js, install npm dependencies, set up .NET SDK, configure dependency caching, restore, and optionally build'
1+
name: 'Setup Node.js Environment'
2+
description: 'Set up Node.js, install npm dependencies, and optionally build all JS packages'
33
inputs:
44
build:
5-
description: 'Whether to run builds (npm buildProd and dotnet build) after install/restore'
5+
description: 'Whether to run npm buildProd after install'
66
required: false
77
default: 'true'
88
runs:
@@ -58,28 +58,3 @@ runs:
5858
shell: bash
5959
working-directory: src/microsoft-learn-mock
6060
run: npm run buildProd
61-
62-
- name: Set up .NET
63-
uses: actions/setup-dotnet@v5
64-
with:
65-
global-json-file: global.json
66-
67-
- name: Set up dependency caching for faster builds
68-
uses: actions/cache@v5
69-
with:
70-
path: |
71-
~/.nuget/packages
72-
${{ github.workspace }}/**/obj/project.assets.json
73-
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
74-
restore-keys: |
75-
${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
76-
${{ runner.os }}-nuget-
77-
78-
- name: Restore .NET dependencies
79-
shell: bash
80-
run: dotnet restore
81-
82-
- name: Build with dotnet
83-
if: inputs.build == 'true'
84-
shell: bash
85-
run: dotnet build -p:ContinuousIntegrationBuild=True -p:ReleaseDateAttribute=True --configuration Release --no-restore

.github/workflows/Build-Test-And-Deploy.yaml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ jobs:
1919
steps:
2020
- uses: actions/checkout@v6
2121

22-
- name: Set up environment
23-
uses: ./.github/actions/setup
22+
- name: Set up Node.js environment
23+
uses: ./.github/actions/setup-node
24+
25+
- name: Set up .NET environment
26+
uses: ./.github/actions/setup-dotnet
2427

2528
- name: Run ciTest for microsoft-trydotnet
2629
working-directory: src/microsoft-trydotnet
@@ -83,8 +86,11 @@ jobs:
8386
steps:
8487
- uses: actions/checkout@v6
8588

86-
- name: Set up environment
87-
uses: ./.github/actions/setup
89+
- name: Set up Node.js environment
90+
uses: ./.github/actions/setup-node
91+
92+
- name: Set up .NET environment
93+
uses: ./.github/actions/setup-dotnet
8894

8995
- name: Run .NET Tests
9096
id: run-dotnet-tests
@@ -110,8 +116,11 @@ jobs:
110116
steps:
111117
- uses: actions/checkout@v6
112118

113-
- name: Set up environment
114-
uses: ./.github/actions/setup
119+
- name: Set up Node.js environment
120+
uses: ./.github/actions/setup-node
121+
122+
- name: Set up .NET environment
123+
uses: ./.github/actions/setup-dotnet
115124

116125
- name: Run .NET Integration Tests
117126
id: run-dotnet-integration-tests

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,8 @@ jobs:
2525
steps:
2626
- uses: actions/checkout@v6
2727

28-
- name: Set up environment
29-
uses: ./.github/actions/setup
28+
- name: Set up Node.js environment
29+
uses: ./.github/actions/setup-node
30+
31+
- name: Set up .NET environment
32+
uses: ./.github/actions/setup-dotnet

0 commit comments

Comments
 (0)