-
Notifications
You must be signed in to change notification settings - Fork 3
103 lines (85 loc) · 2.75 KB
/
pr-validation.yml
File metadata and controls
103 lines (85 loc) · 2.75 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: PR Validation
on:
pull_request:
branches:
- main
- master
- develop
types: [opened, synchronize, reopened]
permissions:
contents: read
security-events: write
actions: read
jobs:
build-and-test:
name: Build and Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for GitVersion
fetch-tags: true
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v3.1.1
with:
versionSpec: '6.0.x'
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/execute@v3.1.1
with:
useConfigFile: true
configFilePath: GitVersion.yml
- name: Display GitVersion outputs
run: |
echo "SemVer: ${{ steps.gitversion.outputs.semVer }}"
echo "AssemblySemVer: ${{ steps.gitversion.outputs.assemblySemVer }}"
echo "InformationalVersion: ${{ steps.gitversion.outputs.informationalVersion }}"
- name: Restore dependencies
working-directory: ./src
run: dotnet restore
- name: Build
working-directory: ./src
run: |
dotnet build --configuration Release --no-restore \
/p:Version=${{ steps.gitversion.outputs.semVer }} \
/p:AssemblyVersion=${{ steps.gitversion.outputs.assemblySemVer }} \
/p:FileVersion=${{ steps.gitversion.outputs.assemblySemFileVer }} \
/p:InformationalVersion=${{ steps.gitversion.outputs.informationalVersion }}
- name: Run tests
working-directory: ./src
run: dotnet test --configuration Release --no-build --verbosity normal
continue-on-error: true # Continue if no tests exist
codeql-analysis:
name: CodeQL Security Scan
runs-on: ubuntu-latest
permissions:
security-events: write
contents: read
actions: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: csharp
queries: security-and-quality
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Restore dependencies
working-directory: ./src
run: dotnet restore
- name: Build for CodeQL
working-directory: ./src
run: dotnet build --configuration Release --no-restore
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:csharp"