test: enable parallel execution and improve CI/test robustness #422
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: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| rcmdcheck: | |
| if: contains(github.event.head_commit.message, '[ci skip]') == false | |
| name: rcmdcheck ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| log_file: /tmp/languageserver/ubuntu-log | |
| - os: macos-latest | |
| log_file: /tmp/languageserver/macos-log | |
| - os: windows-latest | |
| log_file: C:/tmp/languageserver/windows-log | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| NOT_CRAN: true | |
| _R_CHECK_CRAN_INCOMING_: false | |
| R_LANGSVR_LOG: ${{ matrix.log_file }} | |
| R_LANGSVR_POOL_SIZE: 1 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: r-lib/actions/setup-r@v2 | |
| with: | |
| r-version: release | |
| - name: Create log directory on Linux or macOS | |
| if: runner.os != 'Windows' | |
| run: mkdir -p $(dirname ${{ env.R_LANGSVR_LOG }}) | |
| - name: Create log directory on Windows | |
| if: runner.os == 'Windows' | |
| run: New-Item -ItemType directory -Path (Split-Path -Parent ${{ env.R_LANGSVR_LOG }}) | |
| - name: Query dependencies | |
| run: | | |
| install.packages('remotes') | |
| saveRDS(remotes::dev_package_deps(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@v5 | |
| 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: Install system dependencies | |
| if: runner.os == 'Linux' | |
| run: | | |
| while read -r cmd | |
| do | |
| eval sudo $cmd | |
| done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') | |
| - name: Install dependencies | |
| run: | | |
| Rscript -e "remotes::install_deps(dependencies = TRUE)" | |
| Rscript -e "remotes::install_cran('rcmdcheck')" | |
| - name: Install a sperate copy on Windows | |
| if: runner.os == 'Windows' | |
| run: | | |
| Rscript -e "remotes::install_local(force = TRUE)" | |
| - name: Running Tests | |
| id: rcmdcheck | |
| run: | | |
| Rscript -e "rcmdcheck::rcmdcheck(args = c('--as-cran', '--no-manual'), error_on = 'warning')" | |
| - uses: actions/upload-artifact@v7 | |
| if: failure() | |
| with: | |
| name: ${{ runner.os }}-log | |
| path: ${{ env.R_LANGSVR_LOG }} |