-
Notifications
You must be signed in to change notification settings - Fork 1
61 lines (49 loc) · 1.55 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Test
on:
workflow_run:
workflows:
- Create Prerelease
- Create Release
# - Publish
types: [requested]
workflow_dispatch:
pull_request:
types: [opened,edited,synchronize,reopened]
branches:
- main
- develop
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
SOLUTION_NAME: ${{ vars.SOLUTION_NAME }}
DOTNET_VERSION: '9.0.x'
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Release Configuration
if: ${{ env.BRANCH_NAME == 'main' }}
run: |
echo "BUILD_CONFIGURATION=Release" >> $GITHUB_ENV
- name: Debug Configuration
if: ${{ env.BRANCH_NAME != 'main' }}
run: |
echo "BUILD_CONFIGURATION=Debug" >> $GITHUB_ENV
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore Dependencies
run: dotnet restore ${{ env.SOLUTION_NAME }}
- name: Build
run: dotnet build --no-restore --configuration ${{ env.BUILD_CONFIGURATION }} ${{ env.SOLUTION_NAME }}
- name: Tests
run: |
dotnet test --no-build --configuration ${{ env.BUILD_CONFIGURATION }} --logger:trx --results-directory:./TestResults ${{ env.SOLUTION_NAME }}
- name: Upload Test Results
uses: actions/upload-artifact@v4 # upload test results
if: success() || failure() # run this step even if previous step failed
with:
name: test-results
path: ./TestResults/**/*.trx