Skip to content

Commit 6b32b6c

Browse files
add GH action
1 parent 0bafdb2 commit 6b32b6c

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

.github/workflows/dotnet.yml

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

0 commit comments

Comments
 (0)