From 0070babebbf2c7d55315b142b6f2771d3c2bc84b Mon Sep 17 00:00:00 2001 From: James Lamb Date: Mon, 1 Jun 2020 23:53:39 +0100 Subject: [PATCH] [ci] use GitHub Actions for R CI jobs (fixes #2353) (#3119) * GitHub Actions * ok * fixing on list * stuff * directories * directories * things * env variables * working dir * running a bunch of tasks * more builds * PATH * actually use R task * TASK * be right, often * doing stuff * trying stuff * more paths * conda activate * updating PATH * trying bash * where the hell is activate * WHERE IS ACTIVATE * set up conda * more conda * PLEASE WORK * installing cpplint * try r-package * R version * try windows job * make windows work * use powershell * exe * use conda * conda init powershell * different conda approach * make it work * cleaning up * init powershell * fixing windows * more windows * build directory * no way right * maybe it will work * trying Visual Studio * do this * Windows is interesting * put back check-output * set compiler * stuff * more fixes * fix the broken things * updating jobs * continuing * poweshell is bad * ok so maybe not powershell * cmon now * ok so * fixing env variables * maybe this * MINGW job * cleaning up * conda init powershell * moving more R stuff into GitHub Actions * everything else * use powershell * cmon now powershell * ttry to Continue * override powershell * peg MiKTeX URL * what is happening * try powershell -File * trying stuff * path * more testing of output * Matches uppercase * more regex stuff * this is getting ridiculous * back to powershell I guess * more commands * this might work * adding more reliable miktex download * trying to download miktex * installing httr * fix error in MiKTeX script * remove comments * redirect output * redirect output * move linting back to Travis * change redirection * switch back to just mac and linux * put linting exclude back * renamed R_TRAVIS_LINUX * revert changes to non-R tasks and update events * simplify --- .ci/setup.sh | 4 +-- .ci/test_r_package.sh | 4 +-- .github/workflows/main.yml | 57 ++++++++++++++++++++++++++++++++++++++ .travis.yml | 3 -- .vsts-ci.yml | 9 ++---- 5 files changed, 63 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/main.yml diff --git a/.ci/setup.sh b/.ci/setup.sh index 0c4101189346..73adee173ca8 100755 --- a/.ci/setup.sh +++ b/.ci/setup.sh @@ -36,12 +36,12 @@ else # Linux mv $AMDAPPSDK_PATH/lib/x86_64/sdk/* $AMDAPPSDK_PATH/lib/x86_64/ echo libamdocl64.so > $OPENCL_VENDOR_PATH/amdocl64.icd fi - if [[ $TRAVIS == "true" ]]; then + if [[ $TRAVIS == "true" ]] || [[ $GITHUB_ACTIONS == "true" ]]; then wget -q -O conda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh fi fi -if [[ $TRAVIS == "true" ]] || [[ $OS_NAME == "macos" ]]; then +if [[ $TRAVIS == "true" ]] || [[ $GITHUB_ACTIONS == "true" ]] || [[ $OS_NAME == "macos" ]]; then sh conda.sh -b -p $CONDA fi conda config --set always_yes yes --set changeps1 no diff --git a/.ci/test_r_package.sh b/.ci/test_r_package.sh index fcd515d23c18..5fb35bb887b1 100755 --- a/.ci/test_r_package.sh +++ b/.ci/test_r_package.sh @@ -13,7 +13,7 @@ export PATH="$R_LIB_PATH/R/bin:$PATH" # # This only needs to get run on Travis because R environment for Linux # used by Azure pipelines is set up in https://github.com/guolinke/lightgbm-ci-docker -if [[ $TRAVIS == "true" ]] && [[ $OS_NAME == "linux" ]]; then +if [[ $AZURE != "true" ]] && [[ $OS_NAME == "linux" ]]; then sudo apt-key adv \ --keyserver keyserver.ubuntu.com \ --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 @@ -23,7 +23,7 @@ if [[ $TRAVIS == "true" ]] && [[ $OS_NAME == "linux" ]]; then sudo apt-get install \ --no-install-recommends \ -y \ - r-base-dev=${R_TRAVIS_LINUX_VERSION} \ + r-base-dev=${R_LINUX_VERSION} \ texinfo \ texlive-latex-recommended \ texlive-fonts-recommended \ diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000000..eefebe2a9cb2 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,57 @@ +name: GitHub Actions + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + test: + name: ${{ matrix.task }} (${{ matrix.os }}, ${{ matrix.compiler }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + task: r-package + compiler: gcc + - os: ubuntu-latest + task: r-package + compiler: clang + - os: macOS-latest + task: r-package + compiler: gcc + - os: macOS-latest + task: r-package + compiler: clang + steps: + - name: Checkout repository + uses: actions/checkout@v1 + with: + fetch-depth: 5 + submodules: true + - name: Setup and run tests on Linux and macOS + if: matrix.os != 'windows-latest' + shell: bash + run: | + export TASK="${{ matrix.task }}" + export COMPILER="${{ matrix.compiler }}" + export GITHUB_ACTIONS="true" + if [[ "${{ matrix.os }}" == "macOS-latest" ]]; then + export OS_NAME="macos" + export R_MAC_VERSION=3.6.3 + elif [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then + export OS_NAME="linux" + export R_LINUX_VERSION=3.6.3-1bionic; + fi + export BUILD_DIRECTORY="$GITHUB_WORKSPACE" + export CONDA_ENV="test-env" + export CONDA="$HOME/miniconda" + export PATH="$CONDA/bin:${HOME}/.local/bin:$PATH" + export LGB_VER=$(head -n 1 VERSION.txt) + $GITHUB_WORKSPACE/.ci/setup.sh + $GITHUB_WORKSPACE/.ci/test.sh diff --git a/.travis.yml b/.travis.yml index 44cd1f6b00f0..c1604000e98d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,6 @@ env: - TASK=mpi METHOD=pip PYTHON_VERSION=3.7 - TASK=gpu METHOD=source PYTHON_VERSION=3.5 - TASK=gpu METHOD=pip PYTHON_VERSION=3.6 - - TASK=r-package matrix: exclude: @@ -44,11 +43,9 @@ before_install: - if [[ $TRAVIS_OS_NAME == "osx" ]]; then export OS_NAME="macos"; export COMPILER="gcc"; - export R_MAC_VERSION=3.6.3; else export OS_NAME="linux"; export COMPILER="clang"; - export R_TRAVIS_LINUX_VERSION=3.6.3-1bionic; fi - export CONDA="$HOME/miniconda" - export PATH="$CONDA/bin:$PATH" diff --git a/.vsts-ci.yml b/.vsts-ci.yml index 906165d89a4d..7c4e71d2eb30 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -22,7 +22,7 @@ jobs: vmImage: 'ubuntu-latest' container: ubuntu1404 strategy: - maxParallel: 7 + maxParallel: 6 matrix: regular: TASK: regular @@ -41,8 +41,6 @@ jobs: TASK: gpu METHOD: source PYTHON_VERSION: 3.6 - r_package: - TASK: r-package steps: - script: | echo "##vso[task.setvariable variable=BUILD_DIRECTORY]$BUILD_SOURCESDIRECTORY" @@ -74,7 +72,7 @@ jobs: pool: vmImage: 'macOS-10.14' strategy: - maxParallel: 4 + maxParallel: 3 matrix: regular: TASK: regular @@ -84,8 +82,6 @@ jobs: PYTHON_VERSION: 3.5 bdist: TASK: bdist - r_package: - TASK: r-package steps: - script: | echo "##vso[task.setvariable variable=BUILD_DIRECTORY]$BUILD_SOURCESDIRECTORY" @@ -96,7 +92,6 @@ jobs: echo "##vso[task.setvariable variable=CONDA]$CONDA" echo "##vso[task.prependpath]$CONDA/bin" echo "##vso[task.setvariable variable=JAVA_HOME]$JAVA_HOME_8_X64" - echo "##vso[task.setvariable variable=R_MAC_VERSION]3.6.3" displayName: 'Set variables' - bash: $(Build.SourcesDirectory)/.ci/setup.sh displayName: Setup