Skip to content

r-universe install and badge (#195) #405

r-universe install and badge (#195)

r-universe install and badge (#195) #405

Workflow file for this run

name: RPackage
# installs/builds the R package on windows, ubuntu, macOs
# produces package archives for each os
# - do not require compilation by windows and macOs users (not tested on mac)
# - are output as artifacts
# runs `R CMD check` on the package
# if the last commit message includes "[lint]", runs `lintr::lint_package()`
on: [push, pull_request]
jobs:
build:
timeout-minutes: 30
strategy:
fail-fast: false # continue if one os fails
matrix:
include:
- os: windows-latest
extension_out: .*\.zip
r_cmd: Rcmd
- os: ubuntu-latest
extension_out: .*\.tar\.gz
r_cmd: R CMD
- os: macos-latest
extension_out: .*\.tgz
r_cmd: R CMD
runs-on: ${{ matrix.os }}
env:
EXTENSION_IN: "*.tar.gz" # wildcards as used by R CMD
EXTENSION_OUT: ${{ matrix.extension_out }} # wildcards as used by grep
RCMD: ${{ matrix.r_cmd }}
PKG_NAME: vscDebugger
defaults:
run:
shell: bash
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup R
uses: r-lib/actions/setup-r@v2
- name: Install Dependencies
run: |
Rscript -e "install.packages('remotes', repos = 'https://cloud.r-project.org')"
Rscript -e "remotes::install_deps(dependencies = TRUE)"
- name: Setup Pandoc
uses: r-lib/actions/setup-pandoc@v2
- name: Build Package
run: $RCMD build .
- name: Compile Code
run: $RCMD INSTALL $PKG_NAME$EXTENSION_IN --build
- name: Identify output file # can be retrieved as steps.filenames.outputs.file_out
id: filenames
run: echo "file_out=$(ls | grep $PKG_NAME$EXTENSION_OUT | head -1)" >> $GITHUB_OUTPUT
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.filenames.outputs.file_out }}
path: ${{ steps.filenames.outputs.file_out }}
rcmdcheck:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup R
uses: r-lib/actions/setup-r@v2
- name: Setup Pandoc
uses: r-lib/actions/setup-pandoc@v2
- name: Install apt package
run: sudo apt-get install libcurl4-openssl-dev
- name: Install packages
run: |
Rscript -e "install.packages(c('remotes', 'rcmdcheck'), repos = 'https://cloud.r-project.org')"
Rscript -e "remotes::install_deps(dependencies = TRUE)"
- name: Run R CMD check
run: Rscript -e "rcmdcheck::rcmdcheck(args = c('--as-cran', '--no-manual', '--timings'), error_on = 'error')"
lint:
if: contains(github.event.head_commit.message, '[lint]') # disabled by default
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup R
uses: r-lib/actions/setup-r@v2
- name: Install libcurl # required to install lintr
run: sudo apt-get install libcurl4-openssl-dev
- name: Install packages
run: Rscript -e "install.packages('lintr', repos = 'https://cloud.r-project.org')"
- name: Run lintr
run: Rscript -e "lintr::lint_package()"