From 7dc6835f16cdf39ced61430cbf2edebf52f33af0 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 10 Jan 2021 09:09:37 -0600 Subject: [PATCH 01/12] [ci] move Python Mac jobs from Travis to GitHub Actions --- .github/workflows/python_package.yml | 73 ++++++++++++++++++++++++++++ .travis.yml | 20 +------- 2 files changed, 75 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/python_package.yml diff --git a/.github/workflows/python_package.yml b/.github/workflows/python_package.yml new file mode 100644 index 000000000000..8a774f3b8e43 --- /dev/null +++ b/.github/workflows/python_package.yml @@ -0,0 +1,73 @@ +name: Python-package + +on: + push: + branches: + - master + pull_request: + branches: + - master + +env: + CONDA_ENV: test-env + COMPILER: gcc + GITHUB_ACTIONS: 'true' + OS_NAME: 'macOS-latest' + +jobs: + test: + name: ${{ matrix.task }} (${{ matrix.os }}, ${{ matrix.compiler }}, Python ${{ matrix.python_version }}) + runs-on: ${{ matrix.os }} + timeout-minutes: 60 + strategy: + os: macOS-latest + fail-fast: false + matrix: + include: + - task: regular + python_version: 3.7 + - task: sdist + python_version: 3.8 + - task: bdist + python_version: 3.8 + - task: if-else + python_version: 3.8 + - task: mpi + method: source + python_version: 3.8 + - task: mpi + method: pip + python_version: 3.7 + - task: mpi + method: wheel + python_version: 3.7 + steps: + - name: Checkout repository + uses: actions/checkout@v2.3.4 + with: + fetch-depth: 5 + submodules: true + - name: Setup and run tests + shell: bash + run: | + export TASK="${{ matrix.task }}" + export METHOD="${{ matrix.method }}" + export COMPILER="${{ matrix.compiler }}" + export PYTHON_VERSION="${{ matrix.python_version }}" + export AMDAPPSDK_PATH=$HOME/AMDAPPSDK + export LD_LIBRARY_PATH="$AMDAPPSDK_PATH/lib/x86_64:$LD_LIBRARY_PATH" + export LD_LIBRARY_PATH="/usr/local/clang/lib:$LD_LIBRARY_PATH" # fix error "libomp.so: cannot open shared object file: No such file or directory" on Linux with Clang + export OPENCL_VENDOR_PATH=$AMDAPPSDK_PATH/etc/OpenCL/vendors + export BUILD_DIRECTORY="$GITHUB_WORKSPACE" + export LGB_VER=$(head -n 1 VERSION.txt) + export CONDA=${HOME}/miniconda + export PATH=${CONDA}/bin:${PATH} + $GITHUB_WORKSPACE/.ci/setup.sh || exit -1 + $GITHUB_WORKSPACE/.ci/test.sh || exit -1 + all-successful: + # https://github.community/t/is-it-possible-to-require-all-github-actions-tasks-to-pass-without-enumerating-them/117957/4?u=graingert + runs-on: ubuntu-latest + needs: [test] + steps: + - name: Note that all tests succeeded + run: echo "🎉" diff --git a/.travis.yml b/.travis.yml index 82e5de10c653..05188fdb4b0e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,13 +8,13 @@ git: os: - linux - - osx dist: focal -osx_image: xcode12.2 env: global: # default values + - COMPILER=clang - PYTHON_VERSION=3.8 + - OS_NAME=linux matrix: - TASK=regular PYTHON_VERSION=3.6 - TASK=sdist @@ -27,26 +27,10 @@ env: - TASK=gpu METHOD=pip PYTHON_VERSION=3.6 - TASK=gpu METHOD=wheel PYTHON_VERSION=3.7 -matrix: - exclude: - - os: osx - env: TASK=gpu METHOD=source - - os: osx - env: TASK=gpu METHOD=pip PYTHON_VERSION=3.6 - - os: osx - env: TASK=gpu METHOD=wheel PYTHON_VERSION=3.7 - before_install: - test -n $CC && unset CC - test -n $CXX && unset CXX - export BUILD_DIRECTORY="$TRAVIS_BUILD_DIR" - - if [[ $TRAVIS_OS_NAME == "osx" ]]; then - export OS_NAME="macos"; - export COMPILER="gcc"; - else - export OS_NAME="linux"; - export COMPILER="clang"; - fi - export CONDA="$HOME/miniconda" - export PATH="$CONDA/bin:$PATH" - export CONDA_ENV="test-env" From ba0df6f69381e3543cf8cf2fe1d7fe1086c19ed9 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 10 Jan 2021 09:12:53 -0600 Subject: [PATCH 02/12] alphabetize --- .github/workflows/python_package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python_package.yml b/.github/workflows/python_package.yml index 8a774f3b8e43..a6751a1aedf0 100644 --- a/.github/workflows/python_package.yml +++ b/.github/workflows/python_package.yml @@ -9,8 +9,8 @@ on: - master env: - CONDA_ENV: test-env COMPILER: gcc + CONDA_ENV: test-env GITHUB_ACTIONS: 'true' OS_NAME: 'macOS-latest' From 7330c24917c41358817638d32837d63d55d49842 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 10 Jan 2021 09:14:56 -0600 Subject: [PATCH 03/12] fix workflow --- .github/workflows/python_package.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python_package.yml b/.github/workflows/python_package.yml index a6751a1aedf0..80594d411757 100644 --- a/.github/workflows/python_package.yml +++ b/.github/workflows/python_package.yml @@ -16,11 +16,10 @@ env: jobs: test: - name: ${{ matrix.task }} (${{ matrix.os }}, ${{ matrix.compiler }}, Python ${{ matrix.python_version }}) - runs-on: ${{ matrix.os }} + name: ${{ matrix.os }}, ${{ matrix.compiler }}, Python ${{ matrix.python_version }} + runs-on: macOS-latest timeout-minutes: 60 strategy: - os: macOS-latest fail-fast: false matrix: include: From 0e1f0ac6cf04a3d9d660f950ed0b853f4fc94e4a Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 10 Jan 2021 09:16:50 -0600 Subject: [PATCH 04/12] fix name --- .github/workflows/python_package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python_package.yml b/.github/workflows/python_package.yml index 80594d411757..6a5fb0711af9 100644 --- a/.github/workflows/python_package.yml +++ b/.github/workflows/python_package.yml @@ -16,7 +16,7 @@ env: jobs: test: - name: ${{ matrix.os }}, ${{ matrix.compiler }}, Python ${{ matrix.python_version }} + name: macOS-latest, gcc, Python ${{ matrix.python_version }} runs-on: macOS-latest timeout-minutes: 60 strategy: From ffd7c778a1baab2f9101e4da7d896f715f7e2b9f Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 10 Jan 2021 09:18:20 -0600 Subject: [PATCH 05/12] fix os --- .github/workflows/python_package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python_package.yml b/.github/workflows/python_package.yml index 6a5fb0711af9..e423722e9602 100644 --- a/.github/workflows/python_package.yml +++ b/.github/workflows/python_package.yml @@ -12,11 +12,11 @@ env: COMPILER: gcc CONDA_ENV: test-env GITHUB_ACTIONS: 'true' - OS_NAME: 'macOS-latest' + OS_NAME: 'macos' jobs: test: - name: macOS-latest, gcc, Python ${{ matrix.python_version }} + name: ${{ matrix.task }} (macOS-latest, gcc, Python ${{ matrix.python_version }}) runs-on: macOS-latest timeout-minutes: 60 strategy: From ea5a3c2151727674654b1c3b8ab3d4bac6712ee3 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 10 Jan 2021 09:32:19 -0600 Subject: [PATCH 06/12] new workflow --- .github/workflows/python_package.yml | 41 ++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/.github/workflows/python_package.yml b/.github/workflows/python_package.yml index e423722e9602..fc7c6fdecc70 100644 --- a/.github/workflows/python_package.yml +++ b/.github/workflows/python_package.yml @@ -9,37 +9,49 @@ on: - master env: - COMPILER: gcc CONDA_ENV: test-env GITHUB_ACTIONS: 'true' - OS_NAME: 'macos' jobs: test: - name: ${{ matrix.task }} (macOS-latest, gcc, Python ${{ matrix.python_version }}) - runs-on: macOS-latest + name: ${{ matrix.task }} (${{ matrix.os }}, ${{ matrix.compiler }}, Python ${{ matrix.python_version }}) + runs-on: ${{ matrix.os }} timeout-minutes: 60 strategy: fail-fast: false matrix: include: - - task: regular + - os: macOS-latest + task: regular python_version: 3.7 - - task: sdist + compiler: gcc + - os: macOS-latest + task: sdist python_version: 3.8 - - task: bdist + compiler: gcc + - os: macOS-latest + task: bdist python_version: 3.8 - - task: if-else + compiler: gcc + - os: macOS-latest + task: if-else python_version: 3.8 - - task: mpi + compiler: gcc + - os: macOS-latest + task: mpi method: source python_version: 3.8 - - task: mpi + compiler: gcc + - os: macOS-latest + task: mpi method: pip python_version: 3.7 - - task: mpi + compiler: gcc + - os: macOS-latest + task: mpi method: wheel python_version: 3.7 + compiler: gcc steps: - name: Checkout repository uses: actions/checkout@v2.3.4 @@ -53,6 +65,11 @@ jobs: export METHOD="${{ matrix.method }}" export COMPILER="${{ matrix.compiler }}" export PYTHON_VERSION="${{ matrix.python_version }}" + if [[ "${{ matrix.os }}" == "macOS-latest" ]]; then + export OS_NAME="macos" + elif [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then + export OS_NAME="linux" + fi export AMDAPPSDK_PATH=$HOME/AMDAPPSDK export LD_LIBRARY_PATH="$AMDAPPSDK_PATH/lib/x86_64:$LD_LIBRARY_PATH" export LD_LIBRARY_PATH="/usr/local/clang/lib:$LD_LIBRARY_PATH" # fix error "libomp.so: cannot open shared object file: No such file or directory" on Linux with Clang @@ -69,4 +86,4 @@ jobs: needs: [test] steps: - name: Note that all tests succeeded - run: echo "🎉" + run: echo "🎉" \ No newline at end of file From 1fdd46082e24688d992a435d62ed32ac449a64e5 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 10 Jan 2021 10:52:25 -0600 Subject: [PATCH 07/12] Apply suggestions from code review Co-authored-by: Nikita Titov --- .github/workflows/python_package.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/python_package.yml b/.github/workflows/python_package.yml index fc7c6fdecc70..d434667127e9 100644 --- a/.github/workflows/python_package.yml +++ b/.github/workflows/python_package.yml @@ -14,7 +14,7 @@ env: jobs: test: - name: ${{ matrix.task }} (${{ matrix.os }}, ${{ matrix.compiler }}, Python ${{ matrix.python_version }}) + name: ${{ matrix.task }} ${{ matrix.method }} (${{ matrix.os }}, ${{ matrix.compiler }}, Python ${{ matrix.python_version }}) runs-on: ${{ matrix.os }} timeout-minutes: 60 strategy: @@ -23,7 +23,7 @@ jobs: include: - os: macOS-latest task: regular - python_version: 3.7 + python_version: 3.6 compiler: gcc - os: macOS-latest task: sdist @@ -45,7 +45,7 @@ jobs: - os: macOS-latest task: mpi method: pip - python_version: 3.7 + python_version: 3.6 compiler: gcc - os: macOS-latest task: mpi @@ -70,10 +70,6 @@ jobs: elif [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then export OS_NAME="linux" fi - export AMDAPPSDK_PATH=$HOME/AMDAPPSDK - export LD_LIBRARY_PATH="$AMDAPPSDK_PATH/lib/x86_64:$LD_LIBRARY_PATH" - export LD_LIBRARY_PATH="/usr/local/clang/lib:$LD_LIBRARY_PATH" # fix error "libomp.so: cannot open shared object file: No such file or directory" on Linux with Clang - export OPENCL_VENDOR_PATH=$AMDAPPSDK_PATH/etc/OpenCL/vendors export BUILD_DIRECTORY="$GITHUB_WORKSPACE" export LGB_VER=$(head -n 1 VERSION.txt) export CONDA=${HOME}/miniconda @@ -86,4 +82,4 @@ jobs: needs: [test] steps: - name: Note that all tests succeeded - run: echo "🎉" \ No newline at end of file + run: echo "🎉" From 1b6f357b33a6df1e0639c66f1952ea17e3350b01 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 10 Jan 2021 10:54:21 -0600 Subject: [PATCH 08/12] changes from code review --- .github/workflows/python_package.yml | 9 ++------- README.md | 1 + 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/python_package.yml b/.github/workflows/python_package.yml index d434667127e9..ed8217379493 100644 --- a/.github/workflows/python_package.yml +++ b/.github/workflows/python_package.yml @@ -24,34 +24,27 @@ jobs: - os: macOS-latest task: regular python_version: 3.6 - compiler: gcc - os: macOS-latest task: sdist python_version: 3.8 - compiler: gcc - os: macOS-latest task: bdist python_version: 3.8 - compiler: gcc - os: macOS-latest task: if-else python_version: 3.8 - compiler: gcc - os: macOS-latest task: mpi method: source python_version: 3.8 - compiler: gcc - os: macOS-latest task: mpi method: pip python_version: 3.6 - compiler: gcc - os: macOS-latest task: mpi method: wheel python_version: 3.7 - compiler: gcc steps: - name: Checkout repository uses: actions/checkout@v2.3.4 @@ -66,8 +59,10 @@ jobs: export COMPILER="${{ matrix.compiler }}" export PYTHON_VERSION="${{ matrix.python_version }}" if [[ "${{ matrix.os }}" == "macOS-latest" ]]; then + export COMPILER="gcc" export OS_NAME="macos" elif [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then + export COMPILER="clang" export OS_NAME="linux" fi export BUILD_DIRECTORY="$GITHUB_WORKSPACE" diff --git a/README.md b/README.md index 293dd32e2215..de27a618896a 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ Light Gradient Boosting Machine =============================== +[![Python-package GitHub Actions Build Status](https://github.com/microsoft/LightGBM/workflows/Python-package/badge.svg?branch=master)](https://github.com/microsoft/LightGBM/actions) [![R-package GitHub Actions Build Status](https://github.com/microsoft/LightGBM/workflows/R-package/badge.svg?branch=master)](https://github.com/microsoft/LightGBM/actions) [![Static Analysis GitHub Actions Build Status](https://github.com/microsoft/LightGBM/workflows/Static%20Analysis/badge.svg?branch=master)](https://github.com/microsoft/LightGBM/actions) [![Azure Pipelines Build Status](https://lightgbm-ci.visualstudio.com/lightgbm-ci/_apis/build/status/Microsoft.LightGBM?branchName=master)](https://lightgbm-ci.visualstudio.com/lightgbm-ci/_build/latest?definitionId=1) From 90ca7191363778471a5b2c426e8d3321e28cb7f5 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 10 Jan 2021 10:54:46 -0600 Subject: [PATCH 09/12] swap compilers --- .github/workflows/python_package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python_package.yml b/.github/workflows/python_package.yml index ed8217379493..6341fb1b01d9 100644 --- a/.github/workflows/python_package.yml +++ b/.github/workflows/python_package.yml @@ -59,10 +59,10 @@ jobs: export COMPILER="${{ matrix.compiler }}" export PYTHON_VERSION="${{ matrix.python_version }}" if [[ "${{ matrix.os }}" == "macOS-latest" ]]; then - export COMPILER="gcc" + export COMPILER="clang" export OS_NAME="macos" elif [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then - export COMPILER="clang" + export COMPILER="gcc" export OS_NAME="linux" fi export BUILD_DIRECTORY="$GITHUB_WORKSPACE" From 33cf19c16ad8de08e0a0022590c993ecb19dd11e Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 10 Jan 2021 11:23:33 -0600 Subject: [PATCH 10/12] swap compilers back --- .github/workflows/python_package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python_package.yml b/.github/workflows/python_package.yml index 6341fb1b01d9..ed8217379493 100644 --- a/.github/workflows/python_package.yml +++ b/.github/workflows/python_package.yml @@ -59,10 +59,10 @@ jobs: export COMPILER="${{ matrix.compiler }}" export PYTHON_VERSION="${{ matrix.python_version }}" if [[ "${{ matrix.os }}" == "macOS-latest" ]]; then - export COMPILER="clang" + export COMPILER="gcc" export OS_NAME="macos" elif [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then - export COMPILER="gcc" + export COMPILER="clang" export OS_NAME="linux" fi export BUILD_DIRECTORY="$GITHUB_WORKSPACE" From 0418cf4f84859eedeef97a1e0c1675087b70f326 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 10 Jan 2021 14:42:14 -0600 Subject: [PATCH 11/12] Apply suggestions from code review Co-authored-by: Nikita Titov --- .github/workflows/python_package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python_package.yml b/.github/workflows/python_package.yml index ed8217379493..f30cd9bf29fb 100644 --- a/.github/workflows/python_package.yml +++ b/.github/workflows/python_package.yml @@ -14,7 +14,7 @@ env: jobs: test: - name: ${{ matrix.task }} ${{ matrix.method }} (${{ matrix.os }}, ${{ matrix.compiler }}, Python ${{ matrix.python_version }}) + name: ${{ matrix.task }} ${{ matrix.method }} (${{ matrix.os }}, Python ${{ matrix.python_version }}) runs-on: ${{ matrix.os }} timeout-minutes: 60 strategy: From 44e808122c6be47c1f70c1a89372aa450554a12f Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 10 Jan 2021 16:55:14 -0600 Subject: [PATCH 12/12] Update .github/workflows/python_package.yml --- .github/workflows/python_package.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/python_package.yml b/.github/workflows/python_package.yml index f30cd9bf29fb..9c2103c23444 100644 --- a/.github/workflows/python_package.yml +++ b/.github/workflows/python_package.yml @@ -56,7 +56,6 @@ jobs: run: | export TASK="${{ matrix.task }}" export METHOD="${{ matrix.method }}" - export COMPILER="${{ matrix.compiler }}" export PYTHON_VERSION="${{ matrix.python_version }}" if [[ "${{ matrix.os }}" == "macOS-latest" ]]; then export COMPILER="gcc"