-
Notifications
You must be signed in to change notification settings - Fork 30
114 lines (99 loc) · 3.47 KB
/
application.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
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
104
105
106
107
108
109
110
111
112
113
114
name: Application - Build and Deploy
on:
push:
branches:
- main
paths:
- "application/**"
- ".github/workflows/application.yml"
- "!**.md"
pull_request:
paths:
- "application/**"
- ".github/workflows/application.yml"
- "!**.md"
workflow_dispatch:
permissions:
id-token: write
contents: read
jobs:
build:
name: Build
runs-on: ubuntu-latest
outputs:
version: ${{ steps.generate_version.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Generate version
id: generate_version
run: |
VERSION=$(date +"%Y.%m.%d").$GITHUB_RUN_NUMBER
echo "Generated version: $VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Restore dependencies
run: dotnet restore application/PlatformPlatform.sln
- name: Build
run: dotnet build application/PlatformPlatform.sln --no-restore --configuration Release /p:Version=${{ steps.generate_version.outputs.version }}
test-with-code-coverage:
name: Test and Code Coverage
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install dotCover
run: dotnet tool install --global JetBrains.dotCover.GlobalTool
- name: Install SonarScanner
run: dotnet tool install --global dotnet-sonarscanner
- name: Run Test with dotCover and SonarScanner reporting
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
dotnet sonarscanner begin /k:"${{ vars.SONAR_PROJECT_KEY }}" /o:"${{ vars.SONAR_ORGANIZATION }}" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.dotcover.reportsPaths="application/coverage/dotCover.html"
dotnet dotcover test application/PlatformPlatform.sln --dcOutput="application/coverage/dotCover.html" --dcReportType=HTML
dotnet sonarscanner end /d:sonar.login="${SONAR_TOKEN}"
jetbrains-code-inspection:
name: JetBrains Code Inspections
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Run code inspections
uses: muno92/resharper_inspectcode@1.9.0
with:
solutionPath: application/PlatformPlatform.sln
minimumSeverity: warning
# Ignore cases where property getters are not called directly (e.g., on DTOs that are serialized)
ignoreIssueType: UnusedAutoPropertyAccessor.Global
account-management-api-publish:
name: Account Management API Publish
if: github.ref == 'refs/heads/main'
needs: [build]
uses: ./.github/workflows/_publish-container.yml
secrets: inherit
with:
image_name: account-management-api
version: ${{ needs.build.outputs.version }}
docker_file: ./account-management/Api/Dockerfile
account-management-api-deploy:
name: Account Management API Deploy
if: github.ref == 'refs/heads/main'
needs:
[
build,
test-with-code-coverage,
jetbrains-code-inspection,
account-management-api-publish,
]
uses: ./.github/workflows/_deploy-container.yml
secrets: inherit
with:
image_name: account-management-api
version: ${{ needs.build.outputs.version }}