fslaborg / RProvider

Access R packages from F#
http://fslab.org/RProvider/
Other
235 stars 69 forks source link

'Permission Denied' in some Github Actions CI scripts but not others #247

Open AndrewIOM opened 2 years ago

AndrewIOM commented 2 years ago

Describe the bug With Deedle and Bristlecone libraries (that use RProvider), we found that a 'Permission Denied' error arises from the type provider constructor when using RProvider 2.0.1-beta3+. This appears to relate to a chmod command being run in RProvider to set execute permissions on the executables in the nuget package cache.

I found through testing that a workaround is to run a small F# script using dotnet fsi before running the setup-dotnet action. For some reason, this stops the 'Permission Denied' error happening later on during solution build.

To Reproduce Steps to reproduce the behavior:

  1. With a ubuntu-latest runner on Github Actions,
  2. Use a script similar to the following:
  build-ubuntu:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: Set R environment variables (for RProvider)
        run:  |
          mkdir -p ~/.local/lib/R
          echo "R_LIBS_USER=~/.local/lib/R" >> "$GITHUB_ENV"
          echo "R_HOME=$(R RHOME)" >> "$GITHUB_ENV"
        shell: bash
      - name: Install R package dependencies
        run: Rscript -e "install.packages(c('zoo'))"
        shell: bash
      - name: Setup .NET Core
        uses: actions/setup-dotnet@v1
        with:
          dotnet-version: 5.0.103
      - name: Restore .NET local tools
        run: dotnet tool restore
      - name: Restore packages
        run: dotnet paket restore
      - name: Build and test
        run: dotnet fake build
  1. See error: FS3053 : The type provider 'RProvider.RProvider' reported an error : The type provider constructor has thrown an exception: Permission denied [/home/runner/work/Deedle/Deedle/src/Deedle.RProvider.Plugin/Deedle.RProvider.Plugin.fsproj]

Expected behavior Build should run and pass correctly. A workaround identified is to add a F# script into the build process as follows:

citest.fsx:

#r "nuget:RProvider,2.0.2"

open RProvider
open RProvider.``base``
open RProvider.zoo

R.c(1.,2.,3)

R.as_zoo(R.c(1,2,3))

build:

  build-ubuntu:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: Set R environment variables (for RProvider)
        run:  |
          mkdir -p ~/.local/lib/R
          echo "R_LIBS_USER=~/.local/lib/R" >> "$GITHUB_ENV"
          echo "R_HOME=$(R RHOME)" >> "$GITHUB_ENV"
        shell: bash
      - name: Install R package dependencies
        run: Rscript -e "install.packages(c('zoo'))"
        shell: bash
      - name: Test F# scripts
        run: dotnet fsi citest.fsx
      - name: Setup .NET Core
        uses: actions/setup-dotnet@v1
        with:
          dotnet-version: 5.0.103
      - name: Restore .NET local tools
        run: dotnet tool restore
      - name: Restore packages
        run: dotnet paket restore
      - name: Build and test
        run: dotnet fake build

Environment (please complete the following information):

Additional context Add any other context about the problem here.