From e2d6d6cb744465b50e7d412671d05060fe2cd5ee Mon Sep 17 00:00:00 2001 From: Paul Welter Date: Fri, 28 Jul 2023 22:06:10 -0500 Subject: [PATCH] move build to github --- .editorconfig | 52 +++++++++ .github/workflows/dotnet.yml | 109 ++++++++++++++++++ Cosmos.Identity.sln | 13 +-- README.md | 9 +- appveyor.yml | 42 ------- coveralls.ps1 | 12 -- coverlet.runsettings | 6 +- samples/Sample.Website/Sample.Website.csproj | 4 +- src/Cosmos.Identity/Cosmos.Identity.csproj | 9 +- src/Directory.Build.props | 55 +++++++++ .../Cosmos.Identity.Tests.csproj | 21 ++-- 11 files changed, 242 insertions(+), 90 deletions(-) create mode 100644 .editorconfig create mode 100644 .github/workflows/dotnet.yml delete mode 100644 appveyor.yml delete mode 100644 coveralls.ps1 create mode 100644 src/Directory.Build.props diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..c85887d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,52 @@ +# EditorConfig: https://EditorConfig.org + +root = true + +# All Files +[*] +charset = utf-8 +indent_style = space +indent_size = 4 +insert_final_newline = true +trim_trailing_whitespace = true + +# XML Configuration Files +[*.{xml,config,props,targets,nuspec,resx,ruleset,vsixmanifest,vsct,refactorlog,runsettings}] +indent_size = 2 + +# JSON Files +[*.{json,json5,webmanifest}] +indent_size = 2 + +# Project Files +[*.{csproj,sqlproj}] +indent_size = 2 + +# YAML Files +[*.{yml,yaml}] +indent_size = 2 + +# Markdown Files +[*.md] +trim_trailing_whitespace = false + +# Web Files +[*.{htm,html,js,jsm,ts,tsx,css,sass,scss,less,pcss,svg,vue}] +indent_size = 2 + +# Batch Files +[*.{cmd,bat}] +end_of_line = crlf + +# Bash Files +[*.sh] +end_of_line = lf + +[*.{cs,vb}] +dotnet_sort_system_directives_first = true +dotnet_separate_import_directive_groups = true +dotnet_style_namespace_match_folder = true + +[*.cs] +csharp_using_directive_placement = outside_namespace +csharp_style_namespace_declarations = file_scoped:warning \ No newline at end of file diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml new file mode 100644 index 0000000..89d5d30 --- /dev/null +++ b/.github/workflows/dotnet.yml @@ -0,0 +1,109 @@ +name: Build + +env: + DOTNET_NOLOGO: true + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + BUILD_PATH: '${{github.workspace}}/artifacts' + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + +on: + push: + branches: + - main + - develop + tags: + - 'v*' + pull_request: + branches: + - main + - develop + +jobs: + + build: + runs-on: windows-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Install .NET Core + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 7.0.x + + - name: Restore Dependencies + run: dotnet restore + + - name: Build Solution + run: dotnet build --no-restore --configuration Release + + - name: Start Cosmos DB + shell: pwsh + run: | + Import-Module "$env:ProgramFiles\Azure Cosmos DB Emulator\PSModules\Microsoft.Azure.CosmosDB.Emulator" + Start-CosmosDbEmulator + + - name: Run Test + run: dotnet test --configuration Release --collect:"XPlat Code Coverage" --settings coverlet.runsettings + + - name: Generate Coverage + uses: danielpalme/ReportGenerator-GitHub-Action@5.1.23 + with: + reports: '${{github.workspace}}/test/*/TestResults/*/coverage.info' + targetdir: ${{env.BUILD_PATH}} + reporttypes: lcov + + - name: Report Coverage + if: success() + uses: coverallsapp/github-action@v2 + with: + file: artifacts/lcov.info + format: lcov + + - name: Create Packages + if: success() && github.event_name != 'pull_request' + run: dotnet pack --configuration Release --include-symbols --include-source --no-build --no-restore --output "${{env.BUILD_PATH}}" + + - name: Upload Packages + if: success() && github.event_name != 'pull_request' + uses: actions/upload-artifact@v3 + with: + name: packages + path: '${{env.BUILD_PATH}}' + + deploy: + runs-on: ubuntu-latest + needs: build + if: success() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) + + steps: + - name: Download Artifact + uses: actions/download-artifact@v3 + with: + name: packages + + - name: Publish Packages GitHub + run: | + for package in $(find -name "*.nupkg"); do + echo "${0##*/}": Pushing $package... + dotnet nuget push $package --source https://nuget.pkg.github.com/loresoft/index.json --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate + done + + - name: Publish Packages feedz + run: | + for package in $(find -name "*.nupkg"); do + echo "${0##*/}": Pushing $package... + dotnet nuget push $package --source https://f.feedz.io/loresoft/open/nuget/index.json --api-key ${{ secrets.FEEDDZ_KEY }} --skip-duplicate + done + + - name: Publish Packages Nuget + if: startsWith(github.ref, 'refs/tags/v') + run: | + for package in $(find -name "*.nupkg"); do + echo "${0##*/}": Pushing $package... + dotnet nuget push $package --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_KEY }} --skip-duplicate + done + diff --git a/Cosmos.Identity.sln b/Cosmos.Identity.sln index 2ebd035..128dab9 100644 --- a/Cosmos.Identity.sln +++ b/Cosmos.Identity.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30804.86 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 15.0.26124.0 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Identity", "src\Cosmos.Identity\Cosmos.Identity.csproj", "{280BCC06-DC66-48F4-89A5-BC7E15E6BD2C}" EndProject @@ -9,18 +9,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Identity.Tests", "te EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{2DBB4192-B9EF-43A0-A409-0EA1B63AA4D0}" ProjectSection(SolutionItems) = preProject - appveyor.yml = appveyor.yml - build\common.props = build\common.props - coveralls.ps1 = coveralls.ps1 coverlet.runsettings = coverlet.runsettings + src\Directory.Build.props = src\Directory.Build.props + .github\workflows\dotnet.yml = .github\workflows\dotnet.yml README.md = README.md - build\sourcelink.props = build\sourcelink.props - build\version.props = build\version.props EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{D4FCB89C-143F-4526-ACF3-4EF8BD035C01}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample.Website", "samples\Sample.Website\Sample.Website.csproj", "{0841A17B-ED44-436C-8BEE-E156E6A3B8ED}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.Website", "samples\Sample.Website\Sample.Website.csproj", "{0841A17B-ED44-436C-8BEE-E156E6A3B8ED}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/README.md b/README.md index 74d49d1..bc532c4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Cosmos.Identity Cosmos DB provider for ASP.NET Core Identity framework -[![Build status](https://ci.appveyor.com/api/projects/status/aj2b6swwjdl0v8wr?svg=true)](https://ci.appveyor.com/project/LoreSoft/cosmos-identity) +[![Build Project](https://github.com/loresoft/Cosmos.Identity/actions/workflows/dotnet.yml/badge.svg)](https://github.com/loresoft/Cosmos.Identity/actions/workflows/dotnet.yml) [![NuGet Version](https://img.shields.io/nuget/v/Cosmos.Identity.svg?style=flat-square)](https://www.nuget.org/packages/Cosmos.Identity/) @@ -18,13 +18,6 @@ To install Cosmos.Identity, run the following command in the Package Manager Con More information about NuGet package available at -## Development Builds - -Development builds are available on the myget.org feed. A development build is promoted to the main NuGet feed when it's determined to be stable. - -In your Package Manager settings add the following package source for development builds: - - ## Usage appsettings.json configuration diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index ded5414..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,42 +0,0 @@ -version: 1.1.{build} -os: Visual Studio 2022 -environment: - ASPNETCORE_ENVIRONMENT: appveyor - COVERALLS_REPO_TOKEN: - secure: xWD+a2Pkd6bpOW7Xv9XxczN2qNh+PUqiu6o50lbM3V+Vg4Mq4r28WbYQ3JJj5g68 - -init: - - git config --global core.autocrlf input - -install: - - ps: Import-Module "$env:ProgramFiles\Azure Cosmos DB Emulator\PSModules\Microsoft.Azure.CosmosDB.Emulator" - - ps: Start-CosmosDbEmulator - - dotnet tool install --global coveralls.net - -dotnet_csproj: - patch: true - file: 'build\version.props' - version: '{version}' - package_version: '{version}' - assembly_version: '{version}.0' - file_version: '{version}.0' - informational_version: '{version}+Branch.$(APPVEYOR_REPO_BRANCH).Sha.$(APPVEYOR_REPO_COMMIT)' - -configuration: Release - -build_script: - - dotnet pack Cosmos.Identity.sln --configuration Release --include-symbols --include-source - -test_script: - - dotnet test Cosmos.Identity.sln --configuration Release --collect:"XPlat Code Coverage" --settings coverlet.runsettings - -after_test: - - ps: .\coveralls.ps1 - -artifacts: -- path: artifacts\*.*nupkg - name: Packages - -deploy: -- provider: Environment - name: MyGet \ No newline at end of file diff --git a/coveralls.ps1 b/coveralls.ps1 deleted file mode 100644 index 5a37096..0000000 --- a/coveralls.ps1 +++ /dev/null @@ -1,12 +0,0 @@ -$files = ""; - -foreach ($File in (Get-ChildItem -Path '.\test\coverage.opencover.xml' -Recurse -Force)) { - if ($files.Length -gt 0) { - $files += ";" - } - - $files += "opencover=$File" -} - -& csmacnz.Coveralls --useRelativePaths --multiple --input "$files" - diff --git a/coverlet.runsettings b/coverlet.runsettings index b8e57e2..4eac22c 100644 --- a/coverlet.runsettings +++ b/coverlet.runsettings @@ -4,9 +4,11 @@ - opencover + lcov + Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute,TestSDKAutoGeneratedCode + true - \ No newline at end of file + diff --git a/samples/Sample.Website/Sample.Website.csproj b/samples/Sample.Website/Sample.Website.csproj index e6f4cac..a8c962a 100644 --- a/samples/Sample.Website/Sample.Website.csproj +++ b/samples/Sample.Website/Sample.Website.csproj @@ -1,12 +1,12 @@ - net6.0 + net7.0 aspnet-Sample.Website-0939FBC5-AC52-4275-AE28-0EA2CCD1FE8A - + diff --git a/src/Cosmos.Identity/Cosmos.Identity.csproj b/src/Cosmos.Identity/Cosmos.Identity.csproj index 6745b54..7902691 100644 --- a/src/Cosmos.Identity/Cosmos.Identity.csproj +++ b/src/Cosmos.Identity/Cosmos.Identity.csproj @@ -1,14 +1,13 @@ - - + - netcoreapp3.1;net5.0;net6.0 + net6.0;net7.0 1591 - - + + diff --git a/src/Directory.Build.props b/src/Directory.Build.props new file mode 100644 index 0000000..6a01be0 --- /dev/null +++ b/src/Directory.Build.props @@ -0,0 +1,55 @@ + + + + + Cosmos DB provider for ASP.NET Core Identity framework. + Copyright © $([System.DateTime]::Now.ToString(yyyy)) LoreSoft + LoreSoft + en-US + true + Cosmos;CosmosDB;Identity;Membership + https://github.com/loresoft/Cosmos.Identity + MIT + logo.png + README.md + git + https://github.com/loresoft/Cosmos.Identity + true + + + + portable + true + true + snupkg + + + + latest + enable + 1591 + + + + v + + + + + + + + + + true + \ + false + + + true + \ + false + + + + diff --git a/test/Cosmos.Identity.Tests/Cosmos.Identity.Tests.csproj b/test/Cosmos.Identity.Tests/Cosmos.Identity.Tests.csproj index 0c3351d..eb7e39e 100644 --- a/test/Cosmos.Identity.Tests/Cosmos.Identity.Tests.csproj +++ b/test/Cosmos.Identity.Tests/Cosmos.Identity.Tests.csproj @@ -1,8 +1,7 @@ - + - netcoreapp3.1;net6.0 - + net7.0 false @@ -14,17 +13,17 @@ - - - - - - - + + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive