-
Notifications
You must be signed in to change notification settings - Fork 3
93 lines (90 loc) · 3.67 KB
/
build.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
name: SonarCloud
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Build and analyze
runs-on: windows-latest
steps:
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'zulu'
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v3
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- name: Install SonarCloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: powershell
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
- name: Install dotnet-coverage
shell: powershell
run: dotnet tool install --global dotnet-coverage
- name: Clone trx2sonar
uses: actions/checkout@v3
with:
repository: gmarokov/dotnet-trx2sonar
path: dotnet-trx2sonar
- name: Setup trx2sonar
shell: powershell
run: |
dotnet restore dotnet-trx2sonar
dotnet build dotnet-trx2sonar --configuration Release
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"fga-eps-mds_2023.1-Dnit-UpsService" /o:"fga-eps-mds-1" /d:sonar.login="5e981eabd44a537f64a8d46d957ee6e352a1447f" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml /d:sonar.testExecutionReportPaths=results.xml
dotnet build
dotnet-coverage collect "dotnet test" -f xml -o "coverage.xml"
dotnet test --logger "trx;LogFileName=results.trx" --results-directory ./TestResults/results.xml
./dotnet-trx2sonar/TrxToSonar/bin/Release/net6.0/TrxToSonar -d ./TestResults -o results.xml
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="5e981eabd44a537f64a8d46d957ee6e352a1447f"
generate-release:
runs-on: ubuntu-latest
needs: build
steps:
- name: Get file name
id: name
run: echo "::set-output name=file_name::fga-eps-mds_2023.1-Dnit-UpsService-$(TZ='America/Sao_Paulo' date +'%m-%d-%Y-%H-%M-%S')-${{github.ref_name}}"
- name: Copy repository
uses: actions/checkout@v2
- run: wget $METRICS_URL -O ${{ steps.name.outputs.file_name }}.json
env:
METRICS_URL: ${{ secrets.METRICS_URL }}
- uses: actions/upload-artifact@v2
with:
name: ${{ steps.name.outputs.file_name }}.json
path: ${{ steps.name.outputs.file_name }}.json
- name: Send metrics to doc repo
uses: dmnemec/[email protected]
env:
API_TOKEN_GITHUB: ${{ secrets.TOKEN_GITHUB }}
with:
source_file: ${{ steps.name.outputs.file_name }}.json
destination_repo: 'fga-eps-mds/2023.1-Dnit-DOC'
destination_folder: 'analytics-raw-data'
user_email: ${{ secrets.GIT_EMAIL}}
user_name: ${{ secrets.GIT_USER }}
commit_message: M�tricas autom�ticas da release ${{github.ref_name}} - ${{ github.event.repository.name }}