renv set up #13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: R CMD Check | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| R-CMD-Check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up R | |
| uses: r-lib/actions/setup-r@v2 | |
| with: | |
| r-version: '4.5.1' # Match your Docker image’s R version | |
| - name: Set RENV_PATHS_ROOT | |
| shell: bash | |
| run: | | |
| echo "RENV_PATHS_ROOT=${{ runner.temp }}/renv" >> $GITHUB_ENV | |
| - name: Install and activate renv | |
| run: | | |
| install.packages("renv") | |
| renv::activate() | |
| shell: Rscript {0} | |
| - name: Get R and OS version | |
| id: get-version | |
| run: | | |
| cat("##[set-output name=os-version;]", sessionInfo()$running, "\n", sep = "") | |
| cat("##[set-output name=r-version;]", R.Version()$version.string, sep = "") | |
| shell: Rscript {0} | |
| - name: Restore Renv package cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.RENV_PATHS_ROOT }} | |
| key: ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-${{ inputs.cache-version }}-${{ hashFiles('renv.lock') }} | |
| restore-keys: ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-${{inputs.cache-version }}- | |
| - name: Run R CMD check | |
| uses: r-lib/actions/check-r-package@v2 |