Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify building rcmd matrix #192

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 25 additions & 22 deletions .github/workflows/r-cmd-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ on:
required: false
default: note
type: string
include-devel:
description: 'Set to true to include devel in the matrix for every run.'
required: false
default: false
type: boolean
push:
branches:
- main
Expand All @@ -23,7 +28,24 @@ concurrency:
cancel-in-progress: true

jobs:
set-matrix:
runs-on: ubuntu-latest
name: Create R CMD Check matrix
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Set job matrix
id: set-matrix
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" || "${{ inputs.include-devel }}" == "true" ]]; then
echo "matrix={\"r_version\":[\"release\",\"devel\",\"oldrel\"]}" >> $GITHUB_OUTPUT
else
echo "matrix={\"r_version\":[\"release\",\"oldrel\"]}" >> $GITHUB_OUTPUT
fi
shell: bash

R-CMD-check:
needs: set-matrix
runs-on: ubuntu-latest
container:
image: "ghcr.io/pharmaverse/admiralci-${{ matrix.r_version }}:latest"
Expand All @@ -32,8 +54,7 @@ jobs:
!contains(github.event.commits[0].message, '[skip r-cmd-check]')
strategy:
fail-fast: false
matrix:
r_version: ['release', 'devel', 'oldrel']
matrix: ${{ fromJSON(needs.set-matrix.outputs.matrix) }}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -51,7 +72,7 @@ jobs:
staged.dependencies

# DEPS_IGNORE: env variable to ignore package when building renv.lock (step Upload dependencies artifact)
# (improvments ideas : get this list of deps to ignore from staged.dependencies yml file)
# (improvements ideas : get this list of deps to ignore from staged.dependencies yml file)

steps:
##################### BEGIN boilerplate steps #####################
Expand Down Expand Up @@ -83,9 +104,6 @@ jobs:

- name: Run Staged dependencies
uses: insightsengineering/staged-dependencies-action@v1
if: |
(github.event_name == 'workflow_dispatch' && matrix.r_version == 'devel') ||
matrix.r_version != 'devel'
with:
run-system-dependencies: false
renv-restore: false
Expand All @@ -96,19 +114,13 @@ jobs:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

- name: Install dependencies from DESCRIPTION
if: |
(github.event_name == 'workflow_dispatch' && matrix.r_version == 'devel') ||
matrix.r_version != 'devel'
run: |
remotes::install_local(force = TRUE, dependencies = TRUE)
shell: Rscript {0}

##################### END boilerplate steps #####################

- name: Upload dependencies artifact
if: |
(github.event_name == 'workflow_dispatch' && matrix.r_version == 'devel') ||
matrix.r_version != 'devel'
run: |
dir.create("/workspace/tmp")
library(dplyr)
Expand Down Expand Up @@ -171,19 +183,13 @@ jobs:

- name: Upload deps.csv and renv.lock artifacts
uses: actions/upload-artifact@v4
if: |
(github.event_name == 'workflow_dispatch' && matrix.r_version == 'devel') ||
matrix.r_version != 'devel'
with:
name: deps-${{ matrix.r_version }}
path: |
/workspace/tmp/

- name: Check Version
id: check_version
if: |
(github.event_name == 'workflow_dispatch' && matrix.r_version == 'devel') ||
matrix.r_version != 'devel'
run: |
maintenance_version="F"
description_dat <- readLines("DESCRIPTION")
Expand All @@ -202,9 +208,6 @@ jobs:
shell: Rscript {0}

- name: Check
if: |
(github.event_name == 'workflow_dispatch' && matrix.r_version == 'devel') ||
matrix.r_version != 'devel'
env:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
_R_CHECK_FORCE_SUGGESTS_: false
Expand All @@ -231,4 +234,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: r${{ matrix.r_version }}-results
path: check
path: check
Loading