Skip to content

R

R #26

Workflow file for this run

name: R
on:
push:
branches:
- master
- branch-[0-9]+.[0-9]+
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
schedule:
# Run this workflow daily at 13:00 UTC
- cron: "0 13 * * *"
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
env:
MLFLOW_HOME: /home/runner/work/mlflow/mlflow
jobs:
r:
runs-on: ubuntu-latest
timeout-minutes: 120
if: github.event_name == 'push' || (github.event_name == 'schedule' && github.repository == 'mlflow-automation/mlflow') || (github.event_name == 'pull_request' && github.event.pull_request.draft == false)
defaults:
run:
shell: bash --noprofile --norc -exo pipefail {0}
working-directory: mlflow/R/mlflow
steps:
- uses: actions/checkout@v4
with:
repository: ${{ github.event_name == 'schedule' && 'mlflow/mlflow' || null }}
submodules: recursive
- uses: ./.github/actions/setup-python
- uses: ./.github/actions/setup-pyenv
- uses: ./.github/actions/setup-java
- uses: r-lib/actions/setup-r@v2
# 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@v4
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: |
sudo apt-get install -y libcurl4-openssl-dev libharfbuzz-dev libfribidi-dev
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 $(git rev-parse --show-toplevel)
H2O_VERSION=$(Rscript -e "print(packageVersion('h2o'))" | grep -Eo '[0-9][0-9.]+')
# test-keras-model.R fails with tensorflow>=2.13.0
pip install xgboost 'tensorflow<2.13.0' "h2o==$H2O_VERSION"
Rscript -e 'source(".install-mlflow-r.R", echo=TRUE)'
- name: Run tests
env:
LINTR_COMMENT_BOT: false
run: |
cd tests
Rscript -e 'source("../.run-tests.R", echo=TRUE)'