Граф коммитов

9 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 4046acc3d0
[autoformat] Extract some logic into its own script file. (#16200)
We have some problems when autoformatting PRs and the PR branch isn't fully
up-to-date with regards to the target branch.

I believe this is what happens:

1. When a PR is created (or modified), GitHub Actions will merge the PR branch
   with the target branch, and parse/load the merged *.yml files.
2. Then when we run the autoformatter, we're working on the tip of the PR
   branch (and not the merged result).
3. This means that we were using the list of projects to autoformat from the
   merged branch, but exeuting on the PR branch. This resulted in spurious
   autoformatting, because the autoformatted would autoformat more code than
   expected.

The fix I'm implementing is to move the list of projects to autoformat to a
separate script in source code. That way we'll work upon the list of projects
as they show up in the PR branch, and not the merged results.
2022-10-03 22:18:28 +02:00
Rolf Bjarne Kvinge 9d0687191d
[autoformat] Add dotnet-linker to the projects to autoformat. (#16178) 2022-09-30 09:32:42 +02:00
Rolf Bjarne Kvinge 9e0fecc4ff
Autoformat msbuild projects. (#16132)
All other changes should be blank space only: https://github.com/xamarin/xamarin-macios/pull/16132/files?w=1

Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
2022-09-28 16:25:35 +02:00
Rolf Bjarne Kvinge deb0faa4f2
Autoformat cecil-tests.csproj. (#16103)
All other changes should be blank space only.

Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
2022-09-26 21:00:28 +02:00
Rolf Bjarne Kvinge 1611d6c382
[autoformat] Enable by default. (#16077)
Autoformatting can from now on be disabled by adding the `actions-disable-autoformat` label.
2022-09-23 13:51:01 +02:00
Rolf Bjarne Kvinge 45ccf885a1
[actions] Autoformat xibuild.csproj (#16059)
Also fix a merge conflict that made autoformatting not work, and make sure to not add any temporary files to the diff.

Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
2022-09-22 13:07:01 +02:00
Rolf Bjarne Kvinge 62fe97da11
[actions] Second try at autoformatting code (#16014)
It turns out that part of the logic has to exist in `main`, it won't
execute from a pull request.

This means it might take a while to get the logic right... so I made it
work in a personal repo first. This is the resulting code, hopefully it
works here too (but there's no way to know for sure before merging the
PR 😞
2022-09-21 20:30:48 +02:00
dependabot[bot] ee1324ebd6
Bump actions/upload-artifact from 2 to 3 (#16020)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2 to 3.

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-21 14:25:00 +02:00
Rolf Bjarne Kvinge 7908a319e6
[actions] Add GitHub action to automatically format code. (#15935)
Implement a GitHub action to automatically format our source code.

This is implemented in two steps:

1. A restricted action is used to check if the code has any formatting issues, and if so, creates a patch to fix the code.
2. Another action is used to commit and push the patch (and add a comment to the PR notifying the submitter about the problems found).

This is because the first action will call 'dotnet format', which might be insecure in that it can execute code from the repository. This is not safe in a context that is allowed to push commits (because there are secrets in the environment) - so anyone could create a PR that would be executed as a part of 'dotnet format' and then look for our secrets and make them public. The restricted action's environment does not have any secrets, and it's thus safe to execute random code.

The second action will only execute if the corresponding file is in main, so this PR need to be merged before this can be fully implemented, and as such I've made the autoformatting opt-in (by adding the `actions-enable-autoformat` label). Once everything is confirmed to work properly, it will become opt-out instead.

Also, for now only a very simple project is autoformatted (xibuild.csproj), but the
idea is to fix source code incrementally, and add to the list of projects/code
we autoformat.
2022-09-19 11:48:10 +02:00