Skip to content

Commit

Permalink
Support netstandard2.0 (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamil7 authored May 22, 2021
1 parent 13b5581 commit e414275
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 26 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: PR

on:
pull_request:

jobs:
build:
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
fail-fast: false
runs-on: ${{ matrix.os }}
name: Build on ${{ matrix.os }} using dotnet version ${{ matrix.dotnet }}
steps:
- uses: actions/checkout@v2
- name: Build
run: dotnet build --configuration Release
- name: Test
run: dotnet test --no-restore --verbosity normal
21 changes: 14 additions & 7 deletions .github/workflows/publish_to_NuGet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,27 @@ name: Publish to nuget

on:
release:
types: [created, edited]
types: [ created, edited ]

jobs:
publish:
runs-on: ubuntu-latest

build:
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
fail-fast: false
runs-on: ${{ matrix.os }}
name: Build on ${{ matrix.os }} using dotnet version ${{ matrix.dotnet }}
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
run: dotnet build --configuration Release
- name: Test
run: dotnet test --no-restore --verbosity normal

publish:
runs-on: ubuntu-latest
needs: build
steps:
- name: Create the package
run: dotnet pack --configuration Release -o Release -p:PackageVersion=${GITHUB_REF/refs\/tags\/v/''} --include-source
- name: Publish the package to NuGet
Expand Down
23 changes: 12 additions & 11 deletions src/FSharp.Prelude.fsproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks>
<TargetFramework>netstandard2.0</TargetFramework>
<PackageId>FSharp.Prelude</PackageId>
<Authors>Jamil Maqdis Anton</Authors>
<PackageDescription>Some extensions for F#</PackageDescription>
Expand All @@ -14,19 +14,20 @@
</PropertyGroup>

<ItemGroup>
<Compile Include="Internal.fs" />
<Compile Include="Option.fs" />
<Compile Include="Result.fs" />
<Compile Include="Async.fs" />
<Compile Include="AsyncResult.fs" />
<Compile Include="AsyncOption.fs" />
<Compile Include="AsyncResultOption.fs" />
<Compile Include="List.fs" />
<Compile Include="String.fs" />
<Compile Include="Internal.fs"/>
<Compile Include="Option.fs"/>
<Compile Include="Result.fs"/>
<Compile Include="Async.fs"/>
<Compile Include="AsyncResult.fs"/>
<Compile Include="AsyncOption.fs"/>
<Compile Include="AsyncResultOption.fs"/>
<Compile Include="List.fs"/>
<Compile Include="String.fs"/>
</ItemGroup>

<ItemGroup>
<PackageReference Update="FSharp.Core" Version="5.0.0" />
<PackageReference Include="FSharp.Core" Version="5.0.0"/>
<PackageReference Update="FSharp.Core" Version="5.0.0"/> <!-- workaround for VSMac bug https://github.com/mono/monodevelop/pull/5137 -->
</ItemGroup>

</Project>
13 changes: 7 additions & 6 deletions src/String.fs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
namespace FSharp.Prelude

open System

[<RequireQualifiedAccess>]
module String =

Expand All @@ -11,7 +9,7 @@ module String =

let isEmpty (str: string) : bool = str = ""

let join (separator: string) (values: string list) : string = String.Join(separator, values)
let join (separator: string) (values: string list) : string = System.String.Join(separator, values)

let padLeft (totalWidth: int) (str: string) = str.PadLeft totalWidth

Expand All @@ -23,11 +21,14 @@ module String =
else
source.Replace(oldValue, newValue)

let reverse (str: string) : string = String(str.ToCharArray() |> Array.rev)
let reverse (str: string) : string =
System.String(str.ToCharArray() |> Array.rev)

let split (separator: string) (str: string) = str.Split(separator) |> List.ofArray
let split (separator: string) (str: string) =
str.Split(separator |> Seq.singleton |> Seq.toArray, System.StringSplitOptions.None)
|> List.ofArray

let lines (str: string) : string list = split Environment.NewLine str
let lines (str: string) : string list = split System.Environment.NewLine str

let startsWith (value: string) (source: string) : bool = source.StartsWith value

Expand Down
4 changes: 2 additions & 2 deletions tests/FSharp.Prelude.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="5.0.0 " />
<PackageReference Include="Expecto" Version="9.0.2" />
<PackageReference Include="YoloDev.Expecto.TestSdk" Version="0.9.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
<PackageReference Include="YoloDev.Expecto.TestSdk" Version="0.11.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit e414275

Please sign in to comment.