Rstan-based package github action - ERROR: 'configure' exists but is not executable

In my package

I am having trouble with github action

ERROR: 'configure' exists but is not executable -- see the 'R Installation and Administration Manual'

The reason is the /tmp directory, however I don’t know how to change it in github action

Using R — Package Installation Problems | Working With Data (mazamascience.com)

Does someone have a working example for a rstan-based package?

Here my file at GitHub - stemangiola/ppcseq: Posterior predictive check for bulk RNA sequencing differential abundance analyses

## Acronyms:
## * GHA: GitHub Action
## * OS: operating system

## Specify which branches you want this GHA to run on.
## Bioconductor uses branches such as master (bioc-devel) and RELEASE_* like
## RELEASE_3_10. For more details check
## http://bioconductor.org/developers/how-to/git/
on:
  push:
    branches:
      - master
      - 'RELEASE_*'
  pull_request:
    branches:
      - master
      - 'RELEASE_*'

name: R-CMD-check-bioc

## These environment variables control whether to run GHA code later on that is
## specific to testthat, covr, and pkgdown.
##
## If you need to clear the cache of packages, update the number inside
## cache-version as discussed at https://github.com/r-lib/actions/issues/86.
## Note that you can always run a GHA test without the cache by using the word
## "/nocache" in the commit message.
env:
  has_testthat: 'true'
  run_covr: 'true'
  run_pkgdown: 'true'
  has_RUnit: 'false'
  cache-version: 'cache-v1'

jobs:
  ## This first job uses the GitHub repository branch name to infer what
  ## version of Bioconductor we will be working on.
  define-docker-info:
    runs-on: ubuntu-latest
    outputs:
      imagename: ${{ steps.findinfo.outputs.imagename }}
      biocversion: ${{ steps.findinfo.outputs.biocversion }}
    steps:
      - id: findinfo
        run: |
          ## Find what Bioconductor RELEASE branch we are working on
          ## otherwise, assume we are working on bioc-devel.
          if echo "$GITHUB_REF" | grep -q "RELEASE_"; then
              biocversion="$(basename -- $GITHUB_REF | tr '[:upper:]' '[:lower:]')"
          else
              biocversion="devel"
          fi
          ## Define the image name and print the information
          imagename="bioconductor/bioconductor_docker:${biocversion}"
          echo $imagename
          echo $biocversion

          ## Save the information for the next job
          echo "::set-output name=imagename::${imagename}"
          echo "::set-output name=biocversion::${biocversion}"

  R-CMD-check-bioc:
    ## This job then checks the R package using the Bioconductor docker that
    ## was defined by the previous job. This job will determine what version of
    ## R to use for the macOS and Windows builds on the next job.
    runs-on: ubuntu-latest
    needs: define-docker-info

    ## Name shown on the GHA log
    name: ubuntu-latest (r-biocdocker bioc-${{ needs.define-docker-info.outputs.biocversion }})

    ## Information used by the next job that will run on macOS and Windows
    outputs:
      rversion: ${{ steps.findrversion.outputs.rversion }}
      biocversionnum: ${{ steps.findrversion.outputs.biocversionnum }}

    ## Environment variables unique to this job.
    env:
      R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
      TZ: UTC
      NOT_CRAN: true
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

    ## The docker container to use. Note that we link a directory on the GHA
    ## runner to a docker directory, such that we can then cache the linked
    ## directory. This directory will contain the R packages used.
    container:
      image: ${{ needs.define-docker-info.outputs.imagename }}
      volumes:
        - /home/runner/work/_temp/Library:/usr/local/lib/R/host-site-library

    steps:
      - name: Install latest git
        run: |
          ## git version provided
          git --version
          ## to be able to install software properties
          sudo apt-get update -y
          ## to be able to use add-apt-repository
          sudo apt-get install software-properties-common -y
          ## to use stable releases of git that are already in a PPA at
          ## https://launchpad.net/~git-core/+archive/ubuntu/candidate
          sudo add-apt-repository ppa:git-core/candidate -y
          ## Update
          sudo apt-get update -y
          ## Upgrade git and other tools
          sudo apt-get upgrade -y
          ## latest git version
          git --version
        shell: bash {0}
      ## Related to https://github.com/rocker-org/rocker-versioned2/issues/52

      ## Most of these steps are the same as the ones in
      ## https://github.com/r-lib/actions/blob/master/examples/check-standard.yaml
      ## If they update their steps, we will also need to update ours.
      - uses: actions/checkout@v2

      - name: Query dependencies
        run: |
          install.packages('remotes')
          saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
          message(paste('****', Sys.time(), 'installing BiocManager ****'))
          remotes::install_cran("BiocManager")
        shell: Rscript {0}

      ## Find the corresponding R version based on the Bioconductor version
      ## to use for the macOS and Windows checks by the next GHA job
      - id: findrversion
        name: Find Bioc and R versions
        run: |
          ## Find what branch we are working on
          if echo "$GITHUB_REF" | grep -q "RELEASE_"; then
              biocversion="release"
          else
              biocversion="devel"
          fi

          ## Define the R and Bioconductor version numbers
          biocversionnum=$(Rscript -e "info <- BiocManager:::.version_map_get_online('https://bioconductor.org/config.yaml'); res <- subset(info, BiocStatus == '${biocversion}')[, 'Bioc']; cat(as.character(res))")
          rversion=$(Rscript -e "info <- BiocManager:::.version_map_get_online('https://bioconductor.org/config.yaml'); res <- subset(info, BiocStatus == '${biocversion}')[, 'R']; cat(as.character(res))")

          ## Print the results
          echo $biocversion
          echo $biocversionnum
          echo $rversion

          ## Save the info for the next job
          echo "::set-output name=rversion::${rversion}"
          echo "::set-output name=biocversionnum::${biocversionnum}"
        shell:
          bash {0}

      - name: Cache R packages
        if: "!contains(github.event.head_commit.message, '/nocache')"
        uses: actions/cache@v1
        with:
          path: /home/runner/work/_temp/Library
          key: ${{ env.cache-version }}-${{ runner.os }}-biocdocker-biocbranch-${{ needs.define-docker-info.outputs.biocversion }}-r-${{ steps.findrversion.outputs.rversion }}-bioc-${{ steps.findrversion.outputs.biocversionnum }}-${{ hashFiles('.github/depends.Rds') }}
          restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocdocker-biocbranch-${{ needs.define-docker-info.outputs.biocversion }}-r-${{ steps.findrversion.outputs.rversion }}-bioc-${{ steps.findrversion.outputs.biocversionnum }}-

      - name: Install dependencies
        run: |
          ## Try installing the package dependencies in steps. First the local
          ## dependencies, then any remaining dependencies to avoid the
          ## issues described at
          ## https://stat.ethz.ch/pipermail/bioc-devel/2020-April/016675.html
          ## https://github.com/r-lib/remotes/issues/296
          ## Ideally, all dependencies should get installed in the first pass.

          ## Pass #1 at installing dependencies
          message(paste('****', Sys.time(), 'pass number 1 at installing dependencies: local dependencies ****'))
          local_deps <- remotes::local_package_deps(dependencies = TRUE)
          deps <- remotes::dev_package_deps(dependencies = TRUE, repos = BiocManager::repositories())
          BiocManager::install(local_deps[local_deps %in% deps$package[deps$diff != 0]])

          ## Pass #2 at installing dependencies
          message(paste('****', Sys.time(), 'pass number 2 at installing dependencies: any remaining dependencies ****'))
          deps <- remotes::dev_package_deps(dependencies = TRUE, repos = BiocManager::repositories())
          BiocManager::install(deps$package[deps$diff != 0])

          ## For running the checks
          message(paste('****', Sys.time(), 'installing rcmdcheck and BiocCheck ****'))
          remotes::install_cran("rcmdcheck")
          BiocManager::install("BiocCheck")
        shell: Rscript {0}

      - name: Session info
        run: |
          options(width = 100)
          pkgs <- installed.packages()[, "Package"]
          sessioninfo::session_info(pkgs, include_base = TRUE)
        shell: Rscript {0}

      - name: Check
        env:
          _R_CHECK_CRAN_INCOMING_: false
        run: |
          rcmdcheck::rcmdcheck(
              args = c("--no-build-vignettes", "--no-manual", "--timings"),
              build_args = c("--no-manual", "--no-resave-data"),
              error_on = "warning",
              check_dir = "check"
          )
        shell: Rscript {0}

      - name: Reveal testthat details
        if:  env.has_testthat == 'true'
        run: find . -name testthat.Rout -exec cat '{}' ';'

      - name: Run RUnit tests
        if:  env.has_RUnit == 'true'
        run: |
          ## Install BiocGenerics
          BiocManager::install("BiocGenerics")
          BiocGenerics:::testPackage()
        shell: Rscript {0}

      - name: BiocCheck
        run: |
          ## This syntax works on Windows as well as other OS
          ## plus it doesn't break the GHA workflow in case BiocCheck finds
          ## an error (for example, the package is bigger than the maximum
          ## allowed size). We want the rest of the GHA to proceed even if
          ## there is a BiocCheck error in order to see the full output and
          ## run the tests on all operating systems.
          BiocCheck::BiocCheck(dir('check', 'tar.gz$', full.names = TRUE), `no-check-R-ver` = TRUE, `no-check-bioc-help` = TRUE)
          ## For more options check http://bioconductor.org/packages/release/bioc/vignettes/BiocCheck/inst/doc/BiocCheck.html
        shell: Rscript {0}

      - name: Install covr
        if: github.ref == 'refs/heads/master' && env.run_covr == 'true'
        run: |
          remotes::install_cran("covr")
        shell: Rscript {0}

      - name: Test coverage
        if: github.ref == 'refs/heads/master' && env.run_covr == 'true'
        run: |
          covr::codecov()
        shell: Rscript {0}

      - name: Install pkgdown
        if: github.ref == 'refs/heads/master' && env.run_pkgdown == 'true'
        run: |
          remotes::install_github("r-lib/pkgdown")
        shell: Rscript {0}

      - name: Install package
        if: github.ref == 'refs/heads/master' && env.run_pkgdown == 'true'
        run: R CMD INSTALL .

      - name: Deploy package
        if: github.ref == 'refs/heads/master' && env.run_pkgdown == 'true'
        run: |
          git config --local user.email "action@github.com"
          git config --local user.name "GitHub Action"
          Rscript -e "pkgdown::deploy_to_branch(new_process = FALSE)"
        shell: bash {0}
        ## Note that you need to run pkgdown::deploy_to_branch(new_process = FALSE)
        ## at least one locally before this will work. This creates the gh-pages
        ## branch (erasing anything you haven't version controlled!) and
        ## makes the git history recognizable by pkgdown.

      - name: Upload check results
        if: failure()
        uses: actions/upload-artifact@master
        with:
          name: ${{ runner.os }}-biocdocker-biocbranch-${{ needs.define-docker-info.outputs.biocversion }}-r-${{ steps.findrversion.outputs.rversion }}-bioc-${{ steps.findrversion.outputs.biocversionnum }}-results
          path: check

  ## Run R CMD check on both macOS and Windows. You can also run the
  ## tests on Linux outside of the Bioconductor docker environment. If you
  ## do so, you might have to install system dependencies on Linux
  ## Bioconductor's docker includes all the system dependencies required by
  ## Bioconductor packages and their dependencies (which includes many CRAN
  ## dependencies as well, thus making this workflow useful beyond Bioconductor)
  R-CMD-check-r-lib:
    runs-on: ${{ matrix.config.os }}
    needs: [define-docker-info, R-CMD-check-bioc]

    name: ${{ matrix.config.os }} (r-${{ needs.R-CMD-check-bioc.outputs.rversion }} bioc-${{ needs.define-docker-info.outputs.biocversion }})

    strategy:
      fail-fast: false
      matrix:
        config:
          ## Comment/Un-comment in case you also want to run other versions
          - {os: windows-latest}
          - {os: macOS-latest}
          # - {os: ubuntu-16.04, rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}

    env:
      R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
      RSPM: ${{ matrix.config.rspm }}
      BIOCVERSIONNUM: ${{ needs.R-CMD-check-bioc.outputs.biocversionnum }}
      GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

    steps:
      - uses: actions/checkout@v2

      - name: Setup R from r-lib
        uses: r-lib/actions/setup-r@master
        with:
          r-version: ${{ needs.R-CMD-check-bioc.outputs.rversion }}

      - name: Setup pandoc from r-lib
        uses: r-lib/actions/setup-pandoc@master

      - name: Query dependencies
        run: |
          install.packages('remotes')
          saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
        shell: Rscript {0}

      - name: Cache R packages
        if: "!contains(github.event.head_commit.message, '/nocache')"
        uses: actions/cache@v1
        with:
          path: ${{ env.R_LIBS_USER }}
          key: ${{ env.cache-version }}-${{ runner.os }}-biocbranch-${{ needs.define-docker-info.outputs.biocversion }}-r-${{ needs.R-CMD-check-bioc.outputs.rversion }}-bioc-${{ needs.define-docker-info.outputs.biocversion }}-${{ hashFiles('.github/depends.Rds') }}
          restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocbranch-${{ needs.define-docker-info.outputs.biocversion }}-r-${{ needs.R-CMD-check-bioc.outputs.rversion }}-bioc-${{ needs.define-docker-info.outputs.biocversion }}-

      - name: Install Linux system dependencies
        if: runner.os == 'Linux'
        env:
          RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
        run: |
          Rscript -e "remotes::install_github('r-hub/sysreqs')"
          sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
          sudo -s eval "$sysreqs"

      - name: Install macOS system dependencies
        if: matrix.config.os == 'macOS-latest'
        run: |
          ## Enable installing XML from source if needed
          brew install libxml2
          echo "::set-env name=XML_CONFIG::/usr/local/opt/libxml2/bin/xml2-config"

          ## Required to install magick as noted at
          ## https://github.com/r-lib/usethis/commit/f1f1e0d10c1ebc75fd4c18fa7e2de4551fd9978f#diff-9bfee71065492f63457918efcd912cf2
          brew install imagemagick@6

      - name: Install Windows system dependencies
        if: runner.os == 'Windows'
        run: |
          ## Edit below if you have any Windows system dependencies
        shell: Rscript {0}

      - name: Install BiocManager
        run: |
          message(paste('****', Sys.time(), 'installing BiocManager ****'))
          remotes::install_cran("BiocManager")
        shell: Rscript {0}

      - name: Set BiocVersion
        run: |
          BiocManager::install(version = Sys.getenv('BIOCVERSIONNUM'), ask = FALSE)
        shell: Rscript {0}

      - name: Install dependencies
        run: |
          ## Try installing the package dependencies in steps. First the local
          ## dependencies, then any remaining dependencies to avoid the
          ## issues described at
          ## https://stat.ethz.ch/pipermail/bioc-devel/2020-April/016675.html
          ## https://github.com/r-lib/remotes/issues/296
          ## Ideally, all dependencies should get installed in the first pass.

          ## Pass #1 at installing dependencies
          message(paste('****', Sys.time(), 'pass number 1 at installing dependencies: local dependencies ****'))
          local_deps <- remotes::local_package_deps(dependencies = TRUE)
          deps <- remotes::dev_package_deps(dependencies = TRUE, repos = BiocManager::repositories())
          BiocManager::install(local_deps[local_deps %in% deps$package[deps$diff != 0]])

          ## Pass #2 at installing dependencies
          message(paste('****', Sys.time(), 'pass number 2 at installing dependencies: any remaining dependencies ****'))
          deps <- remotes::dev_package_deps(dependencies = TRUE, repos = BiocManager::repositories())
          BiocManager::install(deps$package[deps$diff != 0])

          ## For running the checks
          message(paste('****', Sys.time(), 'installing rcmdcheck and BiocCheck ****'))
          remotes::install_cran("rcmdcheck")
          BiocManager::install("BiocCheck")
        shell: Rscript {0}

      - name: Session info
        run: |
          options(width = 100)
          pkgs <- installed.packages()[, "Package"]
          sessioninfo::session_info(pkgs, include_base = TRUE)
        shell: Rscript {0}

      - name: Check
        env:
          _R_CHECK_CRAN_INCOMING_: false
        run: |
          rcmdcheck::rcmdcheck(
              args = c("--no-build-vignettes", "--no-manual", "--timings"),
              build_args = c("--no-manual", "--no-resave-data"),
              error_on = "warning",
              check_dir = "check"
          )
        shell: Rscript {0}

      - name: Reveal testthat details
        if:  env.has_testthat == 'true'
        run: find . -name testthat.Rout -exec cat '{}' ';'

      - name: Run RUnit tests
        if:  env.has_RUnit == 'true'
        run: |
          ## Install BiocGenerics
          BiocManager::install("BiocGenerics")
          BiocGenerics:::testPackage()
        shell: Rscript {0}

      - name: BiocCheck
        run: |
          ## This syntax works on Windows as well as other OS
          ## plus it doesn't break the GHA workflow in case BiocCheck finds
          ## an error (for example, the package is bigger than the maximum
          ## allowed size). We want the rest of the GHA to proceed even if
          ## there is a BiocCheck error in order to see the full output and
          ## run the tests on all operating systems.
          BiocCheck::BiocCheck(dir('check', 'tar.gz$', full.names = TRUE), `no-check-R-ver` = TRUE, `no-check-bioc-help` = TRUE)
          ## For more options check http://bioconductor.org/packages/release/bioc/vignettes/BiocCheck/inst/doc/BiocCheck.html
        shell: Rscript {0}

      - name: Upload check results
        if: failure()
        uses: actions/upload-artifact@master
        with:
          name: ${{ runner.os }}-biocbranch-${{ needs.define-docker-info.outputs.biocversion }}-r-${{ needs.R-CMD-check-bioc.outputs.rversion }}-bioc-${{ needs.define-docker-info.outputs.biocversion }}-results
          path: check

Thanks a lot.

1 Like
4 Likes

Thanks a lot!

Out of interest: did you set up your package with {rstantools}?

I built it originally with that I believe, but that was some time ago and a lot can have happened since then :)

Okay, {rstantools} should set up the configure files so they are executable automatically but perhaps something happened between then and now in this case.

Hi @stemangiola and @jeffreypullin

Could you tell me how you solved this problem ?
I am also using Github actions to check my package on Windows and Mac, and I have the same issue with the configure file.
My package is available here: GitHub - kabarigou/StanMoMo: Bayesian Mortality Modeling with Stan

Thanks for the help!

Hello,

look at the edit made on the github repository

Two files had a change in permission to make them executable

1 Like

Hello both,

Thanks a lot! Indeed, the default configure file built by rstantools creates an error by R CMD CHECK.
@jeffreypullin noticed that one needs to make the configure file executable manually so that R CMD CHECK does not produce an error anymore.

@andrjohns I’m here because it seems the configure file is still not executable. I can’t figure out how to make it executable at present but this seems like something rstantools should handle?

This isn’t something that rstantools can handle, since it’s the configure file that calls rstantools.

To make it executable, run: chmod +x configure

ok, but then is this something anyone installing from the github repo will need to do, or this is just a very specific issue to github actions?

Once you make it executable and commit the result, it will always work

I see. though then not sure why this isn’t done by the use_rstan() function when it creates it.

It might not have been thought of yet. As always we’re open to feature requests and comments in the github issues.

ok sure. I just made that comment because you said it wasn’t something rstantools could handle.

As in, rstantools can’t make it executable during package installation (since it needs to be executable to call rstantools)

1 Like

rstantools already sets the files to be executable upon creation, it seems to be some kind of interaction between github / github actions but (as far as I can tell) doesn’t apply to typical use cases. For anyone else stumbling this way, you can fix the github actions by including something like this in your .yaml:

      - name: executable Permissions
        run: |
          chmod +x configure

Note that the executable status won’t be retained if you create the package/configure files on Windows - since Windows doesn’t record those file attributes. Any chance this is happening here?

Yes I created them on windows… but if it’s a general problem why could i install ok via the github repo on my ubuntu box? Mysterious…