122 lines
4.5 KiB
YAML
122 lines
4.5 KiB
YAML
name: R
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- branch-[0-9]+.[0-9]+
|
|
pull_request:
|
|
types:
|
|
- opened
|
|
- synchronize
|
|
- reopened
|
|
paths-ignore:
|
|
- "docs/**"
|
|
- "**.md"
|
|
- "dev/clint/**"
|
|
- ".github/workflows/docs.yml"
|
|
- ".github/workflows/preview-docs.yml"
|
|
- "mlflow/server/js/**"
|
|
- ".github/workflows/js.yml"
|
|
- ".claude/**"
|
|
schedule:
|
|
# Run this workflow daily at 13:00 UTC
|
|
- cron: "0 13 * * *"
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
env:
|
|
MLFLOW_HOME: ${{ github.workspace }}
|
|
PIP_CONSTRAINT: ${{ github.workspace }}/requirements/constraints.txt
|
|
|
|
permissions: {}
|
|
|
|
jobs:
|
|
r:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 120
|
|
permissions:
|
|
contents: read
|
|
if: (github.event_name == 'push' || (github.event_name == 'schedule' && github.repository == 'mlflow/dev') || (github.event_name == 'pull_request' && (github.event.pull_request.draft == false || github.event.pull_request.user.login == 'Copilot' && github.event.pull_request.user.type == 'Bot')))
|
|
defaults:
|
|
run:
|
|
working-directory: mlflow/R/mlflow
|
|
steps:
|
|
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
with:
|
|
persist-credentials: false
|
|
repository: ${{ github.event_name == 'schedule' && 'mlflow/mlflow' || null }}
|
|
- uses: ./.github/actions/setup-python
|
|
- uses: ./.github/actions/setup-pyenv
|
|
- uses: ./.github/actions/setup-java
|
|
- uses: r-lib/actions/setup-r@a51a8012b0aab7c32ef9d19bf54da93f3254335e # v2.12.0
|
|
# 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@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
|
|
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
|
|
env:
|
|
HAS_R_DEVEL_LABEL: ${{ contains(github.event.pull_request.labels.*.name, '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 or with the "r-devel" label
|
|
if [[ $GITHUB_BASE_REF =~ branch-[0-9]+\.[0-9]+$ ]] || [ "$HAS_R_DEVEL_LABEL" = "true" ]; then
|
|
USE_R_DEVEL=true
|
|
else
|
|
USE_R_DEVEL=false
|
|
fi
|
|
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: |
|
|
uv pip install --system $(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
|
|
uv pip install --system xgboost 'tensorflow<2.13.0' "h2o==$H2O_VERSION" "pydantic<3,>=1.0" "typing_extensions>=4.6.0"
|
|
Rscript -e 'source(".install-mlflow-r.R", echo=TRUE)'
|
|
- name: Run tests
|
|
env:
|
|
LINTR_COMMENT_BOT: false
|
|
# TODO: Migrate R tests to use a SQLite backend instead of FileStore
|
|
MLFLOW_ALLOW_FILE_STORE: true
|
|
run: |
|
|
cd tests
|
|
export RETICULATE_PYTHON_BIN=$(which python)
|
|
export MLFLOW_SERVER_ENABLE_JOB_EXECUTION=false
|
|
Rscript -e 'source("../.run-tests.R", echo=TRUE)'
|