Skip to content

Set R temp directory to be in Runner temp directory #217

Description

@cderv

On windows, short path name (or 8.3 filename) are still used on GHA. This path can cause issue with some tools - specifically we encounter error on windows with LaTeX when rendering from a tempfile()

As nothing is done specifically in setup-r, R will look at %TEMP% which contains a short filename - this has been reported already and it is normal. (actions/runner-images#712)

What about setting TEMPDIR, TMP or TEMP to the runner temp directory by default? (RUNNER_TEMP, runner.temp, process.env["RUNNER_TEMP"]). This is already use to place the R user library (R_LIBS_USER). This folder has the advantage to not have space on Windows, so no short file name with ~.

It could also be a parameter to pass to the action to set the R temp dir to a different location

      - uses: r-lib/actions/setup-r@v1
        with:
          temp_directory: ${{ runner.temp }}

Currently to make the test pass, I set this environment for the step

      - name: Check
        env:
          _R_CHECK_CRAN_INCOMING_: false
          TMPDIR: ${{ runner.temp }}
        run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
        shell: Rscript {0}

I could also do it for the job by setting globally using a custom step

      - name: change temp dir
        run: echo "TMPDIR=${{ runner.temp }}" >> $GITHUB_ENV
        shell: bash

it seems this variable can't be define in env: at the job level, as it is done with secrets (no access to ${{ runner.temp }} there it seems)

Would it be something to consider ?

Activity

  1. koppor commented on Aug 18, 2021

    @koppor

    This refs actions/toolkit#518, because that issue asks for documentation of RUNNER_TEMP for actions.

  2. jimhester commented on Sep 14, 2021

    @jimhester
    Member

    I have never really ran into this issue in any of our workflows, so I don't think this is widespread enough to change the default, and the workaround you mentioned above seems like a good solution.

  3. locked as resolved and limited conversation to collaborators on Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions