Skip to content

Commit bd93a32

Browse files
committed
Add workflow config and codeowners definition file
update readme and build configuration
1 parent 85589ca commit bd93a32

5 files changed

Lines changed: 209 additions & 2 deletions

File tree

.github/CODEOWNERS.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Lines starting with '#' are comments.
2+
# Each line is a file pattern followed by one or more owners.
3+
# Syntax can be found here: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#codeowners-syntax
4+
5+
* @IVNSTN

.github/workflows/ci.yml

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
# This workflow will build a .NET project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
3+
4+
name: Build .NET lib
5+
6+
on:
7+
push:
8+
branches: [ "develop" ]
9+
pull_request:
10+
branches: [ "main" ]
11+
12+
env:
13+
PRODUCT_NAME: TeamTools.Linter.CommandLine
14+
OUTPUT_PATH: ${{ github.workspace }}/.bin/
15+
16+
jobs:
17+
semver:
18+
runs-on: ubuntu-latest
19+
outputs:
20+
next-version: ${{ steps.next-ver.outputs.VERSION }}
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Prepare next version
26+
id: next-ver
27+
run: |
28+
VERSION=$(date +%Y.%m.${{ github.run_number }})
29+
echo Next version: $VERSION
30+
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
31+
32+
build:
33+
name: Build and test
34+
needs: semver
35+
runs-on: ${{ matrix.os }}
36+
37+
defaults:
38+
run:
39+
shell: bash
40+
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
os: [windows-latest, ubuntu-latest]
45+
configuration: [Debug, Release]
46+
include:
47+
- os: windows-latest
48+
configuration: Debug
49+
coverage: true
50+
51+
steps:
52+
- uses: actions/checkout@v4
53+
54+
- name: Setup .NET
55+
uses: actions/setup-dotnet@v4
56+
with:
57+
dotnet-version: |
58+
3.1.x
59+
6.0.x
60+
8.0.x
61+
62+
- name: Display dotnet version
63+
run: dotnet --info
64+
65+
- name: Cache NuGet packages
66+
id: cache-nugets
67+
uses: actions/cache@v4
68+
with:
69+
path: ${{ github.workspace }}/packages
70+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json', '**/*.csproj', 'Directory.Build.props') }} # Unique key for the cache
71+
restore-keys: |
72+
${{ runner.os }}-nuget-
73+
74+
- name: Install coverlet
75+
run: |
76+
dotnet add package coverlet.msbuild --version 6.0.4 &&
77+
dotnet add package coverlet.collector --version 6.0.4
78+
working-directory: TeamTools.Linter.CommandLineTests
79+
80+
- name: Restore dependencies
81+
# if: ${{ steps.cache-nugets.outputs.cache-hit != 'true' }}
82+
run: dotnet restore --p:ContinuousIntegrationBuild=true
83+
84+
- name: Build
85+
id: build
86+
run: >
87+
dotnet build --no-restore
88+
--configuration ${{ matrix.configuration }}
89+
-p:VersionPrefix=${{ needs.semver.outputs.next-version }}
90+
-p:ContinuousIntegrationBuild=true
91+
-p:SourceRevisionId=${{ github.sha }}
92+
-p:RepositoryUrl="${{ github.repositoryUrl }}"
93+
-p:RepositoryType=git
94+
-p:RepositoryBranch="${{ github.ref_name }}"
95+
-p:BaseOutputPath="${{ env.OUTPUT_PATH }}"
96+
97+
- name: Test
98+
if: ${{ !matrix.coverage }}
99+
run: >
100+
dotnet test --no-build --verbosity normal
101+
-p:BaseOutputPath="${{ env.OUTPUT_PATH }}"
102+
--configuration ${{ matrix.configuration }}
103+
--logger "trx;LogFileName=${{ github.workspace }}/TestResults/test-results.trx"
104+
105+
- name: Test with coverage
106+
if: ${{ matrix.coverage }}
107+
run: >
108+
dotnet test --no-build --verbosity normal
109+
-p:CollectCoverage=true -p:CoverletOutput="${{ github.workspace }}/TestResults/" -p:CoverletOutputFormat=opencover /p:ExcludeByFile="**/TeamTools.TSQL.Common/**/*.cs"
110+
-p:BaseOutputPath="${{ env.OUTPUT_PATH }}"
111+
--configuration ${{ matrix.configuration }}
112+
--logger "trx;LogFileName=${{ github.workspace }}/TestResults/test-results.trx"
113+
114+
- name: Upload test artifacts
115+
uses: actions/upload-artifact@v4
116+
if: ${{ matrix.coverage }}
117+
with:
118+
name: test-results
119+
path: TestResults
120+
121+
- name: Test Report
122+
uses: dorny/test-reporter@v2
123+
if: ${{ !cancelled() }} # run this step even if previous step failed
124+
with:
125+
name: NUnit testing ${{ matrix.configuration }} build on ${{ matrix.os }}
126+
path: '**/TestResults/*.trx,*.trx'
127+
reporter: dotnet-trx
128+
129+
- name: Upload build artifacts 3.1
130+
uses: actions/upload-artifact@v4
131+
if: ${{ matrix.configuration == 'Release' && matrix.os == 'windows-latest' && steps.build.conclusion == 'success' }}
132+
with:
133+
name: ${{ env.PRODUCT_NAME }}-${{ needs.semver.outputs.next-version }}-${{ matrix.configuration }}-netcoreapp3.1
134+
path: ${{ env.OUTPUT_PATH }}/${{ matrix.configuration }}/netcoreapp3.1
135+
136+
- name: Upload build artifacts 6.0
137+
uses: actions/upload-artifact@v4
138+
if: ${{ matrix.configuration == 'Release' && matrix.os == 'windows-latest' && steps.build.conclusion == 'success' }}
139+
with:
140+
name: ${{ env.PRODUCT_NAME }}-${{ needs.semver.outputs.next-version }}-${{ matrix.configuration }}-net6.0
141+
path: ${{ env.OUTPUT_PATH }}/${{ matrix.configuration }}/net6.0
142+
143+
- name: Upload build artifacts 8.0
144+
uses: actions/upload-artifact@v4
145+
if: ${{ matrix.configuration == 'Release' && matrix.os == 'windows-latest' && steps.build.conclusion == 'success' }}
146+
with:
147+
name: ${{ env.PRODUCT_NAME }}-${{ needs.semver.outputs.next-version }}-${{ matrix.configuration }}-net8.0
148+
path: ${{ env.OUTPUT_PATH }}/${{ matrix.configuration }}/net8.0
149+
150+
report:
151+
needs: build
152+
if: always()
153+
runs-on: ubuntu-latest
154+
155+
steps:
156+
- uses: actions/checkout@v4
157+
158+
- name: Download test results
159+
uses: actions/download-artifact@v4
160+
with:
161+
name: test-results
162+
path: TestResults
163+
164+
- name: Extract coverage info
165+
uses: simon-k/dotnet-code-coverage-badge@v1.0.0
166+
id: create_coverage_badge
167+
if: ${{ !cancelled() && hashFiles('TestResults/coverage.opencover.xml') != '' }}
168+
with:
169+
label: Unit Test Coverage
170+
color: brightgreen
171+
path: TestResults/coverage.opencover.xml
172+
gist-filename: code-coverage.json
173+
gist-id: ${{ vars.GIST_COVERAGE_ID }}
174+
gist-auth-token: ${{ secrets.GIST_AUTH_TOKEN }}
175+
176+
- name: Create Coverage Badge
177+
uses: schneegans/dynamic-badges-action@v1.7.0
178+
if: ${{ !cancelled() && hashFiles('TestResults/coverage.opencover.xml') != '' && steps.create_coverage_badge.outputs.percentage != '' }}
179+
with:
180+
auth: ${{ secrets.GIST_AUTH_TOKEN }}
181+
gistID: ${{ vars.GIST_COVERAGE_ID }}
182+
filename: code-coverage.svg
183+
label: Coverage
184+
message: ${{ steps.create_coverage_badge.outputs.percentage }}%
185+
valColorRange: ${{ steps.create_coverage_badge.outputs.percentage }}
186+
maxColorRange: 100
187+
minColorRange: 0
188+
189+
- name: Print code coverage
190+
if: steps.create_coverage_badge.outcome == 'success'
191+
run: echo "Code coverage percentage ${{steps.create_coverage_badge.outputs.percentage}}%"
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<EnableNETAnalyzers>true</EnableNETAnalyzers>
55
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory).stylecop\StyleCop.ruleset</CodeAnalysisRuleSet>
66
<RunSettingsFilePath>$(MSBuildThisFileDirectory).runsettings</RunSettingsFilePath>
7-
<TreatWarningsAsErrors Condition=" '$(ContinuousIntegrationBuild)' == 'true' ">true</TreatWarningsAsErrors>
7+
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
88
<NoWarn>$(NoWarn);NU1601;NU1603;NU1801;NETSDK1138</NoWarn>
99
<!-- IDE0130 Namespace does not match folder structure -->
1010
<NoWarn>$(NoWarn);IDE0130</NoWarn>
@@ -67,10 +67,15 @@
6767
<!-- Additional info options -->
6868
<PropertyGroup>
6969
<AppDesignerFolder>Properties</AppDesignerFolder>
70-
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
70+
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
7171
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
7272
<NeutralLanguage>en</NeutralLanguage>
7373
<NeutralResourcesLanguage>en</NeutralResourcesLanguage>
74+
<Company>Ivan Starostin</Company>
75+
<Authors>Ivan Starostin et al.</Authors>
76+
<Copyright>© $([System.DateTime]::Now.Year) $(Company)</Copyright>
77+
<AssemblyCopyright>$(Copyright)</AssemblyCopyright>
78+
<IncludeSourceRevisionInInformationalVersion>true</IncludeSourceRevisionInInformationalVersion>
7479
</PropertyGroup>
7580

7681
<!-- No packing for test projects -->

NuGet.Config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
3+
<packageSources>
4+
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
5+
</packageSources>
36
<config>
47
<add key="globalPackagesFolder" value=".\packages"/>
58
<add key="dependencyVersion" value="Highest"/>

readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11

22
# TeamTools Linter CommandLine
33

4+
[![License MIT](https://gist.githubusercontent.com/IVNSTN/905fc514e3cea426d51efae6b98ca4d5/raw/License-MIT-purple.svg)](./LICENSE)
5+
[![coverage](https://gist.githubusercontent.com/IVNSTN/905fc514e3cea426d51efae6b98ca4d5/raw/code-coverage.svg)](https://github.com/IVNSTN/TeamTools.Linter.CommandLine/actions)
6+
47
Утилита командной строки для выполнения линтинга с поддержкой подключаемых плагинов.
58

69
## Плагины

0 commit comments

Comments
 (0)