Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify CI #641

Merged
merged 6 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 31 additions & 37 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,41 +26,41 @@ jobs:
validate_readme:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/checkout@v4
- name: Setup .NET Core (global.json)
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4
uses: actions/setup-dotnet@v4
- name: Validate Readme
run: .\eng\update-readme.ps1
- name: Validate Tool Readme
run: .\eng\update-tool-readme.ps1

validate_test_projects:
runs-on: windows-2022 # Use windows to evaluate TFMs in MSBuild
runs-on: windows-2022
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/checkout@v4
- name: Setup .NET Core (global.json)
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4
uses: actions/setup-dotnet@v4
- name: Validate
run: .\eng\validate-testprojects-configuration.ps1

create_nuget:
runs-on: windows-2022
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/checkout@v4
- name: Setup .NET Core (global.json)
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4
uses: actions/setup-dotnet@v4
- run: dotnet build eng/packages.proj --configuration Release /p:IsOfficialBuild=true /bl:build.binlog -warnaserror
- run: dotnet publish src/Meziantou.Framework.InlineSnapshotTesting.Prompt.TaskDialog --configuration Release /p:IsOfficialBuild=true /bl:publish-taskdialog.binlog
- run: dotnet publish src/Meziantou.Framework.InlineSnapshotTesting.Prompt.NotificationTray --configuration Release /p:IsOfficialBuild=true /bl:publish-notificationtray.binlog
- run: dotnet pack eng/packages.proj --configuration Release /p:IsOfficialBuild=true --output ${{ env.NuGetDirectory }} /p:RepositoryBranch="${{github.ref}}" /bl:pack.binlog
- uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4
- uses: actions/upload-artifact@v4
if: always()
with:
name: nuget
if-no-files-found: error
retention-days: 3
path: ${{ env.NuGetDirectory }}/**/*
- uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4
- uses: actions/upload-artifact@v4
if: always()
with:
name: binlog
Expand All @@ -69,13 +69,13 @@ jobs:
path: '**/*.binlog'

validate_nuget:
runs-on: windows-2022 # Use windows to evaluate TFMs in MSBuild
runs-on: ubuntu-22.04
needs: [ create_nuget ]
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/checkout@v4
- name: Setup .NET Core (global.json)
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
uses: actions/setup-dotnet@v4
- uses: actions/download-artifact@v4
with:
name: nuget
path: ${{ env.NuGetDirectory }}
Expand All @@ -91,7 +91,7 @@ jobs:
TestResultsDirectory: ${{ github.workspace}}/TestResults
strategy:
matrix:
runs-on: [ windows-2019, windows-2022, ubuntu-20.04, ubuntu-22.04, macos-12, macos-13, macos-14 ]
runs-on: [ windows-2022, ubuntu-22.04, macos-13, macos-14 ]
configuration: [ Debug, Release ]
additionalArguments: [ "", "/p:InvariantGlobalization=true" ]
architecture: [ x64 ]
Expand All @@ -102,23 +102,22 @@ jobs:
run: |
$Name = "test-results-${{ matrix.runs-on }}-${{ matrix.configuration }}-${{ matrix.architecture }}-${{matrix.additionalArguments}}".Replace(":", "_").Replace("/", "_")
"artifact-name=$Name" >> $env:GITHUB_OUTPUT
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/checkout@v4
- run: git config --global protocol.file.allow always
- name: Setup .NET Core (global.json)
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4
uses: actions/setup-dotnet@v4
- name: Setup .NET Core (additional versions)
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
7.0.x
6.0.x
- name: Build
run: dotnet build eng/build.proj --configuration ${{ matrix.configuration }} /bl ${{ matrix.additionalArguments }}

- name: Run tests
run: dotnet test eng/build.proj --configuration ${{ matrix.configuration }} --no-build --logger trx --results-directory "${{ env.TestResultsDirectory }}" --collect:"Code Coverage" --blame-hang --blame-hang-timeout 5min ${{ matrix.additionalArguments }}

- uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4
- uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ steps.compute-artifact-name.outputs.artifact-name }}
Expand All @@ -137,8 +136,6 @@ jobs:
configuration: [ Debug, Release ]
additionalArguments: [ "", "/p:InvariantGlobalization=true" ]
include:
- runs-on: windows-2019
architecture: x86
- runs-on: windows-2022
architecture: x86
fail-fast: false
Expand All @@ -148,7 +145,7 @@ jobs:
run: |
$Name = "test-results-${{ matrix.runs-on }}-${{ matrix.configuration }}-${{ matrix.architecture }}-${{matrix.additionalArguments}}".Replace(":", "_").Replace("/", "_")
"artifact-name=$Name" >> $env:GITHUB_OUTPUT
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/checkout@v4
- run: git config --global protocol.file.allow always
- name: Build and Run Tests
run: |
Expand All @@ -160,9 +157,6 @@ jobs:
echo "Installing .NET 6.0"
./dotnet-install.ps1 -Channel 6.0 -Architecture ${{ matrix.architecture }} -InstallDir ~/dotnet -NoPath
echo "Installing .NET 7.0"
./dotnet-install.ps1 -Channel 7.0 -Architecture ${{ matrix.architecture }} -InstallDir ~/dotnet -NoPath
echo "Installing .NET (global.json)"
./dotnet-install.ps1 -JSonFile ${{github.workspace}}/global.json -Architecture ${{ matrix.architecture }} -InstallDir ~/dotnet
Expand All @@ -183,7 +177,7 @@ jobs:
exit $LASTEXITCODE
}
echo "::endgroup::"
- uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4
- uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ steps.compute-artifact-name.outputs.artifact-name }}
Expand All @@ -200,9 +194,9 @@ jobs:
runtime: [ "win-x64", "win-x86", "linux-x64", "osx-x64" ]
fail-fast: false
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/checkout@v4
- name: Setup .NET Core (global.json)
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4
uses: actions/setup-dotnet@v4
- run: dotnet publish --configuration Release --runtime ${{ matrix.runtime }} --self-contained Samples/Trimmable/Trimmable.csproj

test_trimming_wpf:
Expand All @@ -213,30 +207,30 @@ jobs:
runtime: [ "win-x64", "win-x86" ]
fail-fast: false
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/checkout@v4
- name: Setup .NET Core (global.json)
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4
uses: actions/setup-dotnet@v4
- run: dotnet publish --configuration Release --runtime ${{ matrix.runtime }} --self-contained Samples/Trimmable.Wpf/Trimmable.Wpf.csproj

merge_coverage:
runs-on: ubuntu-22.04
needs: [build_and_test_x64, build_and_test_windows_x86]
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/checkout@v4
- name: Setup .NET Core (global.json)
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4
uses: actions/setup-dotnet@v4
- name: Install dotnet-coverage
run: dotnet tool update --global dotnet-coverage
- name: Download test results
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
uses: actions/download-artifact@v4
with:
pattern: test-results-*
path: test-results
- name: Merge coverage files (format coverage)
run: dotnet-coverage merge --output test-result.coverage --output-format coverage (Get-ChildItem test-results -Recurse -Filter "*.coverage")
- name: Merge coverage files (format cobertura)
run: dotnet-coverage merge --output test-result.cobertura.xml --output-format cobertura (Get-ChildItem test-results -Recurse -Filter "*.coverage")
- uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4
- uses: actions/upload-artifact@v4
with:
name: code-coverage
if-no-files-found: error
Expand All @@ -249,12 +243,12 @@ jobs:
runs-on: ubuntu-22.04
needs: [ validate_readme, validate_test_projects, validate_nuget, build_and_test_x64, build_and_test_windows_x86, test_trimming, test_trimming_wpf ]
steps:
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
- uses: actions/download-artifact@v4
with:
name: nuget
path: ${{ env.NuGetDirectory }}
- name: Setup .NET Core (global.json)
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4
uses: actions/setup-dotnet@v4
- run: |
Write-Host "Current ref: $env:GITHUB_REF"
Write-Host "Searching nupkg in folder: ${{ env.NuGetDirectory }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/close-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
issues: write
pull-requests: write
steps:
- uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9
- uses: actions/stale@v9
with:
days-before-issue-stale: 60
days-before-issue-close: 14
Expand Down
67 changes: 0 additions & 67 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/dependency-review.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@

<ItemGroup>
<None Include="Meziantou.Framework.FastEnumToStringGenerator.targets" Pack="true" PackagePath="build/" />
<None Include="$(OutputPath)\..\$(Configuration)_netstandard2.0\$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
<None Include="$(OutputPath)\..\..\Meziantou.Framework.FastEnumToStringGenerator.Annotations\$(Configuration)_netstandard2.0\*" Pack="true" PackagePath="lib/netstandard2.0" Visible="false" />
<None Include="$(OutputPath)\..\..\Meziantou.Framework.FastEnumToStringGenerator.Annotations\$(Configuration)_net6.0\*" Pack="true" PackagePath="lib/net6.0" Visible="false" />
<None Include="$(OutputPath)\..\..\Meziantou.Framework.FastEnumToStringGenerator.Annotations\$(Configuration)_net8.0\*" Pack="true" PackagePath="lib/net8.0" Visible="false" />
<None Include="$(OutputPath)\..\$(Configuration.ToLowerInvariant())_netstandard2.0\$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
<None Include="$(OutputPath)\..\..\Meziantou.Framework.FastEnumToStringGenerator.Annotations\$(Configuration.ToLowerInvariant())_netstandard2.0\*" Pack="true" PackagePath="lib/netstandard2.0" Visible="false" />
<None Include="$(OutputPath)\..\..\Meziantou.Framework.FastEnumToStringGenerator.Annotations\$(Configuration.ToLowerInvariant())_net6.0\*" Pack="true" PackagePath="lib/net6.0" Visible="false" />
<None Include="$(OutputPath)\..\..\Meziantou.Framework.FastEnumToStringGenerator.Annotations\$(Configuration.ToLowerInvariant())_net8.0\*" Pack="true" PackagePath="lib/net8.0" Visible="false" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup>
<None Include="$(OutputPath)\..\$(Configuration)_netstandard2.0\$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
<None Include="$(OutputPath)\..\$(Configuration.ToLowerInvariant())_netstandard2.0\$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
<None Include="build/**/*.props" Pack="true" PackagePath="build" />
<None Include="buildMultiTargeting/**/*.props" Pack="true" PackagePath="buildMultiTargeting" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@

<ItemGroup>
<None Include="Meziantou.Framework.StronglyTypedId.targets" Pack="true" PackagePath="build/" />
<None Include="$(OutputPath)\..\$(Configuration)_netstandard2.0\$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
<None Include="$(OutputPath)\..\..\Meziantou.Framework.StronglyTypedId.Annotations\$(Configuration)_netstandard2.0\*" Pack="true" PackagePath="lib/netstandard2.0" Visible="false" />
<None Include="$(OutputPath)\..\..\Meziantou.Framework.StronglyTypedId.Annotations\$(Configuration)_net6.0\*" Pack="true" PackagePath="lib/net6.0" Visible="false" />
<None Include="$(OutputPath)\..\..\Meziantou.Framework.StronglyTypedId.Annotations\$(Configuration)_net7.0\*" Pack="true" PackagePath="lib/net7.0" Visible="false" />
<None Include="$(OutputPath)\..\..\Meziantou.Framework.StronglyTypedId.Annotations\$(Configuration)_net8.0\*" Pack="true" PackagePath="lib/net8.0" Visible="false" />
<None Include="$(OutputPath)\..\$(Configuration.ToLowerInvariant())_netstandard2.0\$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
<None Include="$(OutputPath)\..\..\Meziantou.Framework.StronglyTypedId.Annotations\$(Configuration.ToLowerInvariant())_netstandard2.0\*" Pack="true" PackagePath="lib/netstandard2.0" Visible="false" />
<None Include="$(OutputPath)\..\..\Meziantou.Framework.StronglyTypedId.Annotations\$(Configuration.ToLowerInvariant())_net6.0\*" Pack="true" PackagePath="lib/net6.0" Visible="false" />
<None Include="$(OutputPath)\..\..\Meziantou.Framework.StronglyTypedId.Annotations\$(Configuration.ToLowerInvariant())_net8.0\*" Pack="true" PackagePath="lib/net8.0" Visible="false" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.6" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.20" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.31" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -727,8 +727,6 @@ static string GetTargetFramework()
return "net48";
#elif NET6_0
return "net6.0";
#elif NET7_0
return "net7.0";
#elif NET8_0
return "net8.0";
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,6 @@ static string GetTargetFramework()
return "net48";
#elif NET6_0
return "net6.0";
#elif NET7_0
return "net7.0";
#elif NET8_0
return "net8.0";
#endif
Expand Down