Repository navigation
77 lines (63 loc) · 2.73 KB
/
Copy pathpullrequest.yml
File metadata and controls
77 lines (63 loc) · 2.73 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
name: Build and Test Pull Requests
on:
pull_request:
branches:
- main
jobs:
build:
name: "Build and Test Pull Requests"
env:
ASPNETCORE_ENVIRONMENT: "Production"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
- name: Restore Nuget Packages
run: dotnet restore MessagingService.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }}
- name: Build Code
run: dotnet build MessagingService.sln --configuration Release
- name: Run Unit Tests
run: |
echo "ASPNETCORE_ENVIRONMENT are > ${ASPNETCORE_ENVIRONMENT}"
dotnet test "MessagingService.BusinessLogic.Tests/MessagingService.BusinessLogic.Tests.csproj" --configuration Release --verbosity normal -- --report-trx
dotnet test "MessagingService.EmailAggregate.Tests/MessagingService.EmailAggregate.Tests.csproj" --configuration Release --verbosity normal -- --report-trx
dotnet test "MessagingService.SMSAggregate.Tests/MessagingService.SMSAggregate.Tests.csproj" --configuration Release --verbosity normal -- --report-trx
- name: Build Docker Image
env:
GITHUBTOKEN: ${{ secrets.PRIVATEFEED_APIKEY }}
run: docker build . --file MessagingService/Dockerfile --tag messagingservice:latest --build-arg NUGET_TOKEN=${{ secrets.PRIVATEFEED_APIKEY }}
- name: Run Integration Tests
run: dotnet test "MessagingService.IntegrationTests/MessagingService.IntegrationTests.csproj" --filter Category=PRTest --configuration Release --verbosity normal --results-directory "${{ github.workspace }}/TestResults" --settings "MessagingService.IntegrationTests/Integration.runsettings"
- uses: actions/upload-artifact@v4.4.0
with:
name: tracelogs
path: /home/runner/trace/
- name: Publish unit test results
uses: dorny/test-reporter@v1
if: always()
with:
name: Unit Test Results
path: '**/TestResults/*.trx'
reporter: dotnet-trx
fail-on-error: true
- name: Publish integration test results
uses: dorny/test-reporter@v1
if: always()
with:
name: Integration Test Results
path: 'TestResults/MessagingService.IntegrationTests.xml'
reporter: dotnet-nunit
fail-on-error: true
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: '**/TestResults/*.trx'
retention-days: 30
- name: Upload integration test results
uses: actions/upload-artifact@v4
if: always()
with:
name: integration-test-results
path: 'TestResults/MessagingService.IntegrationTests.xml'
retention-days: 30