Skip to content

Commit

Permalink
Merge branch 'feature/improve-ci-script' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
DamienBraillard committed Jul 9, 2024
2 parents 56ac453 + 3ea7911 commit f7990d5
Show file tree
Hide file tree
Showing 19 changed files with 1,507 additions and 45 deletions.
13 changes: 13 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-validate": {
"version": "0.0.1-preview.304",
"commands": [
"dotnet-validate"
],
"rollForward": false
}
}
}
82 changes: 50 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,45 +8,63 @@ name: Continuous Integration

on:
push:
branches: [ '**' ]
branches:
- 'master'
- 'develop'
- 'feature*/**'
pull_request:
branches: [ 'master' ]
branches:
- '**'

env:
Configuration: Release
ContinuousIntegrationBuild: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_NOLOGO: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: true

permissions:
checks: write # Required for writing test reports

jobs:
build:
name: 🛠️ Build and test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.x
8.x
- name: Show dotnet details
run: dotnet --info

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --configuration release --no-restore

- name: Test
run: dotnet test --configuration release --no-build --logger "trx;logFileName=test-results.trx"
continue-on-error: true # Allows the test report to be generated even if the tests fail

- name: Generate test report
uses: dorny/test-reporter@v1
if: always()
with:
name: Test results
path: "**/test-results.trx"
reporter: dotnet-trx
fail-on-error: true
- name: 👨‍💻 Check-out code
uses: actions/checkout@v4

- name: 👨‍🔧 Setup .NET Core SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.x
7.x
8.x
- name: ℹ️ Show dotnet details
run: dotnet --info

- name: 💾 Enable package caching
uses: actions/cache@v4
with:
path: ~/.nuget/packages
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: 📥 Restore packages
run: dotnet restore

- name: 🏗️ Build code
run: dotnet build --no-restore

- name: 😨 Test code
run: dotnet test --no-build
continue-on-error: true

- name: 📦 Create NuGet package
run: dotnet pack --no-build --output .
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
# Temporary files
~$*

# Test results log files
*.trx
# Test results files
tests/results/

# Compiled output
bin/
obj/
obj/
*.nupkg
Empty file added CHANGELOG.md
Empty file.
20 changes: 13 additions & 7 deletions Unicorn.LiveLogViewer.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,23 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{AF56B55A
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unicorn.LiveLogViewer", "src\Unicorn.LiveLogViewer\Unicorn.LiveLogViewer.csproj", "{236E82DF-D44C-47CA-8D89-7F3F45C28ED2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unicorn.LiveLogViewer.Sample", "src\Unicorn.LiveLogViewer.Sample\Unicorn.LiveLogViewer.Sample.csproj", "{D9DD294A-5CC5-49BA-A388-7995F8EF10DB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unicorn.LiveLogViewer.Tests", "tests\Unicorn.LiveLogViewer.Tests\Unicorn.LiveLogViewer.Tests.csproj", "{8426E6B1-4735-4790-896B-FC9FFFE80C6E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "meta", "meta", "{A2DF48CE-7A0B-4A0C-A1AC-4EABC9183C12}"
ProjectSection(SolutionItems) = preProject
README.md = README.md
.gitignore = .gitignore
.github\workflows\ci.yml = .github\workflows\ci.yml
tools\Custom.Tasks.targets = tools\Custom.Tasks.targets
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{92AC1673-FD1E-47F4-9550-84855CB1DE39}"
ProjectSection(SolutionItems) = preProject
samples\Directory.Build.props = samples\Directory.Build.props
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unicorn.LiveLogViewer.Sample", "samples\Unicorn.LiveLogViewer.Sample\Unicorn.LiveLogViewer.Sample.csproj", "{CB9ADEEF-4043-46C1-BE2F-99708FC8D10E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -33,18 +39,18 @@ Global
{236E82DF-D44C-47CA-8D89-7F3F45C28ED2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{236E82DF-D44C-47CA-8D89-7F3F45C28ED2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{236E82DF-D44C-47CA-8D89-7F3F45C28ED2}.Release|Any CPU.Build.0 = Release|Any CPU
{D9DD294A-5CC5-49BA-A388-7995F8EF10DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D9DD294A-5CC5-49BA-A388-7995F8EF10DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D9DD294A-5CC5-49BA-A388-7995F8EF10DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D9DD294A-5CC5-49BA-A388-7995F8EF10DB}.Release|Any CPU.Build.0 = Release|Any CPU
{8426E6B1-4735-4790-896B-FC9FFFE80C6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8426E6B1-4735-4790-896B-FC9FFFE80C6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8426E6B1-4735-4790-896B-FC9FFFE80C6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8426E6B1-4735-4790-896B-FC9FFFE80C6E}.Release|Any CPU.Build.0 = Release|Any CPU
{CB9ADEEF-4043-46C1-BE2F-99708FC8D10E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CB9ADEEF-4043-46C1-BE2F-99708FC8D10E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CB9ADEEF-4043-46C1-BE2F-99708FC8D10E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CB9ADEEF-4043-46C1-BE2F-99708FC8D10E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{236E82DF-D44C-47CA-8D89-7F3F45C28ED2} = {48C03E93-EFDC-4336-8AFE-9288C446B2BE}
{D9DD294A-5CC5-49BA-A388-7995F8EF10DB} = {48C03E93-EFDC-4336-8AFE-9288C446B2BE}
{8426E6B1-4735-4790-896B-FC9FFFE80C6E} = {AF56B55A-3F4C-4CD8-A2AA-4409DF5D61B8}
{CB9ADEEF-4043-46C1-BE2F-99708FC8D10E} = {92AC1673-FD1E-47F4-9550-84855CB1DE39}
EndGlobalSection
EndGlobal
8 changes: 8 additions & 0 deletions samples/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project>
<PropertyGroup>
<!-- Samples are not part of the NuGet package -->
<IsPackable>false</IsPackable>
<!-- Disables warnings about non-packable projects that could be packaged -->
<WarnOnPackingNonPackableProject>false</WarnOnPackingNonPackableProject>
</PropertyGroup>
</Project>
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<DebugType>embedded</DebugType>
</PropertyGroup>

<PropertyGroup Label="AOT" >
Expand All @@ -11,7 +15,7 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Unicorn.LiveLogViewer\Unicorn.LiveLogViewer.csproj" />
<ProjectReference Include="..\..\src\Unicorn.LiveLogViewer\Unicorn.LiveLogViewer.csproj" />
</ItemGroup>

</Project>
15 changes: 15 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
<!-- Use embedded pdb to make sure we have file information and line numbers in stack traces even when
packaging as single file. See https://github.com/dotnet/runtime/issues/34187#issuecomment-604955845 -->
<DebugType>embedded</DebugType>

<!-- Embed all sources in the NuGet packages -->
<EmbedAllSources>true</EmbedAllSources>
</PropertyGroup>

<PropertyGroup Label="Assembly Info">
Expand All @@ -25,6 +28,12 @@
<WarningsNotAsErrors>CS1030, CS0618</WarningsNotAsErrors>
</PropertyGroup>

<PropertyGroup Label="Restoring">
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<!-- https://devblogs.microsoft.com/nuget/enable-repeatable-package-restores-using-a-lock-file/#how-does-nuget-use-the-lock-file -->
<RestoreLockedMode Condition="$(ContinuousIntegrationBuild) == 'true'">true</RestoreLockedMode>
</PropertyGroup>

<Target Name="EmbedDocumentation" BeforeTargets="PrepareForBuild">
<ItemGroup>
<EmbeddedResource Include="@(DocFileItem)">
Expand Down Expand Up @@ -60,4 +69,10 @@
<InternalsVisibleTo Include="DynamicProxyGenAssembly2" />
</ItemGroup>

<Target Name="ValidateNuGetPackage" AfterTargets="Pack">
<!-- For reference: the file `.config/dotnet-tools.json` was created by running `dotnet new tool-manifest && dotnet tool install dotnet-validate` -->
<Exec Command="dotnet tool restore" />
<Exec Command="dotnet validate package local $([MSBuild]::EnsureTrailingSlash($(PackageOutputPath)))$(PackageId).$(PackageVersion).nupkg" EnvironmentVariables="DOTNET_ROLL_FORWARD=LatestMajor" />
</Target>

</Project>
15 changes: 15 additions & 0 deletions src/Unicorn.LiveLogViewer/Unicorn.LiveLogViewer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,21 @@
<EnableRequestDelegateGenerator>true</EnableRequestDelegateGenerator>
</PropertyGroup>

<PropertyGroup Label="Packaging Metadata">
<!-- <PackageIcon>icon.png</PackageIcon>-->
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageTags>logging logviewer aspnet</PackageTags>
<PackageProjectUrl>https://github.com/DamienBraillard/Unicorn.LiveLogViewer</PackageProjectUrl>
<PackageReleaseNotes>https://github.com/DamienBraillard/Unicorn.LiveLogViewer/blob/master/CHANGELOG.md</PackageReleaseNotes>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
</PropertyGroup>

<ItemGroup Label="Packaging Metadata">
<!-- <None Include="../resources/$(PackageIcon)" Pack="true" PackagePath="" Visible="false" />-->
<None Include="../../$(PackageReadmeFile)" Pack="true" PackagePath="" />
</ItemGroup>

<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
Expand Down
51 changes: 51 additions & 0 deletions src/Unicorn.LiveLogViewer/packages.lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"version": 1,
"dependencies": {
"net6.0": {
"Microsoft.Build.Tasks.Git": {
"type": "Direct",
"requested": "[8.0.0, )",
"resolved": "8.0.0",
"contentHash": "bZKfSIKJRXLTuSzLudMFte/8CempWjVamNUR5eHJizsy+iuOuO/k2gnh7W0dHJmYY0tBf+gUErfluCv5mySAOQ=="
},
"Microsoft.NET.ILLink.Analyzers": {
"type": "Direct",
"requested": "[7.0.100-1.23401.1, )",
"resolved": "7.0.100-1.23401.1",
"contentHash": "XirkjOLc5Vc3HsXRc2Z6ZbQv6l0RvWgJa/31w7XqZ914MoSi3H3OCNRMWFw7H2EYfsnKbokFfhCcysAmUcEOgw=="
},
"Microsoft.NET.ILLink.Tasks": {
"type": "Direct",
"requested": "[7.0.100-1.23401.1, )",
"resolved": "7.0.100-1.23401.1",
"contentHash": "mI6vCdPEhluLtMn/GV0texEWg5oAPQWCCE4LWspM+Bmy75Nd4EQsziQXrdOFqNeSBQMrxDX9C/O5Xi3kpKSMIw=="
},
"TestableIO.System.IO.Abstractions.Analyzers": {
"type": "Direct",
"requested": "[2022.0.0, )",
"resolved": "2022.0.0",
"contentHash": "rVk7HyTWXC1IOHTLMOzZyX6Wu1qbwVoA17XGF837uUElDnfg4emPxewPpGSgtuJzuJeoH4SGeQtDoB8v9J1d9Q=="
}
},
"net8.0": {
"Microsoft.Build.Tasks.Git": {
"type": "Direct",
"requested": "[8.0.0, )",
"resolved": "8.0.0",
"contentHash": "bZKfSIKJRXLTuSzLudMFte/8CempWjVamNUR5eHJizsy+iuOuO/k2gnh7W0dHJmYY0tBf+gUErfluCv5mySAOQ=="
},
"Microsoft.NET.ILLink.Tasks": {
"type": "Direct",
"requested": "[8.0.6, )",
"resolved": "8.0.6",
"contentHash": "E+lDylsTeP4ZiDmnEkiJ5wobnGaIJzFhOgZppznJCb69UZgbh6G3cfv1pnLDLLBx6JAgl0kAlnINDeT3uCuczQ=="
},
"TestableIO.System.IO.Abstractions.Analyzers": {
"type": "Direct",
"requested": "[2022.0.0, )",
"resolved": "2022.0.0",
"contentHash": "rVk7HyTWXC1IOHTLMOzZyX6Wu1qbwVoA17XGF837uUElDnfg4emPxewPpGSgtuJzuJeoH4SGeQtDoB8v9J1d9Q=="
}
}
}
}
Loading

0 comments on commit f7990d5

Please sign in to comment.