From d75fad21469b07b29d0e126ada340d351af4e4b3 Mon Sep 17 00:00:00 2001 From: Dustin Moris Gorski Date: Fri, 28 May 2021 09:12:29 +0100 Subject: [PATCH] Updated project to GitHub actions --- .github/workflows/build.yml | 90 +++++++++ .travis.yml | 23 --- CODE_OF_CONDUCT.md | 76 ++++++++ Giraffe.TokenRouter.sln | 56 ++++++ appveyor.yml | 26 --- build.ps1 | 178 ------------------ build.sh | 2 - giraffe-64x64.png | Bin 0 -> 3458 bytes install-dotnet.ps1 | 88 --------- .../Giraffe.TokenRouter.fsproj | 35 ++-- .../TokenRouterTests.fs | 28 +-- 11 files changed, 259 insertions(+), 343 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .travis.yml create mode 100644 CODE_OF_CONDUCT.md create mode 100644 Giraffe.TokenRouter.sln delete mode 100644 appveyor.yml delete mode 100644 build.ps1 delete mode 100755 build.sh create mode 100644 giraffe-64x64.png delete mode 100644 install-dotnet.ps1 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..81de802 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,90 @@ +name: .NET Core +on: + push: + pull_request: + release: + types: + - published +env: + # Stop wasting time caching packages + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + # Disable sending usage data to Microsoft + DOTNET_CLI_TELEMETRY_OPTOUT: true + # Project name to pack and publish + PROJECT_NAME: Giraffe.TokenRouter + # GitHub Packages Feed settings + GITHUB_FEED: https://nuget.pkg.github.com/giraffe-fsharp/ + GITHUB_USER: dustinmoris + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Official NuGet Feed settings + NUGET_FEED: https://api.nuget.org/v3/index.json + NUGET_KEY: ${{ secrets.NUGET_KEY }} +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-latest, windows-latest, macos-latest ] + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 5.0.100 + - name: Restore + run: dotnet restore + - name: Build + run: dotnet build -c Release --no-restore + - name: Test + run: dotnet test -c Release + - name: Pack + if: matrix.os == 'ubuntu-latest' + run: dotnet pack -v normal -c Release --no-restore --include-symbols --include-source -p:PackageVersion=$GITHUB_RUN_ID src/$PROJECT_NAME/$PROJECT_NAME.*proj + - name: Upload Artifact + if: matrix.os == 'ubuntu-latest' + uses: actions/upload-artifact@v2 + with: + name: nupkg + path: ./src/${{ env.PROJECT_NAME }}/bin/Release/*.nupkg + prerelease: + needs: build + if: github.ref == 'refs/heads/develop' + runs-on: ubuntu-latest + steps: + - name: Download Artifact + uses: actions/download-artifact@v1 + with: + name: nupkg + - name: Push to GitHub Feed + run: | + for f in ./nupkg/*.nupkg + do + curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED + done + deploy: + needs: build + if: github.event_name == 'release' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 5.0.100 + - name: Create Release NuGet package + run: | + arrTag=(${GITHUB_REF//\// }) + VERSION="${arrTag[2]}" + echo Version: $VERSION + VERSION="${VERSION//v}" + echo Clean Version: $VERSION + dotnet pack -v normal -c Release --include-symbols --include-source -p:PackageVersion=$VERSION -o nupkg src/$PROJECT_NAME/$PROJECT_NAME.*proj + - name: Push to GitHub Feed + run: | + for f in ./nupkg/*.nupkg + do + curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED + done + - name: Push to NuGet Feed + run: dotnet nuget push ./nupkg/*.nupkg --source $NUGET_FEED --skip-duplicate --api-key $NUGET_KEY \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index dc19cab..0000000 --- a/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -language: csharp -sudo: required -dist: trusty - -dotnet: 2.1.400 -mono: - - 4.6.1 - - 4.8.1 - - 5.0.1 - -os: - - linux - -before_install: - - curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - - - curl https://packages.microsoft.com/config/ubuntu/14.04/prod.list | sudo tee /etc/apt/sources.list.d/microsoft.list - - sudo apt-get update - - sudo apt-get install -y powershell - - sudo pwsh ./install-dotnet.ps1 - -script: - - export FrameworkPathOverride=$(dirname $(which mono))/../lib/mono/4.5/ - - pwsh ./build.ps1 -Release \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..d2ecab7 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at giraffe@dusted.codes. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/Giraffe.TokenRouter.sln b/Giraffe.TokenRouter.sln new file mode 100644 index 0000000..7b69f1c --- /dev/null +++ b/Giraffe.TokenRouter.sln @@ -0,0 +1,56 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{86ED83A8-3B13-4595-B2F7-CF43BCF5C9C7}" +EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Giraffe.TokenRouter", "src\Giraffe.TokenRouter\Giraffe.TokenRouter.fsproj", "{4E3FE2C0-F63C-4DD8-84A3-83198EE5237D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{3EE4079B-6A25-45CC-9AFA-39541D0F985C}" +EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Giraffe.TokenRouter.Tests", "tests\Giraffe.TokenRouter.Tests\Giraffe.TokenRouter.Tests.fsproj", "{34CBC613-DD70-46A3-8AC6-0689510E4147}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4E3FE2C0-F63C-4DD8-84A3-83198EE5237D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4E3FE2C0-F63C-4DD8-84A3-83198EE5237D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4E3FE2C0-F63C-4DD8-84A3-83198EE5237D}.Debug|x64.ActiveCfg = Debug|Any CPU + {4E3FE2C0-F63C-4DD8-84A3-83198EE5237D}.Debug|x64.Build.0 = Debug|Any CPU + {4E3FE2C0-F63C-4DD8-84A3-83198EE5237D}.Debug|x86.ActiveCfg = Debug|Any CPU + {4E3FE2C0-F63C-4DD8-84A3-83198EE5237D}.Debug|x86.Build.0 = Debug|Any CPU + {4E3FE2C0-F63C-4DD8-84A3-83198EE5237D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4E3FE2C0-F63C-4DD8-84A3-83198EE5237D}.Release|Any CPU.Build.0 = Release|Any CPU + {4E3FE2C0-F63C-4DD8-84A3-83198EE5237D}.Release|x64.ActiveCfg = Release|Any CPU + {4E3FE2C0-F63C-4DD8-84A3-83198EE5237D}.Release|x64.Build.0 = Release|Any CPU + {4E3FE2C0-F63C-4DD8-84A3-83198EE5237D}.Release|x86.ActiveCfg = Release|Any CPU + {4E3FE2C0-F63C-4DD8-84A3-83198EE5237D}.Release|x86.Build.0 = Release|Any CPU + {34CBC613-DD70-46A3-8AC6-0689510E4147}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {34CBC613-DD70-46A3-8AC6-0689510E4147}.Debug|Any CPU.Build.0 = Debug|Any CPU + {34CBC613-DD70-46A3-8AC6-0689510E4147}.Debug|x64.ActiveCfg = Debug|Any CPU + {34CBC613-DD70-46A3-8AC6-0689510E4147}.Debug|x64.Build.0 = Debug|Any CPU + {34CBC613-DD70-46A3-8AC6-0689510E4147}.Debug|x86.ActiveCfg = Debug|Any CPU + {34CBC613-DD70-46A3-8AC6-0689510E4147}.Debug|x86.Build.0 = Debug|Any CPU + {34CBC613-DD70-46A3-8AC6-0689510E4147}.Release|Any CPU.ActiveCfg = Release|Any CPU + {34CBC613-DD70-46A3-8AC6-0689510E4147}.Release|Any CPU.Build.0 = Release|Any CPU + {34CBC613-DD70-46A3-8AC6-0689510E4147}.Release|x64.ActiveCfg = Release|Any CPU + {34CBC613-DD70-46A3-8AC6-0689510E4147}.Release|x64.Build.0 = Release|Any CPU + {34CBC613-DD70-46A3-8AC6-0689510E4147}.Release|x86.ActiveCfg = Release|Any CPU + {34CBC613-DD70-46A3-8AC6-0689510E4147}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {4E3FE2C0-F63C-4DD8-84A3-83198EE5237D} = {86ED83A8-3B13-4595-B2F7-CF43BCF5C9C7} + {34CBC613-DD70-46A3-8AC6-0689510E4147} = {3EE4079B-6A25-45CC-9AFA-39541D0F985C} + EndGlobalSection +EndGlobal diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index dccdf9e..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,26 +0,0 @@ -version: 0.1.0-{build} -image: Visual Studio 2017 -environment: - DOTNET_CLI_TELEMETRY_OPTOUT: 1 -init: - - git config --global core.autocrlf true -install: - - ps: .\install-dotnet.ps1 -build: off -build_script: - - ps: .\build.ps1 -Release -Pack -test: off -artifacts: - - path: '**\Giraffe.*.nupkg' - name: Giraffe NuGet packages -nuget: - account_feed: false - project_feed: true -deploy: - provider: NuGet - api_key: - secure: +XDgIu4Tmln7LKedNmQgMFnyKTxxuCKFRK3V5oKEfwZiakPXRd5C7OueEGBL50oh - skip_symbols: false - artifact: /.*\.nupkg/ - on: - appveyor_repo_tag: true \ No newline at end of file diff --git a/build.ps1 b/build.ps1 deleted file mode 100644 index 36ca14b..0000000 --- a/build.ps1 +++ /dev/null @@ -1,178 +0,0 @@ -# ---------------------------------------------- -# Build script -# ---------------------------------------------- - -param -( - [switch] $Release, - [switch] $Pack, - [switch] $OnlyNetStandard, - [switch] $ClearOnly -) - -$ErrorActionPreference = "Stop" - -# ---------------------------------------------- -# Helper functions -# ---------------------------------------------- - -function Test-IsWindows -{ - [environment]::OSVersion.Platform -ne "Unix" -} - -function Invoke-Cmd ($cmd) -{ - Write-Host $cmd -ForegroundColor DarkCyan - if (Test-IsWindows) { $cmd = "cmd.exe /C $cmd" } - Invoke-Expression -Command $cmd - if ($LastExitCode -ne 0) { Write-Error "An error occured when executing '$cmd'."; return } -} - -function dotnet-info { Invoke-Cmd "dotnet --info" } -function dotnet-version { Invoke-Cmd "dotnet --version" } -function dotnet-run ($project, $argv) { Invoke-Cmd "dotnet run --project $project $argv" } -function dotnet-pack ($project, $argv) { Invoke-Cmd "dotnet pack $project $argv" } - -function Get-DotNetRuntimeVersion -{ - $info = dotnet-info - [System.Array]::Reverse($info) - $version = $info | Where-Object { $_.Contains("Version") } | Select-Object -First 1 - $version.Split(":")[1].Trim() -} - -function Get-TargetFrameworks ($projFile) -{ - [xml]$proj = Get-Content $projFile - - if ($proj.Project.PropertyGroup.TargetFrameworks -ne $null) { - ($proj.Project.PropertyGroup.TargetFrameworks).Split(";") - } - else { - @($proj.Project.PropertyGroup.TargetFramework) - } -} - -function Get-NetCoreTargetFramework ($projFile) -{ - Get-TargetFrameworks $projFile | where { $_ -like "netstandard*" -or $_ -like "netcoreapp*" } -} - -function dotnet-build ($project, $argv) -{ - if ($OnlyNetStandard.IsPresent) { - $fw = Get-NetCoreTargetFramework $project - $argv = "-f $fw " + $argv - } - - Invoke-Cmd "dotnet build $project $argv" -} - -function dotnet-test ($project, $argv) -{ - # Currently dotnet test does not work for net461 on Linux/Mac - # See: https://github.com/Microsoft/vstest/issues/1318 - # - # Previously dotnet-xunit was a great alternative, however after - # issues with the maintenance dotnet xunit has been discontinued - # after xunit 2.4: https://xunit.github.io/releases/2.4 - if(!(Test-IsWindows) -or $OnlyNetStandard.IsPresent) { - $fw = Get-NetCoreTargetFramework $project; - $argv = "-f $fw " + $argv - } - - Invoke-Cmd "dotnet test $project $argv" -} - -function Write-DotnetVersion -{ - $dotnetSdkVersion = dotnet-version - Write-Host ".NET Core SDK version: $dotnetSdkVersion" -ForegroundColor Cyan -} - -function Write-DotnetInfo -{ - $dotnetRuntimeVersion = Get-DotNetRuntimeVersion - Write-Host ".NET Core Runtime version: $dotnetRuntimeVersion" -ForegroundColor Cyan -} - -function Test-Version ($project) -{ - if ($env:APPVEYOR_REPO_TAG -eq $true) - { - Write-Host "Matching version against git tag..." -ForegroundColor Magenta - - [xml] $xml = Get-Content $project - [string] $version = $xml.Project.PropertyGroup.Version - [string] $gitTag = $env:APPVEYOR_REPO_TAG_NAME - - Write-Host "Project version: $version" -ForegroundColor Cyan - Write-Host "Git tag version: $gitTag" -ForegroundColor Cyan - - if (!$gitTag.EndsWith($version)) - { - Write-Error "Version and Git tag do not match." - } - } -} - -function Update-AppVeyorBuildVersion ($project) -{ - if ($env:APPVEYOR -eq $true) - { - Write-Host "Updating AppVeyor build version..." -ForegroundColor Magenta - - [xml]$xml = Get-Content $project - $version = $xml.Project.PropertyGroup.Version - $buildVersion = "$version-$env:APPVEYOR_BUILD_NUMBER" - Write-Host "Setting AppVeyor build version to $buildVersion." - Update-AppveyorBuild -Version $buildVersion - } -} - -function Remove-OldBuildArtifacts -{ - Write-Host "Deleting old build artifacts..." -ForegroundColor Magenta - - Get-ChildItem -Include "bin", "obj" -Recurse -Directory ` - | ForEach-Object { - Write-Host "Removing folder $_" -ForegroundColor DarkGray - Remove-Item $_ -Recurse -Force } -} - -# ---------------------------------------------- -# Main -# ---------------------------------------------- - -if ($ClearOnly.IsPresent) { - Remove-OldBuildArtifacts - return -} - -$src = ".\src\Giraffe.TokenRouter\Giraffe.TokenRouter.fsproj" -$tests = ".\tests\Giraffe.TokenRouter.Tests\Giraffe.TokenRouter.Tests.fsproj" - -Update-AppVeyorBuildVersion $src -Test-Version $src -Write-DotnetVersion -Write-DotnetInfo -Remove-OldBuildArtifacts - -$configuration = if ($Release.IsPresent) { "Release" } else { "Debug" } - -Write-Host "Building Giraffe.TokenRouter..." -ForegroundColor Magenta -dotnet-build $src "-c $configuration" - -if (!$ExcludeTests.IsPresent -and !$Run.IsPresent) -{ - Write-Host "Building and running tests..." -ForegroundColor Magenta - dotnet-build $tests - dotnet-test $tests -} - -if ($Pack.IsPresent) -{ - Write-Host "Packaging all NuGet packages..." -ForegroundColor Magenta - dotnet-pack $src "-c $configuration" -} \ No newline at end of file diff --git a/build.sh b/build.sh deleted file mode 100755 index b8e46ef..0000000 --- a/build.sh +++ /dev/null @@ -1,2 +0,0 @@ -export FrameworkPathOverride=$(dirname $(which mono))/../lib/mono/4.5/ -pwsh ./build.ps1 \ No newline at end of file diff --git a/giraffe-64x64.png b/giraffe-64x64.png new file mode 100644 index 0000000000000000000000000000000000000000..40ed5e37601fefeef919f90b0b50075d0a983d2d GIT binary patch literal 3458 zcmX|Ec|6nqAOFnU*UXVQ(ppHEZAtE<%rR$_BT;jk`zjh{^3{|p$2XBH6Xlj9xu!(Q zIVBM$RQk>+q!@nd`};k9f4uM4`}umk-tXt@^?tl>oUyYI5tJ1K06+w1iFM?(CVvV) zFQ=|1M9cyJNRDvMHQLqIM$bDeM8nf3%*$6JHYA+04gdzmvEiQHLB7#&FJFH`s3Bst zy&C~1_!uHwv~1C~;ikR;1WRJ1?^&YVId5W+x2_Mu*htVIR*wS^;v4M=j|~Y9jna!X zMEr}Z$Lar>Mj_z;ibMw)B3y0Hz)iyqYV)V)E_0N|7qcvi~7I4oWcJ+_6_B@8OiZS)~eA{AN1} z95fd;XLEgOf~!=Tz6bSOqB);eGpndz*4_{y4zItp{QPm)uym($tB7SN-O*HAsF`s1 z)e`cEtbp3MX0sIodMM)ru#=w{u6o!rZnXPxt2K@z^$H>$K%59+DG z)Nd&#n^7KEJ9^~a5%0PyXEL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zj0&z0T+)3zGPr~GsCn?4$@!bt*5|8sy9v*j>-3Qal WRmVPIj7$G~op5G$*!t7>YySb$DMuUt literal 0 HcmV?d00001 diff --git a/install-dotnet.ps1 b/install-dotnet.ps1 deleted file mode 100644 index 7f3770e..0000000 --- a/install-dotnet.ps1 +++ /dev/null @@ -1,88 +0,0 @@ -# ---------------------------------------------------------- -# Install script to check and download the correct .NET SDK -# ---------------------------------------------------------- - -function Test-IsWindows -{ - [environment]::OSVersion.Platform -ne "Unix" -} - -function Invoke-Cmd ($cmd) -{ - Write-Host $cmd -ForegroundColor DarkCyan - if (Test-IsWindows) { $cmd = "cmd.exe /C $cmd" } - Invoke-Expression -Command $cmd - if ($LastExitCode -ne 0) { Write-Error "An error occured when executing '$cmd'."; return } -} - -function dotnet-version { Invoke-Cmd "dotnet --version" } - -function Get-DesiredSdk -{ - Get-Content "global.json" | ConvertFrom-Json | % { $_.sdk.version.ToString() } -} - -function Get-NetCoreSdk ($version) -{ - $os = if (Test-IsWindows) { "windows" } else { "linux" } - - $response = Invoke-WebRequest ` - -Uri "https://www.microsoft.com/net/download/thank-you/dotnet-sdk-$version-$os-x64-binaries" ` - -Method Get ` - -MaximumRedirection 0 ` - - $downloadLink = - $response.Links ` - | Where-Object { $_.onclick -eq "recordManualDownload()" } ` - | Select-Object -Expand href - - $tempFile = [System.IO.Path]::GetTempFileName() - $webClient = New-Object System.Net.WebClient - $webClient.DownloadFile($downloadLink, $tempFile) - return $tempFile -} - -function Install-NetCoreSdk ($sdkZipPath) -{ - $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetsdk" - New-Item $env:DOTNET_INSTALL_DIR -ItemType Directory -Force - - Add-Type -AssemblyName System.IO.Compression.FileSystem; - [System.IO.Compression.ZipFile]::ExtractToDirectory($sdkZipPath, $env:DOTNET_INSTALL_DIR) - $env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path" -} - -# ---------------------------------------------- -# Install .NET Core SDK -# ---------------------------------------------- - -$ErrorActionPreference = "Stop" - -# Rename the global.json before making the dotnet --version call -# This will prevent AppVeyor to fail because it might not find -# the desired SDK specified in the global.json -$globalJson = Get-Item "global.json" -Rename-Item -Path $globalJson.FullName -NewName "global.json.bak" -Force - -# Get the current .NET Core SDK version -$currentSdk = dotnet-version - -# After we established the current installed .NET SDK we can put the global.json back -Rename-Item -Path ($globalJson.FullName + ".bak") -NewName "global.json" -Force - -$desiredSdk = Get-DesiredSdk - -if ($desiredSdk -eq $currentSdk) -{ - Write-Host "The current .NET SDK matches the project's desired .NET SDK: $desiredSDK" -ForegroundColor Green - return -} - -Write-Host "The current .NET SDK ($currentSdk) doesn't match the project's desired .NET SDK ($desiredSdk)." -ForegroundColor Yellow -Write-Host "Attempting to download and install the correct .NET SDK..." - -$sdkZipPath = Get-NetCoreSdk $desiredSdk -Install-NetCoreSdk $sdkZipPath - -Write-Host ".NET SDK installation complete." -ForegroundColor Green -dotnet-version \ No newline at end of file diff --git a/src/Giraffe.TokenRouter/Giraffe.TokenRouter.fsproj b/src/Giraffe.TokenRouter/Giraffe.TokenRouter.fsproj index c3f53cd..a4e5c4f 100755 --- a/src/Giraffe.TokenRouter/Giraffe.TokenRouter.fsproj +++ b/src/Giraffe.TokenRouter/Giraffe.TokenRouter.fsproj @@ -1,37 +1,48 @@  + Giraffe.TokenRouter - 1.0.0 - net5.0 - Major - - Alternative routing API for Giraffe web applications which is aimed at maximum performance. - Copyright 2021 Dustin Moris Gorski + Copyright 2020 Dustin Moris Gorski Dustin Moris Gorski and contributors en-GB - + + net5.0 portable - True Library true false true + true + Major - + Giraffe.TokenRouter Giraffe;TokenRouter;Routing;ASP.NET Core;FSharp;Functional;Http;Web;Framework;Micro;Service https://raw.githubusercontent.com/giraffe-fsharp/Giraffe.TokenRouter/master/RELEASE_NOTES.md - https://raw.githubusercontent.com/giraffe-fsharp/Giraffe/master/giraffe-64x64.png https://github.com/giraffe-fsharp/Giraffe.TokenRouter - https://raw.githubusercontent.com/giraffe-fsharp/Giraffe.TokenRouter/master/LICENSE + giraffe-64x64.png + Apache-2.0 true git https://github.com/giraffe-fsharp/Giraffe.TokenRouter - true + + + true + true + + $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb + FS2003;FS0044 + + + true + $(PackageIconUrl) + + + diff --git a/tests/Giraffe.TokenRouter.Tests/TokenRouterTests.fs b/tests/Giraffe.TokenRouter.Tests/TokenRouterTests.fs index 6333358..3e1e590 100644 --- a/tests/Giraffe.TokenRouter.Tests/TokenRouterTests.fs +++ b/tests/Giraffe.TokenRouter.Tests/TokenRouterTests.fs @@ -345,7 +345,7 @@ let ``POST "/text" with supported Accept header returns "good"`` () = | Some ctx -> let body = getBody ctx Assert.Equal(expected, body) - Assert.Equal("text/plain", ctx.Response |> getContentType) + Assert.Equal("text/plain; charset=utf-8", ctx.Response |> getContentType) } [] @@ -379,7 +379,7 @@ let ``POST "/json" with supported Accept header returns "json"`` () = | Some ctx -> let body = getBody ctx Assert.Equal(expected, body) - Assert.Equal("application/json", ctx.Response |> getContentType) + Assert.Equal("application/json; charset=utf-8", ctx.Response |> getContentType) } [] @@ -412,7 +412,7 @@ let ``POST "/either" with supported Accept header returns "either"`` () = | Some ctx -> let body = getBody ctx Assert.Equal(expected, body) - Assert.Equal("text/plain", ctx.Response |> getContentType) + Assert.Equal("text/plain; charset=utf-8", ctx.Response |> getContentType) } [] @@ -895,7 +895,7 @@ let ``GET "/person" returns rendered HTML view`` () = | Some ctx -> let body = (getBody ctx).Replace(Environment.NewLine, String.Empty) Assert.Equal(expected, body) - Assert.Equal("text/html", ctx.Response |> getContentType) + Assert.Equal("text/html; charset=utf-8", ctx.Response |> getContentType) } [] @@ -939,7 +939,7 @@ let ``Get "/auto" with Accept header of "application/json" returns JSON object`` | Some ctx -> let body = getBody ctx Assert.Equal(expected, body) - Assert.Equal("application/json", ctx.Response |> getContentType) + Assert.Equal("application/json; charset=utf-8", ctx.Response |> getContentType) } [] @@ -983,7 +983,7 @@ let ``Get "/auto" with Accept header of "application/xml; q=0.9, application/jso | Some ctx -> let body = getBody ctx Assert.Equal(expected, body) - Assert.Equal("application/json", ctx.Response |> getContentType) + Assert.Equal("application/json; charset=utf-8", ctx.Response |> getContentType) } [] @@ -1037,7 +1037,7 @@ let ``Get "/auto" with Accept header of "application/xml" returns XML object`` ( | Some ctx -> let body = getBody ctx XmlAssert.equals expected body - Assert.Equal("application/xml", ctx.Response |> getContentType) + Assert.Equal("application/xml; charset=utf-8", ctx.Response |> getContentType) } [] @@ -1091,7 +1091,7 @@ let ``Get "/auto" with Accept header of "application/xml, application/json" retu | Some ctx -> let body = getBody ctx XmlAssert.equals expected body - Assert.Equal("application/xml", ctx.Response |> getContentType) + Assert.Equal("application/xml; charset=utf-8", ctx.Response |> getContentType) } [] @@ -1135,7 +1135,7 @@ let ``Get "/auto" with Accept header of "application/json, application/xml" retu | Some ctx -> let body = getBody ctx Assert.Equal(expected, body) - Assert.Equal("application/json", ctx.Response |> getContentType) + Assert.Equal("application/json; charset=utf-8", ctx.Response |> getContentType) } [] @@ -1189,7 +1189,7 @@ let ``Get "/auto" with Accept header of "application/json; q=0.5, application/xm | Some ctx -> let body = getBody ctx XmlAssert.equals expected body - Assert.Equal("application/xml", ctx.Response |> getContentType) + Assert.Equal("application/xml; charset=utf-8", ctx.Response |> getContentType) } [] @@ -1243,7 +1243,7 @@ let ``Get "/auto" with Accept header of "application/json; q=0.5, application/xm | Some ctx -> let body = getBody ctx XmlAssert.equals expected body - Assert.Equal("application/xml", ctx.Response |> getContentType) + Assert.Equal("application/xml; charset=utf-8", ctx.Response |> getContentType) } [] @@ -1290,7 +1290,7 @@ Piercings: [|""ear""; ""nose""|]" | Some ctx -> let body = getBody ctx Assert.Equal(expected, body) - Assert.Equal("text/plain", ctx.Response |> getContentType) + Assert.Equal("text/plain; charset=utf-8", ctx.Response |> getContentType) } [] @@ -1334,7 +1334,7 @@ let ``Get "/auto" with Accept header of "text/html" returns a 406 response`` () let body = getBody ctx Assert.Equal(406, getStatusCode ctx) Assert.Equal(expected, body) - Assert.Equal("text/plain", ctx.Response |> getContentType) + Assert.Equal("text/plain; charset=utf-8", ctx.Response |> getContentType) } [] @@ -1377,7 +1377,7 @@ let ``Get "/auto" without an Accept header returns a JSON object`` () = | Some ctx -> let body = getBody ctx Assert.Equal(expected, body) - Assert.Equal("application/json", ctx.Response |> getContentType) + Assert.Equal("application/json; charset=utf-8", ctx.Response |> getContentType) } []