-
-
Notifications
You must be signed in to change notification settings - Fork 230
ci: move from dotnet-format tool to .NET SDK command #4918
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
Changes from all commits
e75aaf4
00e8d96
77ec5e3
bbcefcb
bba983f
70e6e5c
5ea105f
8684a66
b6c906c
c58e0c9
9e2a73e
564e66f
e0e52f8
bd6cf08
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,17 +28,28 @@ jobs: | |
| dotnet workload restore | ||
| dotnet restore Sentry.slnx --nologo | ||
|
|
||
| - name: Install dotnet format | ||
| run: dotnet tool install -g dotnet-format | ||
|
|
||
| - name: Format Code | ||
| # We exclude `./**/*OptionsSetup.cs` from the format because the tool struggles with | ||
| # source generators. | ||
| # | ||
| # We exclude `test/Sentry.Tests/AttributeReaderTests.cs` because dotnet-format tries to | ||
| # delete assertions in there. | ||
| # - see https://github.com/getsentry/sentry-dotnet/pull/4911#discussion_r2795717887 | ||
| run: dotnet format Sentry.slnx --no-restore --exclude ./modules --exclude ./**/*OptionsSetup.cs --exclude ./test/Sentry.Tests/AttributeReaderTests.cs | ||
| run: dotnet format Sentry.slnx --no-restore --report ./dotnet-format-report --exclude ./modules ./**/*OptionsSetup.cs ./test/Sentry.Tests/AttributeReaderTests.cs | ||
|
|
||
| - name: Upload Format Report | ||
| if: ${{ always() }} | ||
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | ||
| with: | ||
| archive: false | ||
| path: ./dotnet-format-report/ | ||
| if-no-files-found: ignore | ||
|
|
||
|
Comment on lines
+40
to
+47
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: see e.g. https://github.com/getsentry/sentry-dotnet/actions/runs/22679547094?pr=4918 I do like the unzipped upload for single files, so that in this case I can view the |
||
| - name: Exclude Format Report from Git | ||
| run: | | ||
| if [ -d ./dotnet-format-report ]; then | ||
| echo '*' > ./dotnet-format-report/.gitignore | ||
| fi | ||
|
|
||
|
Comment on lines
+48
to
53
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: so that the |
||
| # actions/checkout fetches only a single commit in a detached HEAD state. Therefore | ||
| # we need to pass the current branch, otherwise we can't commit the changes. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upload failure blocks formatted code commit step
Medium Severity
The
Upload Format Reportstep usesif: always()but lackscontinue-on-error: true. If this step fails (e.g., network issue, orarchive: falserejecting multiple files from the report directory), the GitHub Actionssuccess()check becomes false, preventing bothExclude Format Report from GitandCommit Formatted Codefrom running. This silently discards any formatting changes thatdotnet formatapplied. Addingcontinue-on-error: trueto the upload step would prevent an informational artifact upload from blocking the core commit functionality.Additional Locations (1)
.github/workflows/format-code.yml#L47-L52There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my intention was that CI should fail if anything goes unexpected ... starting out more aggressive ... we can always loosen strictness later