Update r.yml #69
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-22.04, r: 'devel' } | |
- { os: ubuntu-22.04, r: 'release' } | |
- { os: macOS-latest, r: 'next' } | |
- { os: windows-latest, r: 'release' } | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Use the latest version of setup-r that includes the fix for pkgconf | |
- name: Set up R (latest version) | |
uses: r-lib/actions/[email protected] | |
with: | |
r-version: ${{ matrix.config.r }} | |
# Install system dependencies for Ubuntu | |
- name: Install system dependencies (Ubuntu) | |
if: startsWith(matrix.config.os, 'ubuntu') | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y pandoc | |
- name: Suppress Transition Warnings | |
if: startsWith(matrix.config.os, 'ubuntu') | |
run: echo "Suppressing Ubuntu transition warnings" | |
# Debug Installed Tools for Ubuntu | |
- name: Debug Installed Tools (Ubuntu) | |
if: startsWith(matrix.config.os, 'ubuntu') | |
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' | |
# Install system dependencies for macOS | |
- name: Install system dependencies (macOS) | |
if: matrix.config.os == 'macOS-latest' | |
run: | | |
brew update | |
brew install pandoc | |
echo "pkgconf version:" | |
pkg-config --version | |
# Debug Installed Tools for macOS | |
- name: Debug Installed Tools (macOS) | |
if: matrix.config.os == 'macOS-latest' | |
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' | |
# Install Pandoc for Windows | |
- name: Install Pandoc for Windows | |
if: matrix.config.os == 'windows-latest' | |
run: | | |
choco install pandoc -y | |
# Install R dependencies | |
- name: Install R dependencies | |
run: | | |
Rscript -e "if (!requireNamespace('remotes', quietly = TRUE)) install.packages('remotes')" | |
Rscript -e "remotes::install_deps(dependencies = TRUE)" | |
# Run R tests | |
- 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 for Linux/macOS | |
- name: Build the package (Linux/macOS) | |
if: matrix.config.os != 'windows-latest' | |
run: | | |
R CMD build . | |
# Build the package for Windows | |
- name: Build the package (Windows) | |
if: matrix.config.os == 'windows-latest' | |
shell: cmd | |
run: | | |
R CMD build . | |
# Check the package for Linux/macOS | |
- 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 | |
# Debug Build Output for Windows | |
- name: Debug Build Output (Windows) | |
if: matrix.config.os == 'windows-latest' | |
shell: cmd | |
run: | | |
dir /b *.tar.gz || echo "No .tar.gz file found after build" | |
# Check the package for Windows | |
- name: Check the package (Windows) | |
if: matrix.config.os == 'windows-latest' | |
shell: cmd | |
run: | | |
dir /b *.tar.gz > tarball.txt | |
set /p PKG_TAR=<tarball.txt | |
echo Checking package %PKG_TAR% | |
R CMD check %PKG_TAR% --no-manual --as-cran |