Skip to content

Commit 0ccf69c

Browse files
Merge pull request #3 from abhinavminhas/dev
Solution Updates
2 parents 721898a + b9c1312 commit 0ccf69c

File tree

32 files changed

+982
-90
lines changed

32 files changed

+982
-90
lines changed

.github/workflows/build.yml

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
#CI/MANUAL TRIGGER
2+
name: Build / Test
3+
4+
on:
5+
push:
6+
branches: [ main, dev ]
7+
paths-ignore:
8+
- '**.md'
9+
pull_request:
10+
branches: [ main ]
11+
workflow_dispatch:
12+
13+
jobs:
14+
# Build/Test
15+
OS-NetCore:
16+
name: Build/Test (.NET Core)
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
matrix:
20+
os: [ windows-2022, ubuntu-22.04, macOS-14 ]
21+
dotnet-version: [ '3.1.x', '6.0.x', '7.0.x', '8.0.x' ]
22+
23+
steps:
24+
- name: Checkout Repository
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Dotnet Version (${{ matrix.dotnet-version }})
30+
uses: actions/setup-dotnet@v4
31+
with:
32+
dotnet-version: ${{ matrix.dotnet-version }}
33+
34+
- name: Find And Replace Values (App Config)
35+
uses: abhinavminhas/replace-tokens@main
36+
with:
37+
files: '${{ github.workspace }}/QueryDB.Core.Tests/App.config'
38+
replacements: '__DB_PASSWORD__=${{ secrets.DB_PASSWORD }},__DB_PASSWORD__=${{ secrets.DB_PASSWORD }},__DB_PASSWORD__=${{ secrets.DB_PASSWORD }}'
39+
40+
- name: Build
41+
run: dotnet build QueryDB.Core.Tests/QueryDB.Core.Tests.csproj --configuration Release
42+
43+
- name: Docker Compose (Start - DB Containers)
44+
if: ${{ (matrix.os == 'ubuntu-22.04') && (matrix.dotnet-version == '3.1.x') }}
45+
uses: ./.github/workflows/docker-compose-start-dbs
46+
with:
47+
dbPassword: ${{ secrets.DB_PASSWORD }}
48+
49+
- name: Docker Inspect (Health Check - DB Containers)
50+
if: ${{ (matrix.os == 'ubuntu-22.04') && (matrix.dotnet-version == '3.1.x') }}
51+
uses: ./.github/workflows/docker-inspect-health-check
52+
with:
53+
dbPassword: ${{ secrets.DB_PASSWORD }}
54+
55+
- name: Docker Execute (Seed Data)
56+
if: ${{ (matrix.os == 'ubuntu-22.04') && (matrix.dotnet-version == '3.1.x') }}
57+
uses: ./.github/workflows/docker-execute-seed-data
58+
with:
59+
dbPassword: ${{ secrets.DB_PASSWORD }}
60+
61+
- name: Test
62+
if: ${{ (matrix.os == 'ubuntu-22.04') && (matrix.dotnet-version == '3.1.x') }}
63+
run: dotnet test --no-build --verbosity normal --configuration Release --filter TestCategory=DB-TESTS
64+
65+
- name: Docker Compose (Tear Down - DB Containers)
66+
if: ${{ (matrix.os == 'ubuntu-22.04') && (matrix.dotnet-version == '3.1.x') && always() }}
67+
uses: ./.github/workflows/docker-compose-teardown-dbs
68+
69+
# Code Coverage
70+
Code-Coverage:
71+
name: Code Coverage (Codecov)
72+
runs-on: ${{ matrix.os }}
73+
strategy:
74+
matrix:
75+
os: [ ubuntu-22.04 ]
76+
dotnet-version: [ '3.1.x' ]
77+
78+
steps:
79+
- name: Checkout Repository
80+
uses: actions/checkout@v4
81+
with:
82+
fetch-depth: 0
83+
84+
- name: Dotnet Version (${{ matrix.dotnet-version }})
85+
uses: actions/setup-dotnet@v4
86+
with:
87+
dotnet-version: ${{ matrix.dotnet-version }}
88+
89+
- name: Find And Replace Values (App Config)
90+
uses: abhinavminhas/replace-tokens@main
91+
with:
92+
files: '${{ github.workspace }}/QueryDB.Core.Tests/App.config'
93+
replacements: '__DB_PASSWORD__=${{ secrets.DB_PASSWORD }},__DB_PASSWORD__=${{ secrets.DB_PASSWORD }},__DB_PASSWORD__=${{ secrets.DB_PASSWORD }}'
94+
95+
- name: Build
96+
run: dotnet build QueryDB.Core.Tests/QueryDB.Core.Tests.csproj --configuration Release
97+
98+
- name: Docker Compose (Start - DB Containers)
99+
uses: ./.github/workflows/docker-compose-start-dbs
100+
with:
101+
dbPassword: ${{ secrets.DB_PASSWORD }}
102+
103+
- name: Docker Inspect (Health Check - DB Containers)
104+
uses: ./.github/workflows/docker-inspect-health-check
105+
with:
106+
dbPassword: ${{ secrets.DB_PASSWORD }}
107+
108+
- name: Docker Execute (Seed Data)
109+
uses: ./.github/workflows/docker-execute-seed-data
110+
with:
111+
dbPassword: ${{ secrets.DB_PASSWORD }}
112+
113+
- name: Test
114+
run: dotnet test --no-build --verbosity normal --configuration Release --filter TestCategory=DB-TESTS /p:CollectCoverage=true /p:CoverletOutputFormat=lcov
115+
116+
- name: Docker Compose (Tear Down - DB Containers)
117+
if: always()
118+
uses: ./.github/workflows/docker-compose-teardown-dbs
119+
120+
- name: Upload Coverage To Codecov
121+
uses: codecov/codecov-action@v4
122+
with:
123+
token: ${{ secrets.CODECOV_TOKEN }}
124+
125+
# Code Quality
126+
Code-Quality:
127+
name: Code Quality (SonarCloud)
128+
runs-on: windows-2022
129+
steps:
130+
- name: Set Up JDK 17
131+
uses: actions/setup-java@v4
132+
with:
133+
java-version: 17
134+
distribution: 'zulu'
135+
- uses: actions/checkout@v4
136+
with:
137+
fetch-depth: 0
138+
- name: Cache SonarCloud Packages
139+
uses: actions/cache@v4
140+
with:
141+
path: ~\sonar\cache
142+
key: ${{ runner.os }}-sonar
143+
restore-keys: ${{ runner.os }}-sonar
144+
- name: Cache SonarCloud Scanner
145+
id: cache-sonar-scanner
146+
uses: actions/cache@v4
147+
with:
148+
path: .\.sonar\scanner
149+
key: ${{ runner.os }}-sonar-scanner
150+
restore-keys: ${{ runner.os }}-sonar-scanner
151+
- name: Install SonarCloud Scanner
152+
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
153+
shell: powershell
154+
run: |
155+
New-Item -Path .\.sonar\scanner -ItemType Directory
156+
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
157+
- name: Build And Analyze
158+
env:
159+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
160+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
161+
shell: powershell
162+
run: |
163+
.\.sonar\scanner\dotnet-sonarscanner begin /k:"abhinavminhas_QueryDB" /o:"abhinavminhas" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
164+
dotnet build
165+
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"

.github/workflows/code-quality.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Code Quality (SonarCloud)
2+
on:
3+
workflow_dispatch:
4+
5+
jobs:
6+
build:
7+
name: Code Quality (SonarCloud)
8+
runs-on: windows-2022
9+
steps:
10+
- name: Set Up JDK 17
11+
uses: actions/setup-java@v4
12+
with:
13+
java-version: 17
14+
distribution: 'zulu'
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
- name: Cache SonarCloud Packages
19+
uses: actions/cache@v4
20+
with:
21+
path: ~\sonar\cache
22+
key: ${{ runner.os }}-sonar
23+
restore-keys: ${{ runner.os }}-sonar
24+
- name: Cache SonarCloud Scanner
25+
id: cache-sonar-scanner
26+
uses: actions/cache@v4
27+
with:
28+
path: .\.sonar\scanner
29+
key: ${{ runner.os }}-sonar-scanner
30+
restore-keys: ${{ runner.os }}-sonar-scanner
31+
- name: Install SonarCloud Scanner
32+
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
33+
shell: powershell
34+
run: |
35+
New-Item -Path .\.sonar\scanner -ItemType Directory
36+
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
37+
- name: Build And Analyze
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
41+
shell: powershell
42+
run: |
43+
.\.sonar\scanner\dotnet-sonarscanner begin /k:"abhinavminhas_QueryDB" /o:"abhinavminhas" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
44+
dotnet build
45+
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"

.github/workflows/coverage.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Code Coverage
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
Code-Coverage:
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
matrix:
11+
os: [ ubuntu-22.04 ]
12+
dotnet-version: [ '3.1.x' ]
13+
14+
steps:
15+
- name: Checkout Repository
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Dotnet Version (${{ matrix.dotnet-version }})
21+
uses: actions/setup-dotnet@v4
22+
with:
23+
dotnet-version: ${{ matrix.dotnet-version }}
24+
25+
- name: Find And Replace Values (App Config)
26+
uses: abhinavminhas/replace-tokens@main
27+
with:
28+
files: '${{ github.workspace }}/QueryDB.Core.Tests/App.config'
29+
replacements: '__DB_PASSWORD__=${{ secrets.DB_PASSWORD }},__DB_PASSWORD__=${{ secrets.DB_PASSWORD }},__DB_PASSWORD__=${{ secrets.DB_PASSWORD }}'
30+
31+
- name: Build
32+
run: dotnet build QueryDB.Core.Tests/QueryDB.Core.Tests.csproj --configuration Release
33+
34+
- name: Docker Compose (Start - DB Containers)
35+
uses: ./.github/workflows/docker-compose-start-dbs
36+
with:
37+
dbPassword: ${{ secrets.DB_PASSWORD }}
38+
39+
- name: Docker Inspect (Health Check - DB Containers)
40+
uses: ./.github/workflows/docker-inspect-health-check
41+
with:
42+
dbPassword: ${{ secrets.DB_PASSWORD }}
43+
44+
- name: Docker Execute (Seed Data)
45+
uses: ./.github/workflows/docker-execute-seed-data
46+
with:
47+
dbPassword: ${{ secrets.DB_PASSWORD }}
48+
49+
- name: Test
50+
run: dotnet test --no-build --verbosity normal --configuration Release --filter TestCategory=DB-TESTS /p:CollectCoverage=true /p:CoverletOutputFormat=lcov
51+
52+
- name: Docker Compose (Tear Down - DB Containers)
53+
uses: ./.github/workflows/docker-compose-teardown-dbs
54+
55+
- name: Upload Coverage To Codecov
56+
uses: codecov/codecov-action@v4
57+
with:
58+
token: ${{ secrets.CODECOV_TOKEN }}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Docker Compose (Start - DB Containers)
2+
3+
inputs:
4+
dbPassword:
5+
description: 'Database password value.'
6+
required: true
7+
8+
runs:
9+
using: 'composite'
10+
11+
steps:
12+
- name: Find And Replace Values (Docker Compose)
13+
uses: abhinavminhas/replace-tokens@main
14+
with:
15+
files: '${{ github.workspace }}/docker-compose.yml'
16+
replacements: '__DB_PASSWORD__=${{ inputs.dbPassword }},__DB_PASSWORD__=${{ inputs.dbPassword }},__DB_PASSWORD__=${{ inputs.dbPassword }}'
17+
18+
- name: Docker Compose (Pull)
19+
shell: bash
20+
run: docker compose -f docker-compose.yml pull --parallel
21+
22+
- name: Docker Compose (Start - DB Containers)
23+
shell: bash
24+
run: docker compose -f docker-compose.yml up -d
25+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: Docker Compose (Tear Down - DB Containers)
2+
3+
runs:
4+
using: 'composite'
5+
6+
steps:
7+
- name: Docker Compose (Tear Down - DB Containers)
8+
shell: bash
9+
run: docker compose -f docker-compose.yml down
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Docker Execute (Seed Data)
2+
3+
inputs:
4+
dbPassword:
5+
description: 'Database password value.'
6+
required: true
7+
8+
runs:
9+
using: 'composite'
10+
11+
steps:
12+
- name: Docker Execute (ORACLE - Seed Data)
13+
shell: bash
14+
run: |
15+
docker exec oracle-db bash -c "sqlplus -s sys/$ORACLE_PWD@localhost:1521/XE as sysdba @/home/oracle.sql"
16+
env:
17+
ORACLE_PWD: ${{ inputs.dbPassword }}
18+
19+
- name: Docker Execute (MSSQL - Seed Data)
20+
shell: bash
21+
run: |
22+
docker exec mssql-db /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P $MSSQL_PWD -i "/home/mssql.sql"
23+
env:
24+
MSSQL_PWD: ${{ inputs.dbPassword }}
25+
26+
- name: Docker Execute (MYSQL - Seed Data)
27+
shell: bash
28+
run: |
29+
docker exec mysql-db mysql -uroot -p$MYSQL_PWD -e "source /home/mysql.sql"
30+
env:
31+
MYSQL_PWD: ${{ inputs.dbPassword }}

0 commit comments

Comments
 (0)