build pkg down site from subdirectory on gh-actions

hi all

I have a non-standard setup for a research project where an R package is a subdirectory for a julia package. Both R and julia parts build their respective docs on the same machine, the julia command in the end copies the generated R HTML docs such that all is in one place. Yes it's a hack. It works locally though! :grinning_face_with_smiling_eyes: it looks like this:

➜  LandUse.jl git:(master) ✗ tree -d
.
├── LandUseR
│   ├── R
│   ├── docs
│   ├── man
│   └── tests
│       └── testthat
├── docs
├── src
├── test

So, the package root contains the julia package LandUse.jl, and the R package is in the subdirectory LandUseR. There must be something in the gh-actions recipe that sets the root of the repo as the R-package root as well (maybe?), because I get this error

Run Rscript -e 'pkgdown::build_site(pkg = "/Users/runner/work/LandUse.jl/LandUseR")'
10
Error: Error: `pkg` is not an existing directory
11
Execution halted
12
Error: Process completed with exit code 1.

where this is my worklow file, and where I manually changed the pkg down command to run: Rscript -e 'pkgdown::build_site(pkg = "/Users/runner/work/LandUse.jl/LandUseR")' because it used to fail with "/Users/runner/work/LandUse.jl/LandUse.jl/LandUseR" not found. Any help greatly appreciated! thanks!

on:
  push:
    branches: [master]
    tags: ["*"]
  pull_request:

name: docs


jobs:
  docs:
    name: Documentation
    runs-on: macOS-latest
    env:
      GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

    steps:
      - uses: actions/checkout@v2

      - uses: r-lib/actions/setup-r@v1

      - uses: r-lib/actions/setup-pandoc@v1
      
      - uses: julia-actions/setup-julia@v1
        with:
          version: '1'

      - name: R Install system pkgs
        run: |
          brew install udunits cairo freetype
          brew install udunits cairo
          brew reinstall freetype
          Rscript -e "install.packages('sf', type='mac.binary', dependencies=TRUE)"
      - name: R Query dependencies
        run: |
          install.packages('remotes')
          saveRDS(remotes::dev_package_deps(pkgdir = "LandUseR", dependencies = TRUE), ".github/depends.Rds", version = 2)
          writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
        shell: Rscript {0}

      - name: Restore R package cache
        uses: actions/cache@v2
        with:
          path: ${{ env.R_LIBS_USER }}
          key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
          restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-

      - name: R Install dependencies
        run: |
          remotes::install_deps(pkgdir = "LandUseR",dependencies = TRUE)
          remotes::install_cran("rcmdcheck")
        shell: Rscript {0}

      - name: R Install package
        run: R CMD INSTALL LandUseR

      - name: Check
        env:
          _R_CHECK_CRAN_INCOMING_REMOTE_: false
        run: |
          options(crayon.enabled = TRUE)
          rcmdcheck::rcmdcheck(path = "LandUseR", args = c("--no-manual", "--as-cran"), error_on = "error", check_dir = "check")
        shell: Rscript {0}

      - name: build R docs
        run: Rscript -e 'pkgdown::build_site(pkg = "/Users/runner/work/LandUse.jl/LandUseR")'

      - name: build julia project
        run: |
          julia --project=docs -e '
            using Pkg
            Pkg.develop(PackageSpec(path=pwd()))
            Pkg.instantiate()'
      
      - name: build julia docs and deploy all
        run: julia --project=docs docs/make.jl
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}

This topic was automatically closed after 45 days. New replies are no longer allowed.


If you have a query related to it or one of the replies, start a new topic and refer back with a link.