* [Python] Require black and isort for new Python files. - Require black and isort for spark and dask module. These files are relatively new and are more conform to the black formatter. We will convert the rest of the library as we move forward. Other libraries including dask/distributed and optuna use the same formatting style and have a more strict standard. The black formatter is indeed quite nice, automating it can help us unify the code style. - Gather Python checks into a single script.
212 lines
6.2 KiB
YAML
212 lines
6.2 KiB
YAML
# This is a basic workflow to help you get started with Actions
|
|
|
|
name: XGBoost-CI
|
|
|
|
# Controls when the action will run. Triggers the workflow on push or pull request
|
|
# events but only for the master branch
|
|
on: [push, pull_request]
|
|
|
|
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
|
jobs:
|
|
gtest-cpu:
|
|
name: Test Google C++ test (CPU)
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [macos-10.15]
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
submodules: 'true'
|
|
- name: Install system packages
|
|
run: |
|
|
brew install ninja libomp
|
|
- name: Build gtest binary
|
|
run: |
|
|
mkdir build
|
|
cd build
|
|
cmake .. -DGOOGLE_TEST=ON -DUSE_OPENMP=ON -DUSE_DMLC_GTEST=ON -DPLUGIN_DENSE_PARSER=ON -GNinja
|
|
ninja -v
|
|
- name: Run gtest binary
|
|
run: |
|
|
cd build
|
|
./testxgboost
|
|
ctest -R TestXGBoostCLI --extra-verbose
|
|
|
|
gtest-cpu-nonomp:
|
|
name: Test Google C++ unittest (CPU Non-OMP)
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest]
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
submodules: 'true'
|
|
- name: Install system packages
|
|
run: |
|
|
sudo apt-get install -y --no-install-recommends ninja-build
|
|
- name: Build and install XGBoost
|
|
shell: bash -l {0}
|
|
run: |
|
|
mkdir build
|
|
cd build
|
|
cmake .. -GNinja -DGOOGLE_TEST=ON -DUSE_DMLC_GTEST=ON -DUSE_OPENMP=OFF
|
|
ninja -v
|
|
- name: Run gtest binary
|
|
run: |
|
|
cd build
|
|
ctest --extra-verbose
|
|
|
|
c-api-demo:
|
|
name: Test installing XGBoost lib + building the C API demo
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: ["ubuntu-latest"]
|
|
python-version: ["3.8"]
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
submodules: 'true'
|
|
- name: Install system packages
|
|
run: |
|
|
sudo apt-get install -y --no-install-recommends ninja-build
|
|
- uses: conda-incubator/setup-miniconda@v2
|
|
with:
|
|
auto-update-conda: true
|
|
python-version: ${{ matrix.python-version }}
|
|
activate-environment: test
|
|
- name: Display Conda env
|
|
shell: bash -l {0}
|
|
run: |
|
|
conda info
|
|
conda list
|
|
- name: Build and install XGBoost static library
|
|
shell: bash -l {0}
|
|
run: |
|
|
mkdir build
|
|
cd build
|
|
cmake .. -DBUILD_STATIC_LIB=ON -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -GNinja
|
|
ninja -v install
|
|
cd -
|
|
- name: Build and run C API demo with static
|
|
shell: bash -l {0}
|
|
run: |
|
|
pushd .
|
|
cd demo/c-api/
|
|
mkdir build
|
|
cd build
|
|
cmake .. -GNinja -DCMAKE_PREFIX_PATH=$CONDA_PREFIX
|
|
ninja -v
|
|
ctest
|
|
cd ..
|
|
rm -rf ./build
|
|
popd
|
|
- name: Build and install XGBoost shared library
|
|
shell: bash -l {0}
|
|
run: |
|
|
cd build
|
|
cmake .. -DBUILD_STATIC_LIB=OFF -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -GNinja
|
|
ninja -v install
|
|
cd -
|
|
- name: Build and run C API demo with shared
|
|
shell: bash -l {0}
|
|
run: |
|
|
pushd .
|
|
cd demo/c-api/
|
|
mkdir build
|
|
cd build
|
|
cmake .. -GNinja -DCMAKE_PREFIX_PATH=$CONDA_PREFIX
|
|
ninja -v
|
|
ctest
|
|
popd
|
|
./tests/ci_build/verify_link.sh ./demo/c-api/build/basic/api-demo
|
|
./tests/ci_build/verify_link.sh ./demo/c-api/build/external-memory/external-memory-demo
|
|
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
name: Code linting for Python and C++
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
submodules: 'true'
|
|
- uses: actions/setup-python@v2
|
|
with:
|
|
python-version: "3.8"
|
|
architecture: 'x64'
|
|
- name: Install Python packages
|
|
run: |
|
|
python -m pip install wheel setuptools
|
|
python -m pip install pylint cpplint numpy scipy scikit-learn pyspark pandas cloudpickle
|
|
- name: Run lint
|
|
run: |
|
|
make lint
|
|
|
|
doxygen:
|
|
runs-on: ubuntu-latest
|
|
name: Generate C/C++ API doc using Doxygen
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
submodules: 'true'
|
|
- uses: actions/setup-python@v2
|
|
with:
|
|
python-version: "3.8"
|
|
architecture: 'x64'
|
|
- name: Install system packages
|
|
run: |
|
|
sudo apt-get install -y --no-install-recommends doxygen graphviz ninja-build
|
|
python -m pip install wheel setuptools
|
|
python -m pip install awscli
|
|
- name: Run Doxygen
|
|
run: |
|
|
mkdir build
|
|
cd build
|
|
cmake .. -DBUILD_C_DOC=ON -GNinja
|
|
ninja -v doc_doxygen
|
|
- name: Extract branch name
|
|
shell: bash
|
|
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
|
|
id: extract_branch
|
|
if: github.ref == 'refs/heads/master' || contains(github.ref, 'refs/heads/release_')
|
|
- name: Publish
|
|
run: |
|
|
cd build/
|
|
tar cvjf ${{ steps.extract_branch.outputs.branch }}.tar.bz2 doc_doxygen/
|
|
python -m awscli s3 cp ./${{ steps.extract_branch.outputs.branch }}.tar.bz2 s3://xgboost-docs/doxygen/ --acl public-read
|
|
if: github.ref == 'refs/heads/master' || contains(github.ref, 'refs/heads/release_')
|
|
env:
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_IAM_S3_UPLOADER }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_IAM_S3_UPLOADER }}
|
|
|
|
sphinx:
|
|
runs-on: ubuntu-latest
|
|
name: Build docs using Sphinx
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
submodules: 'true'
|
|
- uses: actions/setup-python@v2
|
|
with:
|
|
python-version: "3.8"
|
|
architecture: 'x64'
|
|
- name: Install system packages
|
|
run: |
|
|
sudo apt-get install -y --no-install-recommends graphviz
|
|
python -m pip install wheel setuptools
|
|
python -m pip install -r doc/requirements.txt
|
|
- name: Extract branch name
|
|
shell: bash
|
|
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
|
|
id: extract_branch
|
|
if: github.ref == 'refs/heads/master' || contains(github.ref, 'refs/heads/release_')
|
|
- name: Run Sphinx
|
|
run: |
|
|
make -C doc html
|
|
env:
|
|
SPHINX_GIT_BRANCH: ${{ steps.extract_branch.outputs.branch }}
|