From 89118639f2e7301670f46aad1526ce9aed5e269e Mon Sep 17 00:00:00 2001 From: Yuta Matsumura Date: Sun, 23 Jul 2023 15:19:28 +0900 Subject: [PATCH 1/2] add net8.0 console app (nogood indent) --- dotnet/dotnet.sln | 48 ++++++++++++++++++++++ dotnet/net8.0/consoleapp/Class1.cs | 13 ++++++ dotnet/net8.0/consoleapp/Program.cs | 6 +++ dotnet/net8.0/consoleapp/consoleapp.csproj | 10 +++++ 4 files changed, 77 insertions(+) create mode 100644 dotnet/dotnet.sln create mode 100644 dotnet/net8.0/consoleapp/Class1.cs create mode 100644 dotnet/net8.0/consoleapp/Program.cs create mode 100644 dotnet/net8.0/consoleapp/consoleapp.csproj diff --git a/dotnet/dotnet.sln b/dotnet/dotnet.sln new file mode 100644 index 0000000..c4b9ccc --- /dev/null +++ b/dotnet/dotnet.sln @@ -0,0 +1,48 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.002.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "net6.0", "net6.0", "{96F8E184-0AD2-4CC8-8B56-FC064C73E115}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "razorpageapp", "net6.0\razorpageapp\razorpageapp.csproj", "{C50F6517-AE24-4054-AA10-F95F304923DC}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "net7.0", "net7.0", "{C6100442-FD97-4ABB-87CD-451375F8E9F2}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "razorpageapp", "net7.0\razorpageapp\razorpageapp.csproj", "{1D2C0B5D-FCFD-4872-B38D-1661C8455F62}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "net8.0", "net8.0", "{82204ABB-A7FD-4904-BAFE-65834AFFFA3E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "consoleapp", "net8.0\consoleapp\consoleapp.csproj", "{73EC3307-ECBB-4F89-9307-FA59F73C454A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C50F6517-AE24-4054-AA10-F95F304923DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C50F6517-AE24-4054-AA10-F95F304923DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C50F6517-AE24-4054-AA10-F95F304923DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C50F6517-AE24-4054-AA10-F95F304923DC}.Release|Any CPU.Build.0 = Release|Any CPU + {1D2C0B5D-FCFD-4872-B38D-1661C8455F62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1D2C0B5D-FCFD-4872-B38D-1661C8455F62}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1D2C0B5D-FCFD-4872-B38D-1661C8455F62}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1D2C0B5D-FCFD-4872-B38D-1661C8455F62}.Release|Any CPU.Build.0 = Release|Any CPU + {73EC3307-ECBB-4F89-9307-FA59F73C454A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {73EC3307-ECBB-4F89-9307-FA59F73C454A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {73EC3307-ECBB-4F89-9307-FA59F73C454A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {73EC3307-ECBB-4F89-9307-FA59F73C454A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {C50F6517-AE24-4054-AA10-F95F304923DC} = {96F8E184-0AD2-4CC8-8B56-FC064C73E115} + {1D2C0B5D-FCFD-4872-B38D-1661C8455F62} = {C6100442-FD97-4ABB-87CD-451375F8E9F2} + {73EC3307-ECBB-4F89-9307-FA59F73C454A} = {82204ABB-A7FD-4904-BAFE-65834AFFFA3E} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {8058C698-71A0-4FDF-AB5F-EDA80872CE2F} + EndGlobalSection +EndGlobal diff --git a/dotnet/net8.0/consoleapp/Class1.cs b/dotnet/net8.0/consoleapp/Class1.cs new file mode 100644 index 0000000..1ef4b1a --- /dev/null +++ b/dotnet/net8.0/consoleapp/Class1.cs @@ -0,0 +1,13 @@ + namespace consoleapp; + +internal class Class1 + { + private string field1 = "hoge"; + + public string Property1 + => field1 ; + + public string Greet () { + return $"Hello, World { Property1 }!" ; // comment + } + } diff --git a/dotnet/net8.0/consoleapp/Program.cs b/dotnet/net8.0/consoleapp/Program.cs new file mode 100644 index 0000000..55b1765 --- /dev/null +++ b/dotnet/net8.0/consoleapp/Program.cs @@ -0,0 +1,6 @@ + // See https://aka.ms/new-console-template for more information + using consoleapp; + +var class1 = + new Class1 ( ) ; +Console .WriteLine( class1.Greet() ); diff --git a/dotnet/net8.0/consoleapp/consoleapp.csproj b/dotnet/net8.0/consoleapp/consoleapp.csproj new file mode 100644 index 0000000..2150e37 --- /dev/null +++ b/dotnet/net8.0/consoleapp/consoleapp.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + From cb52ec32c4a72cd11665d2ad10ee68847dfcc309 Mon Sep 17 00:00:00 2001 From: Yuta Matsumura Date: Sun, 23 Jul 2023 15:35:47 +0900 Subject: [PATCH 2/2] add dotnet format workflow --- .github/workflows/net80-dotnet-format.yml | 60 +++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/net80-dotnet-format.yml diff --git a/.github/workflows/net80-dotnet-format.yml b/.github/workflows/net80-dotnet-format.yml new file mode 100644 index 0000000..6ccf3a5 --- /dev/null +++ b/.github/workflows/net80-dotnet-format.yml @@ -0,0 +1,60 @@ +name: .NET 8.0 dotnet-format + +on: + push: + branches: + - main + paths: + - 'dotnet/net8.0/**' + workflow_dispatch: + +env: + DOTNET_VERSION: '8.0.x' + DOTNET_PREVIEW_VERSION: true + DOTNET_FORMAT_VERBOSITY: diag + SOURCE_CODE_PATH: 'consoleapp/consoleapp.csproj' + BRANCH: dotnet-format-${{ github.run_id }} + +permissions: + contents: write + pull-requests: write + +jobs: + run-dotnet-format: + runs-on: ubuntu-latest + defaults: + run: + working-directory: 'dotnet/net8.0' + steps: + - uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + include-prerelease: ${{ env.DOTNET_PREVIEW_VERSION }} + - name: Format on branch + run: | + dotnet format $SOURCE_CODE_PATH --no-restore --verbosity $DOTNET_FORMAT_VERBOSITY + git checkout -b $BRANCH + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com + git add . + git commit -m "[bot] Auto formatted" + git push --set-upstream origin $BRANCH + git checkout main + echo "branch-name: $BRANCH" + echo "branch-name=$BRANCH" >> $GITHUB_OUTPUT + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + call-pull-request-workflow: + name: Call pull request workflow + needs: run-dotnet-format + uses: ./.github/workflows/github-pull-request-creation.yml + with: + branch-name: ${{ needs.run-dotnet-format.outputs.branch-name }} + show-pull-request-url: + name: Show pull request url + needs: call-pull-request-workflow + runs-on: ubuntu-latest + steps: + - run: echo ${{ needs.call-pull-request-workflow.outputs.pull-request-url }}