Skip to content

R

R #9742

Workflow file for this run

name: R
on:
push:
branches:
- master
- branch-[0-9]+.[0-9]+
pull_request:
schedule:
# Run this workflow daily at 13:00 UTC
- cron: "0 13 * * *"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python
jobs:
r:
runs-on: ubuntu-latest
timeout-minutes: 120
if: github.event_name != 'schedule' || github.repository == 'mlflow/mlflow'
defaults:
run:
shell: bash --noprofile --norc -exo pipefail {0}
working-directory: mlflow/R/mlflow
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
repository: ${{ github.event.inputs.repository }}
ref: ${{ github.event.inputs.ref }}
- uses: ./.github/actions/setup-python
- uses: ./.github/actions/setup-pyenv
- uses: ./.github/actions/setup-java
- uses: r-lib/actions/setup-r@v2
# Note: the version of R released on 4/21/23, 4.3.0, has build issues with devtools.
# Remove this version pin once issues on dependent packages have been fixed.
with:
r-version: "4.2.3"
# This step dumps the current set of R dependencies and R version into files to be used
# as a cache key when caching/restoring R dependencies.
- name: Dump dependencies
run: |
Rscript -e 'source(".dump-r-dependencies.R", echo = TRUE)'
- name: Get OS name
id: os-name
run: |
# `os_name` will be like "Ubuntu-20.04.1-LTS"
os_name=$(lsb_release -ds | sed 's/\s/-/g')
echo "os-name=$os_name" >> $GITHUB_OUTPUT
- name: Cache R packages
uses: actions/cache@v3
continue-on-error: true
# https://github.com/actions/cache/issues/810
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 5
with:
path: ${{ env.R_LIBS_USER }}
# We cache R dependencies based on a tuple of the current OS, the R version, and the list of
# R dependencies
key: ${{ steps.os-name.outputs.os-name }}-${{ hashFiles('mlflow/R/mlflow/R-version') }}-0-${{ hashFiles('mlflow/R/mlflow/depends.Rds') }}
- name: Install dependencies
run: |
Rscript -e 'source(".install-deps.R", echo=TRUE)'
- name: Set USE_R_DEVEL
run: |
if [ "$GITHUB_EVENT_NAME" = "schedule" ]; then
USE_R_DEVEL=true
elif [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
# Use r-devel on a pull request targeted to a release branch
USE_R_DEVEL=$([[ $GITHUB_BASE_REF =~ branch-[0-9]+\.[0-9]+$ ]] && echo true || echo false)
else
# Use r-devel on a push to a release branch
USE_R_DEVEL=$([[ $GITHUB_REF_NAME =~ branch-[0-9]+\.[0-9]+$ ]] && echo true || echo false)
fi
echo "USE_R_DEVEL=$USE_R_DEVEL" >> $GITHUB_ENV
- name: Build package
run: |
./build-package.sh
- name: Create test environment
run: |
pip install -e $(git rev-parse --show-toplevel)
H2O_VERSION=$(Rscript -e "print(packageVersion('h2o'))" | grep -Eo '[0-9][0-9.]+')
pip install xgboost tensorflow "h2o==$H2O_VERSION"
Rscript -e 'source(".install-mlflow-r.R", echo=TRUE)'
- name: Run tests
env:
LINTR_COMMENT_BOT: false
run: |
cd tests
export MLFLOW_HOME=$(git rev-parse --show-toplevel)
Rscript -e 'source("../.run-tests.R", echo=TRUE)'