Skip to content

Commit f4e6b30

Browse files
committed
Add .NET CI workflow for build and test automation
Introduced a GitHub Actions workflow (`build-and-test.yml`) to automate the build and test process for a .NET project.
1 parent c2c65c3 commit f4e6b30

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: .NET CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
workflow_dispatch:
7+
8+
jobs:
9+
build-and-test:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Setup .NET
17+
uses: actions/setup-dotnet@v4
18+
with:
19+
dotnet-version: '10.0.x'
20+
21+
- name: Cache NuGet packages
22+
uses: actions/cache@v4
23+
with:
24+
path: ~/.nuget/packages
25+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
26+
restore-keys: |
27+
${{ runner.os }}-nuget-
28+
29+
- name: Restore
30+
run: dotnet restore
31+
32+
- name: Build
33+
run: dotnet build --configuration Release --no-restore
34+
35+
- name: Test
36+
run: dotnet test --configuration Release --no-build --logger "trx;LogFileName=test_results.trx"
37+
38+
- name: Upload test results
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: test-results
42+
path: '**/TestResults/*.trx'

0 commit comments

Comments
 (0)