Skip to content

Commit 4927a37

Browse files
committed
PR template & docker compose changes
1 parent f8e853d commit 4927a37

4 files changed

Lines changed: 46 additions & 44 deletions

File tree

.github/workflows/check-pull-request.yml

Lines changed: 44 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -19,51 +19,32 @@ jobs:
1919
steps:
2020
- uses: actions/setup-dotnet@v3
2121
with:
22-
dotnet-version: '8.0.x'
23-
22+
dotnet-version: '8.0.x'
2423
- name: Check out code
2524
uses: actions/checkout@v3
2625
with:
27-
path: working-dir
28-
26+
path: working-dir
2927
- name: Restore
30-
run: dotnet restore ./working-dir/KeeperData.Api.sln
31-
28+
run: dotnet restore ./working-dir/KeeperData.Api.sln
3229
- name: Build
33-
run: dotnet build ./working-dir/KeeperData.Api.sln --configuration Release --no-restore -warnaserror
34-
30+
run: dotnet build ./working-dir/KeeperData.Api.sln --configuration Release --no-restore -warnaserror
3531
- name: Verify format
3632
run: dotnet format ./working-dir/KeeperData.Api.sln --verify-no-changes --verbosity diagnostic
37-
38-
- name: Make localstack init script executable
39-
run: chmod +x ./working-dir/compose/start-localstack.sh
40-
41-
- name: Make script executable
42-
run: chmod +x ./working-dir/wait-for-docker-logs.sh
43-
44-
- name: Run docker-compose
45-
uses: hoverkraft-tech/compose-action@v2.0.1
46-
with:
47-
compose-file: |
48-
./working-dir/docker-compose.yml
49-
./working-dir/docker-compose.override.yml
50-
51-
- name: Wait for localstack
52-
run: ./working-dir/wait-for-docker-logs.sh localstack-emulator "Bootstrapping Complete" 60
53-
54-
- name: Test
55-
run: dotnet test ./working-dir/KeeperData.Api.sln --logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true" --collect:"XPlat Code Coverage" --results-directory ./coverage
56-
57-
- name: install dotnet coverage
58-
run: dotnet tool install --global dotnet-coverage
59-
60-
- name: merge coverage reports
61-
run: dotnet-coverage merge *.cobertura.xml --recursive --output merged.cobertura.xml --output-format cobertura
62-
33+
- name: Test (unit and component)
34+
run: dotnet test ./working-dir/KeeperData.Api.sln --filter "Category!=Integration" --logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true" --collect:"XPlat Code Coverage" --results-directory ./coverage
35+
- name: Install ReportGenerator
36+
run: dotnet tool install --global dotnet-reportgenerator-globaltool
37+
- name: Generate Coverage Summary
38+
run: |
39+
reportgenerator \
40+
-reports:"./coverage/**/coverage.cobertura.xml" \
41+
-targetdir:"coverage-report" \
42+
-reporttypes:"Cobertura;MarkdownSummary" \
43+
-assemblyfilters:+KeeperData.*
6344
- name: Code coverage report
6445
uses: irongut/CodeCoverageSummary@v1.3.0
6546
with:
66-
filename: merged.cobertura.xml
47+
filename: coverage-report/Cobertura.xml
6748
badge: true
6849
fail_below_min: false
6950
format: markdown
@@ -72,14 +53,41 @@ jobs:
7253
indicators: true
7354
output: both
7455
thresholds: '60 80'
75-
7656
- name: Add Coverage PR Comment
7757
uses: marocchino/sticky-pull-request-comment@v2
7858
if: github.event_name == 'pull_request'
7959
with:
8060
recreate: true
8161
path: code-coverage-results.md
8262

63+
integration-tests:
64+
name: Run Integration Tests
65+
runs-on: ubuntu-latest
66+
needs: pr-validator
67+
steps:
68+
- uses: actions/setup-dotnet@v3
69+
with:
70+
dotnet-version: '8.0.x'
71+
- name: Check out code
72+
uses: actions/checkout@v3
73+
with:
74+
path: working-dir
75+
- name: Make LocalStack init script executable
76+
run: chmod +x ./working-dir/compose/start-localstack.sh
77+
- name: Run docker-compose
78+
uses: hoverkraft-tech/compose-action@v2.0.1
79+
with:
80+
compose-file: |
81+
./working-dir/docker-compose.yml
82+
./working-dir/docker-compose.override.yml
83+
- name: Make script executable
84+
run: chmod +x ./working-dir/wait-for-docker-logs.sh
85+
- name: Wait for localstack
86+
run: ./working-dir/wait-for-docker-logs.sh localstack-emulator "Bootstrapping Complete" 60
87+
- name: Wait for keeperdata_api to be ready
88+
run: ./working-dir/wait-for-docker-logs.sh keeperdata_api "Now listening on" 60
89+
- name: Run integration tests
90+
run: dotnet test ./working-dir/KeeperData.Api.sln --filter "Category=Integration"
8391

8492
## SonarCloud
8593
## Uncomment to unable SonarCloud scan

Dockerfile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ RUN dotnet restore "KeeperData.Core/KeeperData.Core.csproj" -r linux-x64 -v n
2929

3030
COPY ["src/", "."]
3131

32-
# Run all tests except those with "Integration" in the path
33-
RUN find ./tests -name '*.csproj' | grep -v Integration | while read testproj; do \
34-
dotnet test "$testproj" --configuration ${BUILD_CONFIGURATION} --no-restore --verbosity normal; \
35-
done
36-
3732
FROM build AS publish
3833
WORKDIR "/src/KeeperData.Api"
3934
RUN dotnet publish "KeeperData.Api.csproj" -v n -c ${BUILD_CONFIGURATION} -o /app/publish -r linux-x64 --no-restore /p:UseAppHost=false

docker-compose.override.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ services:
66
- ASPNETCORE_ENVIRONMENT=Development
77
- ASPNETCORE_HTTP_PORTS=8080
88
- AWS__ServiceURL=http://localstack-emulator:4566
9-
#- AWS__ServiceURL=http://sqs.eu-west-2.localhost.localstack.cloud:4566/
109
- Mongo__DatabaseUri=mongodb://mongodb:27017
1110
- QueueConsumerOptions__IntakeEventQueueOptions__QueueUrl=http://sqs.eu-west-2.127.0.0.1:4566/000000000000/ls_keeper_data_intake_queue
1211
ports:

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
version: '3.4'
21
name: 'keeperdata_api'
32
services:
43
localstack:
@@ -15,7 +14,8 @@ services:
1514
SERVICES: s3,sqs,sns,firehose
1615
LOCALSTACK_HOST: 127.0.0.1
1716
volumes:
18-
- '${TMPDIR:-/tmp}/localstack:/var/lib/localstack'
17+
- "./localstack_data:/var/lib/localstack"
18+
- "/var/run/docker.sock:/var/run/docker.sock"
1919
- ./compose/start-localstack.sh:/etc/localstack/init/ready.d/start-localstack.sh
2020
healthcheck:
2121
test: ['CMD', 'curl', 'http://localstack-emulator:4566/health']

0 commit comments

Comments
 (0)