Skip to content

Fix .NET SDK mismatches in actions#147

Merged
jamie-taylor-rjj merged 3 commits intomainfrom
bugfix/actions-dotnet-setup
Dec 11, 2024
Merged

Fix .NET SDK mismatches in actions#147
jamie-taylor-rjj merged 3 commits intomainfrom
bugfix/actions-dotnet-setup

Conversation

@jamie-taylor-rjj
Copy link
Copy Markdown
Collaborator

@jamie-taylor-rjj jamie-taylor-rjj commented Dec 11, 2024

Rationale for this PR

This project builds for both .NET 8 and .NET 9 (at the time of PR creation), however some GitHub actions where only making use of .NET 9. The SDKs should be backward compatible, but it has been seen (across multiple different actions) that this is not the case. An example is a recent (at the time of PR creation) run of the CodeQL analysis task which fails for the following error (which has been cleaned up for convenience):

error : You must install or update .NET to run this application. 
error : Architecture: x64 
error : Framework: 'Microsoft.AspNetCore.App', version '8.0.0' (x64) 
error : The following frameworks were found: 
error : 9.0.0 at [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] 

The relevant lines of which are:

  • You must install or update .NET to run this application. (first line of above)
  • error : The following frameworks were found: 9.0.0 at [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] (the final few lines, combined for convenience)

The fix included in this PR is to explicitly install the relevant .NET SDKs (at the time of PR creation, both .NET 8 and 9) in each action where it is required.

Note

This might be a temporary problem (see: actions/runner-images#10973 (comment)), but it's also better to be explicit about the dependencies used. So these changes (assuming they work, and Github actions can only be tested ON GitHub) will likely stay in place, being updated when new SDKs are required or runtimes are supported by the project.

PR Checklist

Feel free to either check the following items (by place an x inside of the square brackets) or by replacing the square brackets with a relevant emoji from the following list:

  • ✅ to indicate that you have checked something off
  • ❎ to indicate that you haven't checked something off
  • ❓ to indicate that something might not be relevant (writing tests for documentation changes, for instance)

Essential

These items are essential and must be completed for each commit. If they are not completed, the PR may not be accepted.

  • [❓] I have added tests to the OwaspHeaders.Core.Tests project
  • [✅] I have run the dotnet-format command and fixed any .editorconfig issues
  • [✅] I have ensured that the code coverage has not dropped below 65%
  • [✅] I have increased the version number in OwaspHeaders.Core.csproj (only relevant for code changes)

Optional

  • [❓] I have documented the new feature in the docs directory
  • [❓] I have provided a code sample, showing how someone could use the new code

Any Other Information

This section is optional, but it might be useful to list any other information you think is relevant.

@github-actions
Copy link
Copy Markdown
Contributor

Code Coverage

Package Line Rate Branch Rate Complexity Health
OwaspHeaders.Core 87% 73% 276
OwaspHeaders.Core 87% 73% 276
Summary 87% (1106 / 1276) 73% (264 / 360) 552

@jamie-taylor-rjj jamie-taylor-rjj merged commit 101514c into main Dec 11, 2024
@jamie-taylor-rjj jamie-taylor-rjj deleted the bugfix/actions-dotnet-setup branch December 11, 2024 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants