Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI with github actions #216

Merged
merged 36 commits into from
Sep 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
f842da9
change checkout order
nhirschey Sep 15, 2021
18e7256
checkout@master
nhirschey Sep 15, 2021
a3c5647
capitalization
nhirschey Sep 15, 2021
4e22a60
try set r home
nhirschey Sep 15, 2021
5b15908
only mac CI
nhirschey Sep 15, 2021
580185b
print home
nhirschey Sep 15, 2021
8c4af2f
mac R_HOME in CI
nhirschey Sep 15, 2021
9750b4f
set R_HOME for mac in both pr and push
nhirschey Sep 15, 2021
3f9fb71
use target All on push
nhirschey Sep 15, 2021
a231f04
add back ubuntu and windows
nhirschey Sep 16, 2021
2df575a
set timeout minutes
nhirschey Sep 16, 2021
1ec9228
Switch to dotnet pack from nuget.exe
AndrewIOM Sep 16, 2021
59b6cf6
Merge branch 'v2' into pr/216
AndrewIOM Sep 16, 2021
00de6a1
Reorder actions to use specific R version
AndrewIOM Sep 16, 2021
0b9ffda
Use bash for R home identify step
AndrewIOM Sep 16, 2021
aab4878
use Rscript for cross-platform R.home() verification.
nhirschey Sep 16, 2021
d7cc687
Merge remote-tracking branch 'upstream/master' into nh-si
nhirschey Sep 17, 2021
bdbc9de
Add matrix type conversions
nhirschey Sep 18, 2021
2ba7c99
more logs
nhirschey Sep 18, 2021
843cc7e
try add r log to pr CI
nhirschey Sep 18, 2021
dc0b8fd
Fix RProvider_LOG env variable
nhirschey Sep 18, 2021
9940f4d
Update paket.dependencies
AndrewIOM Sep 19, 2021
3ccfaa2
Detect process exit on windows
AndrewIOM Sep 19, 2021
bbf941b
Use simple dotnet exec
AndrewIOM Sep 19, 2021
d0023f5
Update paket.lock
AndrewIOM Sep 19, 2021
993061e
Always output CI logs
AndrewIOM Sep 20, 2021
ed44a03
Merge branch 'nh-si' of https://github.com/nhirschey/RProvider into p…
AndrewIOM Sep 20, 2021
8fac631
Update build.fsx
AndrewIOM Sep 20, 2021
50e54d3
Merge branch 'nh-si' of https://github.com/nhirschey/RProvider into p…
AndrewIOM Sep 20, 2021
638315f
Use R 4.0.2 in CI
AndrewIOM Sep 20, 2021
d316944
Disable test parallelism
AndrewIOM Sep 20, 2021
294893c
Testing process.hasexited in github actions
AndrewIOM Sep 20, 2021
8c62df9
Revert program.fs
AndrewIOM Sep 20, 2021
870db59
Test 2: Remove RData tests
AndrewIOM Sep 20, 2021
bbab96a
Revert RData.Tests.fs
AndrewIOM Sep 20, 2021
080284f
Disable Ubuntu CI for now
AndrewIOM Sep 20, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,26 @@ name: .NET

on:
pull_request:
branches: [ master ]
branches: [ master ]

jobs:
build:

runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os: [macos-latest]
os: [macos-latest,windows-latest]
env:
RPROVIDER_LOG: rlog.txt

steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@master
- uses: actions/checkout@master
- uses: r-lib/actions/setup-r@v1
name: Setup R environment
with:
r-version: '4.1.1'
r-version: '4.0.2'
- name: Set R_HOME environment variable
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
Expand All @@ -31,6 +35,10 @@ jobs:
exit 1
fi
shell: bash
- name: Verify R Home
run: |
Rscript -e 'R.home()'
echo "${{ env.R_HOME }}"
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
Expand All @@ -45,3 +53,6 @@ jobs:
run: dotnet restore RProvider.Tests.sln
- name: Build
run: dotnet fake build -t All
- name: Check R log
if: ${{ always() }}
run: cat rlog.txt
22 changes: 16 additions & 6 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@ name: .NET

on:
push:
branches: [ master, fix-ci ]
branches: [ master ]

jobs:
build:
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os: [macos-latest]
os: [macos-latest,windows-latest]

steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@master
- uses: actions/checkout@master
- uses: r-lib/actions/setup-r@v1
name: Setup R environment
with:
r-version: '4.1.1'
r-version: '4.0.2'
- name: Set R_HOME environment variable
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
Expand All @@ -30,6 +32,10 @@ jobs:
exit 1
fi
shell: bash
- name: Verify R Home
run: |
Rscript -e 'R.home()'
echo "${{ env.R_HOME }}"
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
Expand All @@ -43,11 +49,15 @@ jobs:
- name: Restore dependencies
run: dotnet restore RProvider.Tests.sln
- name: Build
run: dotnet fake build -t GenerateDocs
run: dotnet fake build -t All
- name: Deploy documentation from master
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./output
publish_branch: gh-pages
force_orphan: true
- name: Examine bin
run: ls -r bin
- name: Publish NuGets (if this version not published before)
run: dotnet nuget push bin\*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGETKEY }} --skip-duplicate
133 changes: 48 additions & 85 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ let projectDescription = """
The type provider automatically discovers available R packages and makes them
easily accessible from F#, so you can easily call powerful packages and
visualization libraries from code running on the .NET platform."""
let authors = ["BlueMountain Capital"; "FsLab"]
let authors = "BlueMountain Capital;FsLab"
let companyName = "BlueMountain Capital, FsLab"
let tags = "F# fsharp R TypeProvider visualization statistics"

let gitHome = "https://github.com/fslaborg"
let gitName = "RProvider"
let packageProjectUrl = "https://fslaborg.org/RProvider/"
let repositoryType = "git"
let repositoryUrl = "https://github.com/fslaborg/RProvider"

// --------------------------------------------------------------------------------------
// The rest of the code is standard F# build script
Expand Down Expand Up @@ -91,20 +92,21 @@ Target.create "Build" (fun _ ->

Target.create "BuildTests" (fun _ ->
Trace.log " --- Building tests --- "
Fake.DotNet.DotNet.build id (projectName + ".Tests.sln")
//Fake.DotNet.DotNet.build id (projectName + ".Tests.sln")
let result = Fake.DotNet.DotNet.exec (fun args ->
{ args with Verbosity = Some Fake.DotNet.DotNet.Verbosity.Normal}) "build" (projectName + ".Tests.sln")
if result.ExitCode <> 0 then failwith "Building tests failed"
)

// --------------------------------------------------------------------------------------
// Run the unit tests using test runner & kill test runner when complete


Target.create "RunTests" (fun _ ->
Target.activateFinal "CloseTestRunner"
Fake.DotNet.DotNet.test id (projectName + ".Tests.sln")
)

Target.createFinal "CloseTestRunner" (fun _ ->
Process.killAllByName "xunit.console.clr4.exe"
let rHome = Environment.environVarOrFail "R_HOME"
Trace.logf "R_HOME is set as %s" rHome
let result = Fake.DotNet.DotNet.exec (fun args ->
{ args with Verbosity = Some Fake.DotNet.DotNet.Verbosity.Normal}) "test" (projectName + ".Tests.sln")
if result.ExitCode <> 0 then failwith "Tests failed"
)

// --------------------------------------------------------------------------------------
Expand All @@ -114,25 +116,36 @@ Target.create "NuGet" (fun _ ->
// Format the description to fit on a single line (remove \r\n and double-spaces)
let specificVersion (name, version) = name, sprintf "[%s]" version
let projectDescription = projectDescription.Replace("\r", "").Replace("\n", "").Replace(" ", " ")
Fake.DotNet.NuGet.NuGet.NuGet (fun p ->

// Format the release notes
let releaseNotes = release.Notes |> String.concat "\n"

let properties = [
("Version", release.NugetVersion)
("Authors", authors)
("PackageProjectUrl", packageProjectUrl)
("PackageTags", tags)
("RepositoryType", repositoryType)
("RepositoryUrl", repositoryUrl)
//("PackageLicenseExpression", license) // TODO Enable license after stop packing PipeMethodCalls
("PackageReleaseNotes", releaseNotes)
("Summary", projectSummary)
("PackageDescription", projectDescription)
("EnableSourceLink", "true")
("PublishRepositoryUrl", "true")
("EmbedUntrackedSources", "true")
//("IncludeSymbols", "true") //TODO Enable symbols
("IncludeSymbols", "false")
("SymbolPackageFormat", "snupkg")
]

DotNet.pack (fun p ->
{ p with
Authors = authors
Project = projectName
Summary = projectSummary
Description = projectDescription
Version = release.NugetVersion
ReleaseNotes = String.concat " " release.Notes
Tags = tags
OutputPath = "bin"
Dependencies =
[ "R.NET.Community", Fake.DotNet.NuGet.NuGet.GetPackageVersion "packages" "R.NET.Community"
"DynamicInterop", Fake.DotNet.NuGet.NuGet.GetPackageVersion "packages" "DynamicInterop"
"R.NET.Community.FSharp", Fake.DotNet.NuGet.NuGet.GetPackageVersion "packages" "R.NET.Community.FSharp" ]
|> List.map specificVersion
AccessKey = Fake.Core.Environment.environVarOrDefault "nugetkey" ""
Publish = Fake.Core.Environment.hasEnvironVar "nugetkey" })
"nuget/RProvider.nuspec"
)
Configuration = DotNet.BuildConfiguration.Release
OutputPath = Some "bin"
MSBuildParams = { p.MSBuildParams with Properties = properties}
}
) "src/RProvider/RProvider.fsproj")

//--------------------------------------------------------------------------------------
//Generate the documentation
Expand All @@ -142,65 +155,15 @@ Target.create "GenerateDocs" (fun _ ->
DotNet.exec id "fsdocs" "build --clean" |> ignore
)

// --------------------------------------------------------------------------------------
// Release Scripts

Target.create "ReleaseDocs" (fun _ ->
Fake.Tools.Git.Repository.clone "" gitHome "temp/gh-pages"
Fake.Tools.Git.Branches.checkoutBranch "temp/gh-pages" "gh-pages"
Fake.IO.Shell.copyRecursive "output" "temp/gh-pages" true |> printfn "%A"
Fake.Tools.Git.CommandHelper.runSimpleGitCommand "temp/gh-pages" "add ." |> printfn "%s"
let cmd = sprintf """commit -a -m "Update generated documentation for version %s""" release.NugetVersion
Fake.Tools.Git.CommandHelper.runSimpleGitCommand "temp/gh-pages" cmd |> printfn "%s"
Fake.Tools.Git.Branches.push "temp/gh-pages"
)

Target.create "ReleaseBinaries" (fun _ ->
Fake.Tools.Git.Repository.clone "" (gitHome + "/" + gitName + ".git") "temp/release"
Fake.Tools.Git.Branches.checkoutBranch "temp/release" "release"
Fake.IO.Shell.copyRecursive "bin" "temp/release" true |> printfn "%A"
let cmd = sprintf """commit -a -m "Update binaries for version %s""" release.NugetVersion
Fake.Tools.Git.CommandHelper.runSimpleGitCommand "temp/release" cmd |> printfn "%s"
Fake.Tools.Git.Branches.push "temp/release"
)

Target.create "TagRelease" (fun _ ->
// Concatenate notes & create a tag in the local repository
let notes = (String.concat " " release.Notes).Replace("\n", ";").Replace("\r", "")
let tagName = "v" + release.NugetVersion
let cmd = sprintf """tag -a %s -m "%s" """ tagName notes
Fake.Tools.Git.CommandHelper.runSimpleGitCommand "." cmd |> printfn "%s"

// Find the main remote (fslaborg GitHub)
let _, remotes, _ = Fake.Tools.Git.CommandHelper.runGitCommand "." "remote -v"
let main = remotes |> Seq.find (fun s -> s.Contains("(push)") && s.Contains("fslaborg/RProvider"))
let remoteName = main.Split('\t').[0]
Fake.Tools.Git.Branches.pushTag "." remoteName tagName
)

Target.create "Release" ignore

// --------------------------------------------------------------------------------------
// Run all targets by default. Invoke 'build <Target>' to override

Target.create "All" ignore
Target.create "AllCore" ignore

"Clean"
==> "AssemblyInfo"
==> "Build"
==> "BuildTests"
==> "RunTests"
==> "All"

"All"
==> "CleanDocs"
==> "GenerateDocs"
==> "ReleaseDocs"
==> "ReleaseBinaries"
==> "Release"

"All" ==> "NuGet" ==> "Release"
"All" ==> "TagRelease" ==> "Release"

"Clean" ==> "AssemblyInfo" ==> "Build"
"Build" ==> "CleanDocs" ==> "GenerateDocs" ==> "All"
"Build" ==> "NuGet" ==> "All"
"Build" ==> "All"
"Build" ==> "BuildTests" ==> "RunTests" ==> "All"

Target.runOrDefault "All"
38 changes: 0 additions & 38 deletions nuget/RProvider.nuspec

This file was deleted.

1 change: 0 additions & 1 deletion nuget/publish.cmd

This file was deleted.

2 changes: 1 addition & 1 deletion paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ nuget R.NET.FSharp 1.9.0
nuget System.ComponentModel.Composition 5.0.0
nuget System.Configuration.ConfigurationManager 5.0.0
nuget System.Reflection.MetadataLoadContext 5.0.0
github andrewiom/PipeMethodCalls:69e5b6f7c1a130e20a2b8023638f6d6d65390b55
github andrewiom/PipeMethodCalls:7306482212444920ff07b0c5db5f2e71a4077bdf

github fsprojects/FSharp.TypeProviders.SDK:f4aca36af04aa84b16ec04df6f6bf55ac2f17a73 src/ProvidedTypes.fsi
github fsprojects/FSharp.TypeProviders.SDK:f4aca36af04aa84b16ec04df6f6bf55ac2f17a73 src/ProvidedTypes.fs
Expand Down
2 changes: 1 addition & 1 deletion paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ NUGET
xunit.runner.visualstudio (2.4.3)
GITHUB
remote: andrewiom/PipeMethodCalls
FULLPROJECT (69e5b6f7c1a130e20a2b8023638f6d6d65390b55)
FULLPROJECT (7306482212444920ff07b0c5db5f2e71a4077bdf)
remote: fsprojects/FSharp.TypeProviders.SDK
src/ProvidedTypes.fs (f4aca36af04aa84b16ec04df6f6bf55ac2f17a73)
src/ProvidedTypes.fsi (f4aca36af04aa84b16ec04df6f6bf55ac2f17a73)
Expand Down
17 changes: 13 additions & 4 deletions src/RProvider.DesignTime/RData.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ open System.Reflection
open ProviderImplementation.ProvidedTypes
open Microsoft.FSharp.Core.CompilerServices
open RProvider
open RProvider.Internal
open Microsoft.FSharp.Quotations
open PipeMethodCalls

Expand All @@ -20,7 +21,7 @@ type public RDataProvider(cfg:TypeProviderConfig) as this =

/// Given a file name, generate static type inherited from REnv
let generateTypes asm typeName (args:obj[]) =

Logging.logf $"Generating type for {typeName}"
// Load the environment and generate the type
let fileName = args.[0] :?> string
let longFileName =
Expand Down Expand Up @@ -50,6 +51,7 @@ type public RDataProvider(cfg:TypeProviderConfig) as this =

// For each key in the environment, provide a property..
for name, typ in RInteropClient.getServer().InvokeAsync(fun s -> s.GetRDataSymbols(longFileName)) |> Async.AwaitTask |> Async.RunSynchronously do
Logging.logf $"Adding member {name}"
match typ with
| null ->
// Generate property of type 'SymbolicExpression'
Expand All @@ -63,7 +65,8 @@ type public RDataProvider(cfg:TypeProviderConfig) as this =
ProvidedProperty(name, typ, getterCode = fun (Singleton self) ->
Expr.Coerce(<@@ ((%%self):REnv).Get(name).Value @@>, typ))
|> resTy.AddMember


Logging.logf $"Finished generating types for {longFileName}"
resTy

// Register the main (parameterized) type with F# compiler
Expand All @@ -77,5 +80,11 @@ type public RDataProvider(cfg:TypeProviderConfig) as this =

let rdata = ProvidedTypeDefinition(asm, "RProvider", "RData", Some(typeof<obj>))
let parameter = ProvidedStaticParameter("FileName", typeof<string>)
do rdata.DefineStaticParameters([parameter], generateTypes asm)
do this.AddNamespace("RProvider", [ rdata ])
do
rdata.DefineStaticParameters([parameter], generateTypes asm)
Logging.logf $"Defined static Parameters {parameter}"
do
this.AddNamespace("RProvider", [ rdata ])
Logging.logf $"RData added namespace {rdata.FullName}"


Loading