From 6c8c49e80b81890f41529de42024b4efb49b4e87 Mon Sep 17 00:00:00 2001 From: InCerry Date: Fri, 23 Feb 2024 21:35:31 +0800 Subject: [PATCH 1/7] add git action --- .github/ISSUE_TEMPLATE.md | 25 ++++++++++++ .github/workflows/build.yml | 35 +++++++++++++++++ .github/workflows/buildandtest.yml | 43 +++++++++++++++++++++ .github/workflows/release_stable.yml | 52 +++++++++++++++++++++++++ .github/workflows/release_unstable.yml | 53 ++++++++++++++++++++++++++ 5 files changed, 208 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/buildandtest.yml create mode 100644 .github/workflows/release_stable.yml create mode 100644 .github/workflows/release_unstable.yml diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..f6079cb --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,25 @@ +## Description + +[Description of the bug or feature] + +### Steps to Reproduce + +1. +2. + +### Related code + +``` +insert short code snippets here +``` + +**Expected behavior:** [What you expected to happen] + +**Actual behavior:** [What actually happened] + + + +## Specifications + +- .NET Version : 6.0.0 +- System : CentOS 7.2 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..f13fc40 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,35 @@ +name: Build + +on: + push: + branches: [ dev, main, master, '**' ] + pull_request: + branches: [ dev, main, master ] + +jobs: + + windows: + name: build on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ windows-latest ] + + steps: + - uses: actions/checkout@v2 + - name: Setup .NET SDK + uses: actions/setup-dotnet@v3 + with: + dotnet-version: | + 7.0.x + 6.0.x + 8.0.x + + - name: Show dotnet Version + run: | + dotnet --list-sdks + dotnet --list-runtimes + + - name: Build with dotnet + run: | + dotnet build --configuration Release D:\a\DisposeScope\DisposeScope\DisposeScope.sln \ No newline at end of file diff --git a/.github/workflows/buildandtest.yml b/.github/workflows/buildandtest.yml new file mode 100644 index 0000000..82a7251 --- /dev/null +++ b/.github/workflows/buildandtest.yml @@ -0,0 +1,43 @@ +name: Build&Test + +on: + push: + branches: [ dev, main, master, '**' ] + pull_request: + branches: [ dev, main, master ] + +jobs: + + linux: + name: build and test on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-latest ] + + steps: + - uses: actions/checkout@v2 + - name: Setup .NET SDK + uses: actions/setup-dotnet@v3 + with: + dotnet-version: | + 6.0.x + 7.0.x + 8.0.x + + - name: Show dotnet Version + run: | + dotnet --list-sdks + dotnet --list-runtimes + + - name: Show docker info + run: | + docker ps -a + + - name: Build with dotnet + run: | + dotnet build --configuration Release /home/runner/work/DisposeScope/DisposeScope/DisposeScope.sln + + - name: Run tests on net8.0 + run: | + dotnet test --framework=net8.0 /home/runner/work/DisposeScope/DisposeScope/tests/Dispose.Scope.Tests.csproj diff --git a/.github/workflows/release_stable.yml b/.github/workflows/release_stable.yml new file mode 100644 index 0000000..70786be --- /dev/null +++ b/.github/workflows/release_stable.yml @@ -0,0 +1,52 @@ +name: Release_Stable + +on: + push: + tags: + - "*.*.*-beta*" + - "*.*.*-rc*" + +jobs: + build_artifact: + name: Build and upload artifact + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: Setup .NET SDK + uses: actions/setup-dotnet@v3 + with: + dotnet-version: | + 6.0.x + 7.0.x + 8.0.x + - name: Build with dotnet + run: dotnet build --configuration Release /home/runner/work/DisposeScope/DisposeScope/DisposeScope.sln + - name: Pack with dotnet + env: + VERSION: ${{ github.ref_name }} + run: dotnet pack /home/runner/work/DisposeScope/DisposeScope/DisposeScope.sln --version-suffix $VERSION -o /home/runner/work/nugetpkgs -c Release --no-build + - name: Upload artifact + uses: actions/upload-artifact@v1 + with: + name: nugetpkgs + path: /home/runner/work/nugetpkgs + + release_nuget: + name: Release to Nuget + needs: build_artifact + runs-on: ubuntu-latest + + steps: + - name: Download build artifacts + uses: actions/download-artifact@v1 + with: + name: nugetpkgs + - name: list nugetpkgs + run: ls nugetpkgs + - name: Release + run: | + for file in nugetpkgs/*.nupkg + do + dotnet nuget push $file -k ${{ secrets.NUGET_API_KEY }} --skip-duplicate -s https://www.nuget.org/api/v2/package + done diff --git a/.github/workflows/release_unstable.yml b/.github/workflows/release_unstable.yml new file mode 100644 index 0000000..97e6281 --- /dev/null +++ b/.github/workflows/release_unstable.yml @@ -0,0 +1,53 @@ +name: Release_Unstable + +on: + push: + tags: + - "*.*.*" + - "!*.*.*-beta*" + - "!*.*.*-rc*" + +jobs: + build_artifact: + name: Build and upload artifact + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: Setup .NET SDK + uses: actions/setup-dotnet@v3 + with: + dotnet-version: | + 6.0.x + 7.0.x + 8.0.x + - name: Build with dotnet + run: dotnet build --configuration Release /home/runner/work/DisposeScope/DisposeScope/DisposeScope.sln + - name: Pack with dotnet + env: + VERSION: ${{ github.ref_name }} + run: dotnet pack /home/runner/work/DisposeScope/DisposeScope/DisposeScope.sln --version-suffix $VERSION -o /home/runner/work/nugetpkgs -c Release --no-build + - name: Upload artifact + uses: actions/upload-artifact@v1 + with: + name: nugetpkgs + path: /home/runner/work/nugetpkgs + + release_nuget: + name: Release to Nuget + needs: build_artifact + runs-on: ubuntu-latest + + steps: + - name: Download build artifacts + uses: actions/download-artifact@v1 + with: + name: nugetpkgs + - name: list nugetpkgs + run: ls nugetpkgs + - name: Release + run: | + for file in nugetpkgs/*.nupkg + do + dotnet nuget push $file -k ${{ secrets.NUGET_API_KEY }} --skip-duplicate -s https://www.nuget.org/api/v2/package + done \ No newline at end of file From b319fe5ee2aa02c381068df62033202f770e1c48 Mon Sep 17 00:00:00 2001 From: InCerry Date: Fri, 23 Feb 2024 21:39:03 +0800 Subject: [PATCH 2/7] fix directory name --- .github/workflows/build.yml | 2 +- .github/workflows/buildandtest.yml | 4 ++-- .github/workflows/release_stable.yml | 4 ++-- .github/workflows/release_unstable.yml | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f13fc40..13340be 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,4 +32,4 @@ jobs: - name: Build with dotnet run: | - dotnet build --configuration Release D:\a\DisposeScope\DisposeScope\DisposeScope.sln \ No newline at end of file + dotnet build --configuration Release D:\a\Dispose.Scope\Dispose.Scope\DisposeScope.sln \ No newline at end of file diff --git a/.github/workflows/buildandtest.yml b/.github/workflows/buildandtest.yml index 82a7251..4b161a3 100644 --- a/.github/workflows/buildandtest.yml +++ b/.github/workflows/buildandtest.yml @@ -36,8 +36,8 @@ jobs: - name: Build with dotnet run: | - dotnet build --configuration Release /home/runner/work/DisposeScope/DisposeScope/DisposeScope.sln + dotnet build --configuration Release /home/runner/work/Dispose.Scope/Dispose.Scope/DisposeScope.sln - name: Run tests on net8.0 run: | - dotnet test --framework=net8.0 /home/runner/work/DisposeScope/DisposeScope/tests/Dispose.Scope.Tests.csproj + dotnet test --framework=net8.0 /home/runner/work/Dispose.Scope/Dispose.Scope/tests/Dispose.Scope.Tests.csproj diff --git a/.github/workflows/release_stable.yml b/.github/workflows/release_stable.yml index 70786be..51f2aa6 100644 --- a/.github/workflows/release_stable.yml +++ b/.github/workflows/release_stable.yml @@ -21,11 +21,11 @@ jobs: 7.0.x 8.0.x - name: Build with dotnet - run: dotnet build --configuration Release /home/runner/work/DisposeScope/DisposeScope/DisposeScope.sln + run: dotnet build --configuration Release /home/runner/work/Dispose.Scope/Dispose.Scope/DisposeScope.sln - name: Pack with dotnet env: VERSION: ${{ github.ref_name }} - run: dotnet pack /home/runner/work/DisposeScope/DisposeScope/DisposeScope.sln --version-suffix $VERSION -o /home/runner/work/nugetpkgs -c Release --no-build + run: dotnet pack /home/runner/work/Dispose.Scope/Dispose.Scope/DisposeScope.sln --version-suffix $VERSION -o /home/runner/work/nugetpkgs -c Release --no-build - name: Upload artifact uses: actions/upload-artifact@v1 with: diff --git a/.github/workflows/release_unstable.yml b/.github/workflows/release_unstable.yml index 97e6281..7b71a7c 100644 --- a/.github/workflows/release_unstable.yml +++ b/.github/workflows/release_unstable.yml @@ -22,11 +22,11 @@ jobs: 7.0.x 8.0.x - name: Build with dotnet - run: dotnet build --configuration Release /home/runner/work/DisposeScope/DisposeScope/DisposeScope.sln + run: dotnet build --configuration Release /home/runner/work/Dispose.Scope/Dispose.Scope/DisposeScope.sln - name: Pack with dotnet env: VERSION: ${{ github.ref_name }} - run: dotnet pack /home/runner/work/DisposeScope/DisposeScope/DisposeScope.sln --version-suffix $VERSION -o /home/runner/work/nugetpkgs -c Release --no-build + run: dotnet pack /home/runner/work/Dispose.Scope/Dispose.Scope/DisposeScope.sln --version-suffix $VERSION -o /home/runner/work/nugetpkgs -c Release --no-build - name: Upload artifact uses: actions/upload-artifact@v1 with: From 05f1dd780a0562b0bc7e8e70894abc432d9e8970 Mon Sep 17 00:00:00 2001 From: InCerry Date: Fri, 23 Feb 2024 21:42:36 +0800 Subject: [PATCH 3/7] fix solution folder path --- DisposeScope.sln | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DisposeScope.sln b/DisposeScope.sln index 35dd5db..3552f2b 100644 --- a/DisposeScope.sln +++ b/DisposeScope.sln @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dispose.Scope", "src\Dispose.Scope\Dispose.Scope.csproj", "{B976AB15-A442-440D-A5C1-FC19D1DDE964}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample", "Samples\Sample\Sample.csproj", "{0A12AE66-2DA0-4C07-879D-5A09E01E43CF}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample", "samples\Sample\Sample.csproj", "{0A12AE66-2DA0-4C07-879D-5A09E01E43CF}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Benchmark", "benchmarks\Benchmark\Benchmark.csproj", "{58CA15BC-A843-4013-B2F4-9D582F7827FC}" EndProject From 72f544c5d833148f93d88ff24379a1da56b95e50 Mon Sep 17 00:00:00 2001 From: InCerry Date: Fri, 23 Feb 2024 21:59:04 +0800 Subject: [PATCH 4/7] temp --- .../Benchmark.AspNetCore.csproj} | 0 .../FooController.cs | 0 .../{Benchmark.Aspnetcore => Benchmark.AspNetCores}/Program.cs | 0 .../Properties/launchSettings.json | 0 .../appsettings.Development.json | 0 .../appsettings.json | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename benchmarks/{Benchmark.Aspnetcore/Benchmark.Aspnetcore.csproj => Benchmark.AspNetCores/Benchmark.AspNetCore.csproj} (100%) rename benchmarks/{Benchmark.Aspnetcore => Benchmark.AspNetCores}/FooController.cs (100%) rename benchmarks/{Benchmark.Aspnetcore => Benchmark.AspNetCores}/Program.cs (100%) rename benchmarks/{Benchmark.Aspnetcore => Benchmark.AspNetCores}/Properties/launchSettings.json (100%) rename benchmarks/{Benchmark.Aspnetcore => Benchmark.AspNetCores}/appsettings.Development.json (100%) rename benchmarks/{Benchmark.Aspnetcore => Benchmark.AspNetCores}/appsettings.json (100%) diff --git a/benchmarks/Benchmark.Aspnetcore/Benchmark.Aspnetcore.csproj b/benchmarks/Benchmark.AspNetCores/Benchmark.AspNetCore.csproj similarity index 100% rename from benchmarks/Benchmark.Aspnetcore/Benchmark.Aspnetcore.csproj rename to benchmarks/Benchmark.AspNetCores/Benchmark.AspNetCore.csproj diff --git a/benchmarks/Benchmark.Aspnetcore/FooController.cs b/benchmarks/Benchmark.AspNetCores/FooController.cs similarity index 100% rename from benchmarks/Benchmark.Aspnetcore/FooController.cs rename to benchmarks/Benchmark.AspNetCores/FooController.cs diff --git a/benchmarks/Benchmark.Aspnetcore/Program.cs b/benchmarks/Benchmark.AspNetCores/Program.cs similarity index 100% rename from benchmarks/Benchmark.Aspnetcore/Program.cs rename to benchmarks/Benchmark.AspNetCores/Program.cs diff --git a/benchmarks/Benchmark.Aspnetcore/Properties/launchSettings.json b/benchmarks/Benchmark.AspNetCores/Properties/launchSettings.json similarity index 100% rename from benchmarks/Benchmark.Aspnetcore/Properties/launchSettings.json rename to benchmarks/Benchmark.AspNetCores/Properties/launchSettings.json diff --git a/benchmarks/Benchmark.Aspnetcore/appsettings.Development.json b/benchmarks/Benchmark.AspNetCores/appsettings.Development.json similarity index 100% rename from benchmarks/Benchmark.Aspnetcore/appsettings.Development.json rename to benchmarks/Benchmark.AspNetCores/appsettings.Development.json diff --git a/benchmarks/Benchmark.Aspnetcore/appsettings.json b/benchmarks/Benchmark.AspNetCores/appsettings.json similarity index 100% rename from benchmarks/Benchmark.Aspnetcore/appsettings.json rename to benchmarks/Benchmark.AspNetCores/appsettings.json From 2741f5783436f0e959abb62f3396820b3077ec4f Mon Sep 17 00:00:00 2001 From: InCerry Date: Fri, 23 Feb 2024 22:00:04 +0800 Subject: [PATCH 5/7] fix folder case sensitivity issue --- .../Benchmark.AspNetCore.csproj | 0 .../FooController.cs | 0 .../{Benchmark.AspNetCores => Benchmark.AspNetCore}/Program.cs | 0 .../Properties/launchSettings.json | 0 .../appsettings.Development.json | 0 .../appsettings.json | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename benchmarks/{Benchmark.AspNetCores => Benchmark.AspNetCore}/Benchmark.AspNetCore.csproj (100%) rename benchmarks/{Benchmark.AspNetCores => Benchmark.AspNetCore}/FooController.cs (100%) rename benchmarks/{Benchmark.AspNetCores => Benchmark.AspNetCore}/Program.cs (100%) rename benchmarks/{Benchmark.AspNetCores => Benchmark.AspNetCore}/Properties/launchSettings.json (100%) rename benchmarks/{Benchmark.AspNetCores => Benchmark.AspNetCore}/appsettings.Development.json (100%) rename benchmarks/{Benchmark.AspNetCores => Benchmark.AspNetCore}/appsettings.json (100%) diff --git a/benchmarks/Benchmark.AspNetCores/Benchmark.AspNetCore.csproj b/benchmarks/Benchmark.AspNetCore/Benchmark.AspNetCore.csproj similarity index 100% rename from benchmarks/Benchmark.AspNetCores/Benchmark.AspNetCore.csproj rename to benchmarks/Benchmark.AspNetCore/Benchmark.AspNetCore.csproj diff --git a/benchmarks/Benchmark.AspNetCores/FooController.cs b/benchmarks/Benchmark.AspNetCore/FooController.cs similarity index 100% rename from benchmarks/Benchmark.AspNetCores/FooController.cs rename to benchmarks/Benchmark.AspNetCore/FooController.cs diff --git a/benchmarks/Benchmark.AspNetCores/Program.cs b/benchmarks/Benchmark.AspNetCore/Program.cs similarity index 100% rename from benchmarks/Benchmark.AspNetCores/Program.cs rename to benchmarks/Benchmark.AspNetCore/Program.cs diff --git a/benchmarks/Benchmark.AspNetCores/Properties/launchSettings.json b/benchmarks/Benchmark.AspNetCore/Properties/launchSettings.json similarity index 100% rename from benchmarks/Benchmark.AspNetCores/Properties/launchSettings.json rename to benchmarks/Benchmark.AspNetCore/Properties/launchSettings.json diff --git a/benchmarks/Benchmark.AspNetCores/appsettings.Development.json b/benchmarks/Benchmark.AspNetCore/appsettings.Development.json similarity index 100% rename from benchmarks/Benchmark.AspNetCores/appsettings.Development.json rename to benchmarks/Benchmark.AspNetCore/appsettings.Development.json diff --git a/benchmarks/Benchmark.AspNetCores/appsettings.json b/benchmarks/Benchmark.AspNetCore/appsettings.json similarity index 100% rename from benchmarks/Benchmark.AspNetCores/appsettings.json rename to benchmarks/Benchmark.AspNetCore/appsettings.json From 9b4f7f8ea9fab6b4efe05a4fc9abbd02672f3337 Mon Sep 17 00:00:00 2001 From: InCerry Date: Fri, 23 Feb 2024 22:04:15 +0800 Subject: [PATCH 6/7] fix tests path --- .github/workflows/buildandtest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/buildandtest.yml b/.github/workflows/buildandtest.yml index 4b161a3..bf1773e 100644 --- a/.github/workflows/buildandtest.yml +++ b/.github/workflows/buildandtest.yml @@ -40,4 +40,4 @@ jobs: - name: Run tests on net8.0 run: | - dotnet test --framework=net8.0 /home/runner/work/Dispose.Scope/Dispose.Scope/tests/Dispose.Scope.Tests.csproj + dotnet test --framework=net8.0 /home/runner/work/Dispose.Scope/Dispose.Scope/tests/Dispose.Scope.Tests/Dispose.Scope.Tests.csproj From 8810830c14c5dabc4e101a6cc4316f01b71bf672 Mon Sep 17 00:00:00 2001 From: InCerry Date: Fri, 23 Feb 2024 22:09:14 +0800 Subject: [PATCH 7/7] remove .net8.0 on workflow --- .github/workflows/build.yml | 2 -- .github/workflows/buildandtest.yml | 10 ++-------- .github/workflows/release_stable.yml | 2 -- .github/workflows/release_unstable.yml | 2 -- 4 files changed, 2 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 13340be..fefe846 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,9 +21,7 @@ jobs: uses: actions/setup-dotnet@v3 with: dotnet-version: | - 7.0.x 6.0.x - 8.0.x - name: Show dotnet Version run: | diff --git a/.github/workflows/buildandtest.yml b/.github/workflows/buildandtest.yml index bf1773e..d8957a8 100644 --- a/.github/workflows/buildandtest.yml +++ b/.github/workflows/buildandtest.yml @@ -22,22 +22,16 @@ jobs: with: dotnet-version: | 6.0.x - 7.0.x - 8.0.x - name: Show dotnet Version run: | dotnet --list-sdks dotnet --list-runtimes - - name: Show docker info - run: | - docker ps -a - - name: Build with dotnet run: | dotnet build --configuration Release /home/runner/work/Dispose.Scope/Dispose.Scope/DisposeScope.sln - - name: Run tests on net8.0 + - name: Run tests run: | - dotnet test --framework=net8.0 /home/runner/work/Dispose.Scope/Dispose.Scope/tests/Dispose.Scope.Tests/Dispose.Scope.Tests.csproj + dotnet test /home/runner/work/Dispose.Scope/Dispose.Scope/tests/Dispose.Scope.Tests/Dispose.Scope.Tests.csproj diff --git a/.github/workflows/release_stable.yml b/.github/workflows/release_stable.yml index 51f2aa6..4ead113 100644 --- a/.github/workflows/release_stable.yml +++ b/.github/workflows/release_stable.yml @@ -18,8 +18,6 @@ jobs: with: dotnet-version: | 6.0.x - 7.0.x - 8.0.x - name: Build with dotnet run: dotnet build --configuration Release /home/runner/work/Dispose.Scope/Dispose.Scope/DisposeScope.sln - name: Pack with dotnet diff --git a/.github/workflows/release_unstable.yml b/.github/workflows/release_unstable.yml index 7b71a7c..cc597ea 100644 --- a/.github/workflows/release_unstable.yml +++ b/.github/workflows/release_unstable.yml @@ -19,8 +19,6 @@ jobs: with: dotnet-version: | 6.0.x - 7.0.x - 8.0.x - name: Build with dotnet run: dotnet build --configuration Release /home/runner/work/Dispose.Scope/Dispose.Scope/DisposeScope.sln - name: Pack with dotnet