Update r.yml #49
This file contains 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
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
# | |
# See https://github.com/r-lib/actions/tree/master/examples#readme for | |
# additional example workflows available for the R community. | |
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
# | |
# See https://github.com/r-lib/actions/tree/master/examples#readme for | |
# additional example workflows available for the R community. | |
name: R | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
permissions: | |
contents: read | |
jobs: | |
R-CMD-check: | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
matrix: | |
config: | |
- { os: ubuntu-latest, r: 'devel' } | |
- { os: ubuntu-latest, r: 'release' } | |
- { os: macOS-latest, r: 'release' } | |
- { os: windows-latest, r: 'release' } | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up R (latest version) | |
uses: r-lib/actions/[email protected] | |
with: | |
r-version: 'release' | |
# Install system dependencies required for R packages | |
- name: Install system dependencies (Linux) | |
if: matrix.config.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update -y || true | |
sudo apt-get install -y pandoc | |
- name: Debug Installed Tools | |
run: | | |
echo "R version:" | |
Rscript -e "R.version" | |
echo "Checking pkg-config installation:" | |
which pkg-config || echo 'pkg-config not found' | |
pkg-config --version || echo 'pkg-config version issue' | |
- name: Install system dependencies (macOS) | |
if: matrix.config.os == 'macOS-latest' | |
run: | | |
brew install pandoc | |
- name: Install Pandoc for Windows | |
if: matrix.config.os == 'windows-latest' | |
run: | | |
choco install pandoc -y | |
- name: Install R dependencies | |
run: | | |
Rscript -e "if (!requireNamespace('remotes', quietly = TRUE)) install.packages('remotes')" | |
Rscript -e "remotes::install_deps(dependencies = TRUE)" | |
- name: Run R tests | |
run: | |
Rscript -e "testthat::test_file('tests/testthat/test-counts.R')" | |
Rscript -e "testthat::test_file('tests/testthat/test-reordering.R')" | |
# Build the package based on os | |
- name: Build the package (Linux/macOS) | |
if: matrix.config.os != 'windows-latest' | |
run: | | |
R CMD build . | |
- name: Build the package (Windows) | |
if: matrix.config.os == 'windows-latest' | |
shell: cmd | |
run: | | |
R CMD build . | |
#Check the package | |
- name: Check the package (Linux/macOS) | |
if: matrix.config.os != 'windows-latest' | |
run: | | |
echo "Running R CMD build" | |
R CMD build . | |
echo "Running R CMD check" | |
PKG_TAR=$(ls *.tar.gz) | |
R CMD check "$PKG_TAR" --no-manual --as-cran | |
- name: Check the package (Windows) | |
if: matrix.config.os == 'windows-latest' | |
shell: cmd | |
run: | | |
FOR /F "tokens=*" %%i IN ('dir /b *.tar.gz') DO SET PKG_TAR=%%i && R CMD check "%%PKG_TAR%" --no-manual --as-cran |