diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 84f71de9fe61..1bad8ff8516f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,7 +7,7 @@ name: XGBoost-CI on: [push, pull_request] env: - R_PACKAGES: c('XML', 'igraph', 'data.table', 'magrittr', 'stringi', 'ggplot2', 'DiagrammeR', 'Ckmeans.1d.dp', 'vcd', 'testthat', 'lintr', 'knitr', 'rmarkdown', 'e1071', 'cplm', 'devtools', 'float') + R_PACKAGES: c('XML', 'igraph', 'data.table', 'magrittr', 'ggplot2', 'DiagrammeR', 'Ckmeans.1d.dp', 'vcd', 'testthat', 'lintr', 'knitr', 'rmarkdown', 'e1071', 'cplm', 'devtools', 'float', 'titanic') # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: @@ -77,7 +77,7 @@ jobs: - name: Install system packages run: | sudo apt-get install -y --no-install-recommends ninja-build - - uses: conda-incubator/setup-miniconda@v1 + - uses: conda-incubator/setup-miniconda@v2 with: auto-update-conda: true python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/r_nold.yml b/.github/workflows/r_nold.yml new file mode 100644 index 000000000000..21d7fd8756ca --- /dev/null +++ b/.github/workflows/r_nold.yml @@ -0,0 +1,44 @@ +# Run R tests with noLD R. Only triggered by a pull request review +# See discussion at https://github.com/dmlc/xgboost/pull/6378 + +name: XGBoost-R-noLD + +on: + pull_request_review_comment: + types: [created] + +env: + R_PACKAGES: c('XML', 'igraph', 'data.table', 'magrittr', 'ggplot2', 'DiagrammeR', 'Ckmeans.1d.dp', 'vcd', 'testthat', 'lintr', 'knitr', 'rmarkdown', 'e1071', 'cplm', 'devtools', 'float', 'titanic') + +jobs: + test-R-noLD: + if: github.event.comment.body == '/gha run r-nold-test' && contains('OWNER,MEMBER,COLLABORATOR', github.event.comment.author_association) + timeout-minutes: 120 + runs-on: ubuntu-latest + container: rhub/debian-gcc-devel-nold + steps: + - name: Install git and system packages + shell: bash + run: | + apt-get update && apt-get install -y git libcurl4-openssl-dev libssl-dev libssh2-1-dev libgit2-dev libxml2-dev + + - uses: actions/checkout@v2 + with: + submodules: 'true' + + - name: Install dependencies + shell: bash + run: | + cat > install_libs.R <= 1.0.1), jsonlite, float, - crayon + crayon, + titanic Depends: R (>= 3.3.0) Imports: diff --git a/R-package/tests/testthat/test_callbacks.R b/R-package/tests/testthat/test_callbacks.R index 913eed896a6b..69894bd05181 100644 --- a/R-package/tests/testthat/test_callbacks.R +++ b/R-package/tests/testthat/test_callbacks.R @@ -2,6 +2,7 @@ require(xgboost) require(data.table) +require(titanic) context("callbacks") @@ -254,6 +255,26 @@ test_that("early stopping using a specific metric works", { expect_equal(logloss_log, logloss_pred, tolerance = 1e-5) }) +test_that("early stopping works with titanic", { + # This test was inspired by https://github.com/dmlc/xgboost/issues/5935 + # It catches possible issues on noLD R + titanic <- titanic::titanic_train + titanic$Pclass <- as.factor(titanic$Pclass) + dtx <- model.matrix(~ 0 + ., data = titanic[, c("Pclass", "Sex")]) + dty <- titanic$Survived + + xgboost::xgboost( + data = dtx, + label = dty, + objective = "binary:logistic", + eval_metric = "auc", + nrounds = 100, + early_stopping_rounds = 3 + ) + + expect_true(TRUE) # should not crash +}) + test_that("early stopping xgb.cv works", { set.seed(11) expect_output( diff --git a/doc/contrib/ci.rst b/doc/contrib/ci.rst new file mode 100644 index 000000000000..642571199e7a --- /dev/null +++ b/doc/contrib/ci.rst @@ -0,0 +1,27 @@ +#################################### +Automated testing in XGBoost project +#################################### + +This document collects tips for using the Continuous Integration (CI) service of the XGBoost +project. + +**Contents** + +.. contents:: + :backlinks: none + :local: + +************** +GitHub Actions +************** +The configuration files are located under the directory +`.github/workflows `_. + +Most of the tests listed in the configuration files run automatically for every incoming pull +requests and every update to branches. A few tests however require manual activation: + +* R tests with ``noLD`` option: Run R tests using a custom-built R with compilation flag + ``--disable-long-double``. See `this page `_ for more + details about noLD. This is a requirement for keeping XGBoost on CRAN (the R package index). + To invoke this test suite for a particular pull request, simply add a review comment + ``/gha run r-nold-test``. (Ordinary comment won't work. It needs to be a review comment.) diff --git a/doc/contrib/index.rst b/doc/contrib/index.rst index afc6fff69317..c9c5f93a2e8b 100644 --- a/doc/contrib/index.rst +++ b/doc/contrib/index.rst @@ -27,3 +27,4 @@ Here are guidelines for contributing to various aspect of the XGBoost project: Docs and Examples git_guide release + ci