Skip to content

Commit d183da5

Browse files
Add GitHub action for build and test
1 parent 0bafdb2 commit d183da5

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

.github/workflows/dotnet.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: .NET Build & Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
permissions:
12+
contents: read
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
build-and-test:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Setup .NET
27+
uses: actions/setup-dotnet@v4
28+
with:
29+
dotnet-version: '9.0.x'
30+
31+
- name: Cache NuGet packages
32+
uses: actions/cache@v4
33+
with:
34+
path: ~/.nuget/packages
35+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
36+
restore-keys: |
37+
${{ runner.os }}-nuget-
38+
39+
- name: Restore
40+
run: dotnet restore
41+
42+
- name: Restore .NET tools
43+
run: dotnet tool restore
44+
45+
- name: Build
46+
run: dotnet build --configuration Release --no-restore
47+
48+
- name: Test
49+
run: dotnet test --configuration Release --no-build --verbosity normal
50+
51+

0 commit comments

Comments
 (0)