Skip to content

Add new main CI workflow #285

Add new main CI workflow

Add new main CI workflow #285

Workflow file for this run

# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
on:
schedule:
- cron: "0 0 * * *"
push:
branches:
- main
- master
- devel
pull_request:
branches:
- main
- master
workflow_dispatch:
name: R-CMD-check
jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
strategy:
fail-fast: false
matrix:
config:
- {os: windows-2022, r: 'release'}
- {os: macOS-12, r: 'release'}
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout pharmr
uses: actions/checkout@v3
with:
path: pharmr_repo
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
- uses: r-lib/actions/setup-pandoc@v2
- name: Query dependencies
working-directory: pharmr_repo
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}
- uses: actions/setup-python@v2
with:
python-version: "3.11"
- name: Restore R package cache
if: runner.os != 'Windows'
uses: actions/cache@v2
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
working-directory: pharmr_repo
if: runner.os == 'Linux'
run: |
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')
sudo apt install libcurl4-openssl-dev
- name: Install png (temporary)
working-directory: pharmr_repo
if: runner.os == 'Windows'
run: |
install.packages('png', repos='https://mran.microsoft.com/snapshot/2022-11-27')
shell: Rscript {0}
- name: Install R dependencies
working-directory: pharmr_repo
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
install.packages('reticulate')
shell: Rscript {0}
- name: Install pharmr
working-directory: pharmr_repo
run: |
remotes::install_local(force=TRUE)
shell: Rscript {0}
- name: Install miniconda
run: |
Sys.setenv(RETICULATE_MINICONDA_PYTHON_VERSION="3.9")
reticulate::install_miniconda()
shell: Rscript {0}
- name: Install Pharmpy
run: |
pharmr::install_pharmpy()
shell: Rscript {0}
- name: Check (as cran)
working-directory: pharmr_repo
env:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
run: |
options(crayon.enabled = TRUE)
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}
- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results-cran
path: check
- name: Check (to run python)
working-directory: pharmr_repo
run: |
options(crayon.enabled = TRUE)
rcmdcheck::rcmdcheck(args = c("--no-manual"), error_on = "warning", check_dir = "check")
shell: Rscript {0}
- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check