1name: XGBoost-R-Tests 2 3on: [push, pull_request] 4 5env: 6 R_PACKAGES: c('XML', 'data.table', 'ggplot2', 'DiagrammeR', 'Ckmeans.1d.dp', 'vcd', 'testthat', 'lintr', 'knitr', 'rmarkdown', 'e1071', 'cplm', 'devtools', 'float', 'titanic') 7 GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 8 9jobs: 10 lintr: 11 runs-on: ${{ matrix.config.os }} 12 name: Run R linters on OS ${{ matrix.config.os }}, R ${{ matrix.config.r }}, Compiler ${{ matrix.config.compiler }}, Build ${{ matrix.config.build }} 13 strategy: 14 matrix: 15 config: 16 - {os: windows-latest, r: 'release', compiler: 'mingw', build: 'autotools'} 17 env: 18 R_REMOTES_NO_ERRORS_FROM_WARNINGS: true 19 RSPM: ${{ matrix.config.rspm }} 20 21 steps: 22 - uses: actions/checkout@v2 23 with: 24 submodules: 'true' 25 26 - uses: r-lib/actions/setup-r@master 27 with: 28 r-version: ${{ matrix.config.r }} 29 30 - name: Cache R packages 31 uses: actions/cache@v2 32 with: 33 path: ${{ env.R_LIBS_USER }} 34 key: ${{ runner.os }}-r-${{ matrix.config.r }}-2-${{ hashFiles('R-package/DESCRIPTION') }} 35 restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-2-${{ hashFiles('R-package/DESCRIPTION') }} 36 37 - name: Install dependencies 38 shell: Rscript {0} 39 run: | 40 install.packages(${{ env.R_PACKAGES }}, 41 repos = 'http://cloud.r-project.org', 42 dependencies = c('Depends', 'Imports', 'LinkingTo')) 43 - name: Install igraph on Windows 44 shell: Rscript {0} 45 if: matrix.config.os == 'windows-latest' 46 run: | 47 install.packages('igraph', type='binary') 48 49 - name: Run lintr 50 run: | 51 cd R-package 52 R.exe CMD INSTALL . 53 Rscript.exe tests/helper_scripts/run_lint.R 54 55 test-with-R: 56 runs-on: ${{ matrix.config.os }} 57 name: Test R on OS ${{ matrix.config.os }}, R ${{ matrix.config.r }}, Compiler ${{ matrix.config.compiler }}, Build ${{ matrix.config.build }} 58 strategy: 59 fail-fast: false 60 matrix: 61 config: 62 - {os: windows-2016, r: 'release', compiler: 'mingw', build: 'autotools'} 63 - {os: windows-2016, r: 'release', compiler: 'msvc', build: 'cmake'} 64 - {os: windows-2016, r: 'release', compiler: 'mingw', build: 'cmake'} 65 env: 66 R_REMOTES_NO_ERRORS_FROM_WARNINGS: true 67 RSPM: ${{ matrix.config.rspm }} 68 69 steps: 70 - uses: actions/checkout@v2 71 with: 72 submodules: 'true' 73 74 - uses: r-lib/actions/setup-r@master 75 with: 76 r-version: ${{ matrix.config.r }} 77 78 - name: Cache R packages 79 uses: actions/cache@v2 80 with: 81 path: ${{ env.R_LIBS_USER }} 82 key: ${{ runner.os }}-r-${{ matrix.config.r }}-2-${{ hashFiles('R-package/DESCRIPTION') }} 83 restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-2-${{ hashFiles('R-package/DESCRIPTION') }} 84 85 - name: Install dependencies 86 shell: Rscript {0} 87 run: | 88 install.packages(${{ env.R_PACKAGES }}, 89 repos = 'http://cloud.r-project.org', 90 dependencies = c('Depends', 'Imports', 'LinkingTo')) 91 - name: Install igraph on Windows 92 shell: Rscript {0} 93 if: matrix.config.os == 'windows-2016' 94 run: | 95 install.packages('igraph', type='binary', dependencies = c('Depends', 'Imports', 'LinkingTo')) 96 97 - uses: actions/setup-python@v2 98 with: 99 python-version: '3.7' 100 architecture: 'x64' 101 102 - name: Test R 103 run: | 104 python tests/ci_build/test_r_package.py --compiler='${{ matrix.config.compiler }}' --build-tool='${{ matrix.config.build }}' 105 106 test-R-CRAN: 107 runs-on: ubuntu-latest 108 109 strategy: 110 fail-fast: false 111 matrix: 112 config: 113 - {r: 'release'} 114 115 steps: 116 - uses: actions/checkout@v2 117 with: 118 submodules: 'true' 119 120 - uses: r-lib/actions/setup-r@master 121 with: 122 r-version: ${{ matrix.config.r }} 123 124 - uses: r-lib/actions/setup-tinytex@master 125 126 - name: Install system packages 127 run: | 128 sudo apt-get update && sudo apt-get install libcurl4-openssl-dev libssl-dev libssh2-1-dev libgit2-dev pandoc pandoc-citeproc libglpk-dev 129 130 - name: Cache R packages 131 uses: actions/cache@v2 132 with: 133 path: ${{ env.R_LIBS_USER }} 134 key: ${{ runner.os }}-r-${{ matrix.config.r }}-2-${{ hashFiles('R-package/DESCRIPTION') }} 135 restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-2-${{ hashFiles('R-package/DESCRIPTION') }} 136 137 - name: Install dependencies 138 shell: Rscript {0} 139 run: | 140 install.packages(${{ env.R_PACKAGES }}, 141 repos = 'http://cloud.r-project.org', 142 dependencies = c('Depends', 'Imports', 'LinkingTo')) 143 install.packages('igraph', repos = 'http://cloud.r-project.org', dependencies = c('Depends', 'Imports', 'LinkingTo')) 144 145 - name: Check R Package 146 run: | 147 # Print stacktrace upon success of failure 148 make Rcheck || tests/ci_build/print_r_stacktrace.sh fail 149 tests/ci_build/print_r_stacktrace.sh success 150