-
-
Notifications
You must be signed in to change notification settings - Fork 38
125 lines (119 loc) · 4.41 KB
/
main.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
115
116
117
118
119
120
121
122
123
124
125
name: Claptrap build
on:
push:
branches:
- master
- develop
- feature/ci
- feature/ut
pull_request:
branches:
- master
- develop
jobs:
build:
runs-on: ubuntu-latest
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
container: mcr.microsoft.com/dotnet/sdk:5.0
services:
mongo:
image: mongo
ports:
- 27017
env:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: claptrap
mysql:
image: mysql
# options: >-
# --local-infile=1
ports:
- 3306
env:
MYSQL_ROOT_PASSWORD: claptrap
MYSQL_DATABASE: claptrap
MYSQL_USER: claptrap
MYSQL_PASSWORD: claptrap
postgres:
image: postgres:12.3-alpine
env:
POSTGRES_PASSWORD: claptrap
POSTGRES_DB: claptrap
ports:
- 5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
rabbitmq:
image: rabbitmq:3-management-alpine
ports:
- 5672
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Cache SonarCloud packages
uses: actions/cache@v2
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v2
with:
path: ~/.sonar/scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: "11" # The JDK version to make available on the path.
java-package: jdk # (jre, jdk, or jdk+fx) - defaults to jdk
architecture: x64 # (x64 or x86) - defaults to x64
- name: Install SonarCloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
run: |
mkdir -p ~/.sonar/scanner
dotnet tool update dotnet-sonarscanner --tool-path ~/.sonar/scanner
- name: Install dependencies
run: |
cd $GITHUB_WORKSPACE/src
dotnet restore
- name: build and test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
Claptrap__RabbitMQ__Uri: amqp://guest:guest@rabbitmq:5672/%2f
run: |
~/.sonar/scanner/dotnet-sonarscanner begin /k:"newbe36524_Newbe.Claptrap" /o:"newbe36524" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths='"src/*.Tests/TestResults/*/coverage.opencover.xml"'
dotnet build $GITHUB_WORKSPACE/src --configuration Release
dotnet test $GITHUB_WORKSPACE/src --configuration Release -l "console;verbosity=detailed" --collect:"XPlat Code Coverage" --settings $GITHUB_WORKSPACE/src/coverlet.runsettings --logger:nunit -- NUnit.Where="namespace =~ ^Newbe"
~/.sonar/scanner/dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
- uses: MirrorNG/[email protected]
if: always()
with:
path: src/*.Tests/TestResults/*.xml
access-token: ${{ secrets.GITHUB_TOKEN }}
- name: Codecov
uses: codecov/[email protected]
# with:
# # User defined upload name. Visible in Codecov UI
# name: # optional
# # Repository upload token - get it from codecov.io. Required only for private repositories
# token: # optional
# # Path to coverage file to upload
# file: # optional
# # Flag upload to group coverage metrics (e.g. unittests | integration | ui,chrome)
# flags: # optional
# # Specify whether or not CI build should fail if Codecov runs into an error during upload
# fail_ci_if_error: # optional
- name: Codacy Coverage Reporter
uses: codacy/[email protected]
with:
# Project token for the Codacy project you want to send coverage information
project-token: ${{ secrets.CODACY_TOKEN }}
# Optional comma separated list of coverage reports to send to Codacy
coverage-reports: src/*.Tests/TestResults/*/coverage.opencover.xml # optional, default is