Skip to content

Commit dc23d97

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

7 files changed

Lines changed: 315 additions & 8 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: 296 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,296 @@
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: [ "main" ]
9+
pull_request:
10+
branches: [ "main" ]
11+
12+
env:
13+
PRODUCT_NAME: TeamTools.Linter.CommandLine
14+
TEST_PROJECT: TeamTools.Linter.CommandLineTests
15+
PUBLISH_PROJECT_PATH: TeamTools.Linter.CommandLine/TeamTools.Linter.CommandLine.csproj
16+
OUTPUT_PATH: ${{ github.workspace }}/.bin/
17+
PUBLISH_PATH: ${{ github.workspace }}/.pub/
18+
19+
jobs:
20+
semver:
21+
runs-on: ubuntu-latest
22+
outputs:
23+
next-version: ${{ steps.next-ver.outputs.VERSION }}
24+
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Prepare next version
29+
id: next-ver
30+
run: |
31+
VERSION=$(date +%Y.%-m.${{ github.run_number }})
32+
echo Next version: $VERSION
33+
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
34+
35+
build:
36+
name: Build and test
37+
needs: semver
38+
runs-on: ${{ matrix.os }}
39+
outputs:
40+
build-result: ${{ steps.bundle-status.outputs.BUNDLE_STATUS }}
41+
42+
defaults:
43+
run:
44+
shell: bash
45+
46+
strategy:
47+
fail-fast: false
48+
matrix:
49+
os: [windows-latest, ubuntu-latest]
50+
configuration: [Debug, Release]
51+
include:
52+
- os: windows-latest
53+
configuration: Debug
54+
coverage: true
55+
- os: windows-latest
56+
configuration: Release
57+
publish: true
58+
59+
steps:
60+
- uses: actions/checkout@v4
61+
62+
- name: Setup .NET
63+
uses: actions/setup-dotnet@v4
64+
with:
65+
dotnet-version: |
66+
3.1.x
67+
6.0.x
68+
8.0.x
69+
70+
- name: Display dotnet version
71+
run: dotnet --info
72+
73+
- name: Cache NuGet packages
74+
id: cache-nugets
75+
uses: actions/cache@v4
76+
with:
77+
path: ${{ github.workspace }}/packages
78+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json', '**/*.csproj', 'Directory.Build.props') }} # Unique key for the cache
79+
restore-keys: |
80+
${{ runner.os }}-nuget-
81+
82+
- name: Install coverlet
83+
run: |
84+
dotnet add package coverlet.msbuild --version 6.0.4 &&
85+
dotnet add package coverlet.collector --version 6.0.4
86+
working-directory: ${{ env.TEST_PROJECT }}
87+
88+
- name: Restore dependencies
89+
# if: ${{ steps.cache-nugets.outputs.cache-hit != 'true' }}
90+
run: dotnet restore --p:ContinuousIntegrationBuild=true
91+
92+
- name: Build
93+
id: build
94+
run: >
95+
dotnet build --no-restore
96+
--configuration ${{ matrix.configuration }}
97+
-p:VersionPrefix=${{ needs.semver.outputs.next-version }}
98+
-p:ContinuousIntegrationBuild=true
99+
-p:SourceRevisionId=${{ github.sha }}
100+
-p:RepositoryUrl="${{ github.repositoryUrl }}"
101+
-p:RepositoryType=git
102+
-p:RepositoryBranch="${{ github.ref_name }}"
103+
-p:BaseOutputPath="${{ env.OUTPUT_PATH }}"
104+
105+
- name: Upload release bundle
106+
id: upload-bundle
107+
uses: actions/upload-artifact@v4
108+
if: ${{ matrix.publish && steps.build.conclusion == 'success' }}
109+
with:
110+
name: bundle-${{ matrix.configuration }}
111+
path: ${{ env.OUTPUT_PATH }}/${{ matrix.configuration }}
112+
113+
- name: Set bundle status
114+
id: bundle-status
115+
if: ${{ matrix.publish }}
116+
run: |
117+
echo "BUNDLE_STATUS=${{ steps.upload-bundle.conclusion }}" >> $GITHUB_OUTPUT
118+
119+
- name: Prepare publish package per framework
120+
if: ${{ matrix.publish }}
121+
run: >
122+
dotnet publish "${{ env.PUBLISH_PROJECT_PATH }}" --no-build
123+
-p:TargetFramework=netcoreapp3.1
124+
-p:Configuration=${{ matrix.configuration }}
125+
-p:BaseOutputPath="${{ env.OUTPUT_PATH }}"
126+
-p:PublishDir="${{ env.PUBLISH_PATH }}/Release/netcoreapp3.1"
127+
&& dotnet publish "${{ env.PUBLISH_PROJECT_PATH }}" --no-build
128+
-p:TargetFramework=net6.0
129+
-p:Configuration=${{ matrix.configuration }}
130+
-p:BaseOutputPath="${{ env.OUTPUT_PATH }}"
131+
-p:PublishDir="${{ env.PUBLISH_PATH }}/Release/net6.0"
132+
&& dotnet publish "${{ env.PUBLISH_PROJECT_PATH }}" --no-build
133+
-p:TargetFramework=net8.0
134+
-p:Configuration=${{ matrix.configuration }}
135+
-p:BaseOutputPath="${{ env.OUTPUT_PATH }}"
136+
-p:PublishDir="${{ env.PUBLISH_PATH }}/Release/net8.0"
137+
138+
- name: Upload build for netcoreapp3.1
139+
uses: actions/upload-artifact@v4
140+
with:
141+
name: ${{ env.PRODUCT_NAME }}-${{ needs.semver.outputs.next-version }}-${{ matrix.configuration }}-netcoreapp3.1
142+
path: ${{ env.PUBLISH_PATH }}/${{ matrix.configuration }}/netcoreapp3.1
143+
144+
- name: Upload build for net6.0
145+
uses: actions/upload-artifact@v4
146+
with:
147+
name: ${{ env.PRODUCT_NAME }}-${{ needs.semver.outputs.next-version }}-${{ matrix.configuration }}-net6.0
148+
path: ${{ env.PUBLISH_PATH }}/${{ matrix.configuration }}/net6.0
149+
150+
- name: Upload build for net8.0
151+
uses: actions/upload-artifact@v4
152+
with:
153+
name: ${{ env.PRODUCT_NAME }}-${{ needs.semver.outputs.next-version }}-${{ matrix.configuration }}-net8.0
154+
path: ${{ env.PUBLISH_PATH }}/${{ matrix.configuration }}/net8.0
155+
156+
- name: Test
157+
if: ${{ !matrix.coverage }}
158+
run: >
159+
dotnet test --no-build --verbosity normal
160+
-p:BaseOutputPath="${{ env.OUTPUT_PATH }}"
161+
--configuration ${{ matrix.configuration }}
162+
--logger "trx;LogFileName=${{ github.workspace }}/TestResults/test-results.trx"
163+
164+
- name: Test with coverage
165+
if: ${{ matrix.coverage }}
166+
run: >
167+
dotnet test --no-build --verbosity normal
168+
-p:CollectCoverage=true -p:CoverletOutput="${{ github.workspace }}/TestResults/" -p:CoverletOutputFormat=opencover /p:ExcludeByFile="**/TeamTools.TSQL.Common/**/*.cs"
169+
-p:BaseOutputPath="${{ env.OUTPUT_PATH }}"
170+
--configuration ${{ matrix.configuration }}
171+
--logger "trx;LogFileName=${{ github.workspace }}/TestResults/test-results.trx"
172+
173+
- name: Upload test artifacts
174+
uses: actions/upload-artifact@v4
175+
if: ${{ matrix.coverage }}
176+
with:
177+
name: test-results
178+
path: TestResults
179+
180+
- name: Test Report
181+
uses: dorny/test-reporter@v2
182+
if: ${{ !cancelled() }} # run this step even if previous step failed
183+
with:
184+
name: NUnit testing ${{ matrix.configuration }} build on ${{ matrix.os }}
185+
path: '**/TestResults/*.trx,*.trx'
186+
reporter: dotnet-trx
187+
188+
report:
189+
name: Update badges
190+
needs: [build]
191+
if: ${{ always() && needs.build.outputs.build-result == 'success' }}
192+
runs-on: ubuntu-latest
193+
194+
steps:
195+
- uses: actions/checkout@v4
196+
- name: Download test results
197+
uses: actions/download-artifact@v4
198+
with:
199+
name: test-results
200+
path: TestResults
201+
202+
- name: Extract coverage info
203+
uses: simon-k/dotnet-code-coverage-badge@v1.0.0
204+
id: create_coverage_badge
205+
if: ${{ !cancelled() && hashFiles('TestResults/coverage.opencover.xml') != '' }}
206+
with:
207+
label: Unit Test Coverage
208+
color: brightgreen
209+
path: TestResults/coverage.opencover.xml
210+
gist-filename: code-coverage.json
211+
gist-id: ${{ vars.GIST_COVERAGE_ID }}
212+
gist-auth-token: ${{ secrets.GIST_AUTH_TOKEN }}
213+
214+
- name: Create Coverage Badge
215+
uses: schneegans/dynamic-badges-action@v1.7.0
216+
if: ${{ !cancelled() && hashFiles('TestResults/coverage.opencover.xml') != '' && steps.create_coverage_badge.outputs.percentage != '' }}
217+
with:
218+
auth: ${{ secrets.GIST_AUTH_TOKEN }}
219+
gistID: ${{ vars.GIST_COVERAGE_ID }}
220+
filename: code-coverage.svg
221+
label: Coverage
222+
message: ${{ steps.create_coverage_badge.outputs.percentage }}%
223+
valColorRange: ${{ steps.create_coverage_badge.outputs.percentage }}
224+
maxColorRange: 100
225+
minColorRange: 0
226+
227+
- name: Print code coverage
228+
if: steps.create_coverage_badge.outcome == 'success'
229+
run: echo "Code coverage percentage ${{steps.create_coverage_badge.outputs.percentage}}%"
230+
231+
repack-with-plugins:
232+
name: Repackage with plugins
233+
needs: [semver, build]
234+
if: ${{ always() && needs.build.outputs.build-result == 'success' }}
235+
runs-on: ubuntu-latest
236+
237+
strategy:
238+
fail-fast: false
239+
matrix:
240+
configuration: [Release]
241+
dotnet: [netstandard2.0, net6.0, net8.0]
242+
include:
243+
- dotnet: net6.0
244+
app-dotnet: net6.0
245+
- dotnet: net8.0
246+
app-dotnet: net8.0
247+
- dotnet: netstandard2.0
248+
app-dotnet: netcoreapp3.1
249+
250+
steps:
251+
- name: Grab CLI ${{ matrix.app-dotnet }}
252+
id: cli
253+
uses: actions/download-artifact@v4
254+
with:
255+
name: ${{ env.PRODUCT_NAME }}-${{ needs.semver.outputs.next-version }}-${{ matrix.configuration }}-${{ matrix.app-dotnet }}
256+
path: ${{ env.PRODUCT_NAME }}-${{ needs.semver.outputs.next-version }}-${{ matrix.configuration }}-${{ matrix.app-dotnet }}
257+
258+
- name: Grab TSQL plugin ${{ matrix.dotnet }}
259+
uses: dawidd6/action-download-artifact@v11
260+
with:
261+
github_token: ${{secrets.GITHUB_TOKEN}}
262+
repo: IVNSTN/TeamTools.Linter.TSQL
263+
workflow: ci.yml
264+
workflow_conclusion: completed
265+
branch: main
266+
name: TeamTools\.Linter\.TSQL-[\d.]+-${{ matrix.configuration }}-${{ matrix.dotnet }}
267+
name_is_regexp: true
268+
path: ${{ steps.cli.outputs.download-path }}/Plugins
269+
270+
- name: Grab SSDT plugin for ${{ matrix.dotnet }}
271+
uses: dawidd6/action-download-artifact@v11
272+
with:
273+
github_token: ${{secrets.GITHUB_TOKEN}}
274+
repo: IVNSTN/TeamTools.Linter.SSDT
275+
workflow: ci.yml
276+
workflow_conclusion: completed
277+
branch: main
278+
name: TeamTools\.Linter\.SSDT-[\d.]+-${{ matrix.configuration }}-${{ matrix.dotnet }}
279+
name_is_regexp: true
280+
path: ${{ steps.cli.outputs.download-path }}/Plugins
281+
282+
- name: Remove version info from plugin folder names
283+
run: |
284+
cd "${{ steps.cli.outputs.download-path }}/Plugins"
285+
for dir in TeamTools.Linter.TSQL* ; do
286+
mv "${dir}" "TeamTools.Linter.TSQL";
287+
done
288+
for dir in TeamTools.Linter.SSDT* ; do
289+
mv "${dir}" "TeamTools.Linter.SSDT";
290+
done
291+
292+
- name: Upload repack
293+
uses: actions/upload-artifact@v4
294+
with:
295+
name: ${{ env.PRODUCT_NAME }}-${{ needs.semver.outputs.next-version }}-${{ matrix.configuration }}-${{ matrix.app-dotnet }}-with-plugins-TSQL-SSDT
296+
path: ${{ steps.cli.outputs.download-path }}
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"/>

TeamTools.Linter.CommandLine/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,3 @@
22
using System.Runtime.CompilerServices;
33

44
[assembly: InternalsVisibleTo("TeamTools.Linter.CommandLineTests")]
5-
[assembly: AssemblyVersion("1.0.0.0")]
6-
[assembly: AssemblyFileVersion("1.0.0.0")]
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
using System.Reflection;
2-
3-
[assembly: AssemblyVersion("1.0.0.0")]
4-
[assembly: AssemblyFileVersion("1.0.0.0")]
1+


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)