77 push :
88 branches :
99 - master
10- - dev
11- - hotfix/*
1210 - release/*
13- - feature /*
11+ - hotfix /*
1412 pull_request :
1513 branches :
1614 - master
17- workflow_dispatch : # <-- вот это даёт ручной запуск
15+ workflow_dispatch : # allows manual runs from the Actions tab
1816
1917jobs :
2018 build :
21- permissions : # <-- https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#defining-access-for-the-github_token-scopes
19+ permissions : # https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#defining-access-for-the-github_token-scopes
2220 contents : write
2321
2422 env :
@@ -31,11 +29,11 @@ jobs:
3129 shell : pwsh
3230
3331 steps :
32+
3433 - name : Checkout
3534 uses : actions/checkout@v4
3635 with :
37- # Disabling shallow clones is recommended for improving the relevancy of reporting
38- fetch-depth : 0
36+ fetch-depth : 0 # Disabling shallow clones is recommended for improving the relevancy of reporting
3937
4038 - name : Setup MSBuild
4139 uses : microsoft/setup-msbuild@v2
4846 distribution : microsoft
4947 java-version : " 17"
5048
51- - name : Install GitVersion
49+ - name : Setup GitVersion
5250 uses : gittools/actions/gitversion/setup@v1.1.1
5351 with :
5452 versionSpec : 5.12.0
@@ -61,26 +59,42 @@ jobs:
6159 - name : Restore
6260 run : msbuild $env:SOLUTION /t:restore /p:configuration=$env:BUILD_CONFIG /v:m
6361
62+ - name : Build
63+ run : |
64+ dotnet build "$SOLUTION" --configuration "$BUILD_CONFIG" --no-restore \
65+ -p:Configuration=$BUILD_CONFIG \
66+ -p:Version=${GitVersion_SemVer} \
67+ -p:AssemblyVersion=${GitVersion_AssemblySemVer} \
68+ -p:FileVersion=${GitVersion_AssemblySemFileVer} \
69+ -p:InformationalVersion="${GitVersion_InformationalVersion}" \
70+ -p:Company="Denis Peshkov" \
71+ -p:Product="src/TypeScriptDefinitionGenerator" \
72+ -p:Description="Written on C#." \
73+ -p:RepositoryUrl="https://github.com/denis-peshkov/TypeScriptDefinitionGenerator.git" \
74+ -p:RepositoryType=git \
75+ -p:CLSCompliant=true \
76+ -p:NeutralLanguage=en
77+
6478 - name : Run tests
65- run : dotnet test /p:Configuration=$BUILD_CONFIG --no-restore --no-build --verbosity normal
79+ run : >
80+ dotnet test /p:Configuration=$BUILD_CONFIG
81+ --no-restore
82+ --no-build
83+ --verbosity normal
84+ --collect:"XPlat Code Coverage"
85+ --results-directory ./TestResults
86+ --
87+ DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover
6688
6789 - name : SonarQube Scan
6890 uses : sonarsource/sonarcloud-github-action@v5 # Ex: v4.0.0, See the latest version at https://github.com/marketplace/actions/sonarcloud-scan
6991 with :
70- # projectBaseDir: app/
71- # args: >
72- # -Dsonar.organization=peshkov
73- # -Dsonar.projectKey=Cross.EdiEngine
74- # -Dsonar.python.coverage.reportPaths=coverage.xml
75- # -Dsonar.sources=Cross.EdiEngine/
76- # -Dsonar.tests=tests/
77- # -Dsonar.test.exclusions=tests/**
78- # -Dsonar.verbose=true
7992 args : >
8093 -Dsonar.organization=peshkov
81- -Dsonar.projectKey=Cross.EdiEngine
82- -Dsonar.python.coverage.reportPaths=coverage.xml
83- -Dsonar.sources=EdiEngine/
94+ -Dsonar.projectKey=TypeScriptDefinitionGenerator
95+ -Dsonar.cs.opencover.reportsPaths=TestResults/**/coverage.opencover.xml
96+ -Dsonar.sources=src/
97+ -Dsonar.tests=tests/
8498 -Dsonar.verbose=true
8599 env :
86100 SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
@@ -135,11 +149,8 @@ jobs:
135149 env :
136150 NUGET_API_KEY : ${{ secrets.NUGET_API_KEY }}
137151
138- - name : ref
139- run : echo "github.head_ref 1 ${{ github.head_ref }} 2 $GITHUB_REF 3 ${{ github.ref }}"
140-
141152 - name : Create git Tag
142- if : ${{ contains('refs/heads/hotfix ', github.ref) || contains('refs/heads/release', github.ref) || contains('refs/heads/master ', github.ref) }}
153+ if : ${{ contains('refs/heads/master ', github.ref) || contains('refs/heads/release', github.ref) || contains('refs/heads/hotfix ', github.ref) }}
143154 run : |
144155 git tag v${{ env.semVer }}
145156
0 commit comments