Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] Move check-docs and lint jobs off Travis #3726

Merged
merged 18 commits into from
Jan 7, 2021
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ci/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ else # Linux
fi
fi

if [[ "${TASK:0:9}" != "r-package" ]]; then
StrikerRUS marked this conversation as resolved.
Show resolved Hide resolved
if [[ "${TASK}" != "r-package" ]]; then
if [[ $SETUP_CONDA != "false" ]]; then
sh conda.sh -b -p $CONDA
fi
Expand Down
2 changes: 1 addition & 1 deletion .ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ elif [[ $OS_NAME == "linux" ]] && [[ $COMPILER == "clang" ]]; then
export CC=clang
fi

if [[ "${TASK:0:9}" == "r-package" ]]; then
if [[ "${TASK}" == "r-package" ]]; then
bash ${BUILD_DIRECTORY}/.ci/test_r_package.sh || exit -1
exit 0
fi
Expand Down
18 changes: 0 additions & 18 deletions .ci/test_r_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,24 +105,6 @@ if [[ $OS_NAME == "macos" ]]; then
fi
Rscript --vanilla -e "install.packages(${packages}, repos = '${CRAN_MIRROR}', lib = '${R_LIB_PATH}', dependencies = c('Depends', 'Imports', 'LinkingTo'))" || exit -1

if [[ $TASK == "r-package-check-docs" ]]; then
Rscript build_r.R || exit -1
Rscript --vanilla -e "install.packages('roxygen2', repos = '${CRAN_MIRROR}', lib = '${R_LIB_PATH}', dependencies = c('Depends', 'Imports', 'LinkingTo'))" || exit -1
Rscript --vanilla -e "roxygen2::roxygenize('R-package/', load = 'installed')" || exit -1
num_doc_files_changed=$(
git diff --name-only | grep --count -E "\.Rd|NAMESPACE"
)
if [[ ${num_doc_files_changed} -gt 0 ]]; then
echo "Some R documentation files have changed. Please re-generate them and commit those changes."
echo ""
echo " Rscript build_r.R"
echo " Rscript -e \"roxygen2::roxygenize('R-package/', load = 'installed')\""
echo ""
exit -1
fi
exit 0
fi

cd ${BUILD_DIRECTORY}

PKG_TARBALL="lightgbm_*.tar.gz"
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/r_package.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: R GitHub Actions
name: R-package

on:
push:
Expand Down Expand Up @@ -40,11 +40,6 @@ jobs:
compiler: clang
r_version: 4.0
build_type: cmake
- os: ubuntu-latest
task: r-package-check-docs
compiler: gcc
r_version: 4.0
build_type: cmake
- os: macOS-latest
task: r-package
compiler: gcc
Expand Down
85 changes: 85 additions & 0 deletions .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# contains non-functional tests, like checks on docs
# and code style
name: Static Analysis
jameslamb marked this conversation as resolved.
Show resolved Hide resolved

on:
push:
branches:
- master
pull_request:
branches:
- master

env:
CONDA_ENV: test-env
GITHUB_ACTIONS: 'true'
PYTHON_VERSION: 3.8

jobs:
test:
name: ${{ matrix.task }}
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- task: lint
- task: check-docs
steps:
- name: Checkout repository
uses: actions/checkout@v2.3.4
with:
fetch-depth: 5
submodules: false
- name: Setup and run tests
shell: bash
run: |
export TASK="${{ matrix.task }}"
export OS_NAME="linux"
jameslamb marked this conversation as resolved.
Show resolved Hide resolved
export COMPILER="gcc"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can move these variables to env section of this config file closer to PYTHON_VERSION and other constants.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in 1af56f4

export BUILD_DIRECTORY="$GITHUB_WORKSPACE"
export CONDA=${HOME}/miniconda
export PATH=${CONDA}/bin:$HOME/.local/bin:${PATH}
StrikerRUS marked this conversation as resolved.
Show resolved Hide resolved
$GITHUB_WORKSPACE/.ci/setup.sh || exit -1
$GITHUB_WORKSPACE/.ci/test.sh || exit -1
r-check-docs:
name: r-package-check-docs
timeout-minutes: 60
runs-on: ubuntu-latest
container: rocker/verse
steps:
- name: Checkout repository
uses: actions/checkout@v2.3.4
with:
fetch-depth: 5
submodules: true
- name: Install packages
shell: bash
run: |
Rscript -e "install.packages(c('R6', 'data.table', 'jsonlite', 'roxygen2', 'testthat'), repos = 'https://cran.r-project.org')"
sh build-cran-package.sh || exit -1
R CMD INSTALL --with-keep.source lightgbm_*.tar.gz || exit -1
- name: Test documentation
shell: bash --noprofile --norc {0}
StrikerRUS marked this conversation as resolved.
Show resolved Hide resolved
run: |
Rscript --vanilla -e "roxygen2::roxygenize('R-package/', load = 'installed')" || exit -1
num_doc_files_changed=$(
git diff --name-only | grep --count -E "\.Rd|NAMESPACE"
)
if [[ ${num_doc_files_changed} -gt 0 ]]; then
echo "Some R documentation files have changed. Please re-generate them and commit those changes."
echo ""
echo " sh build-cran-package.sh"
echo " R CMD INSTALL --with-keep.source lightgbm_*.tar.gz"
echo " Rscript -e \"roxygen2::roxygenize('R-package/', load = 'installed')\""
echo ""
exit -1
fi
all-successful:
StrikerRUS marked this conversation as resolved.
Show resolved Hide resolved
# 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, r-check-docs]
steps:
- name: Note that all tests succeeded
run: echo "🎉"
6 changes: 0 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ env:
- TASK=sdist
- TASK=bdist
- TASK=if-else
- TASK=lint
- TASK=check-docs
- TASK=mpi METHOD=source
- TASK=mpi METHOD=pip PYTHON_VERSION=3.7
- TASK=mpi METHOD=wheel PYTHON_VERSION=3.7
Expand All @@ -37,10 +35,6 @@ matrix:
env: TASK=gpu METHOD=pip PYTHON_VERSION=3.6
- os: osx
env: TASK=gpu METHOD=wheel PYTHON_VERSION=3.7
- os: osx
env: TASK=lint
- os: osx
env: TASK=check-docs

before_install:
- test -n $CC && unset CC
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
Light Gradient Boosting Machine
===============================

[![GitHub Actions Build Status](https://github.com/microsoft/LightGBM/workflows/R%20GitHub%20Actions/badge.svg?branch=master)](https://github.com/microsoft/LightGBM/actions)
[![R-package Build Status](https://github.com/microsoft/LightGBM/workflows/R-package/badge.svg?branch=master)](https://github.com/microsoft/LightGBM/actions)
jameslamb marked this conversation as resolved.
Show resolved Hide resolved
[![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)
[![Appveyor Build Status](https://ci.appveyor.com/api/projects/status/1ys5ot401m0fep6l/branch/master?svg=true)](https://ci.appveyor.com/project/guolinke/lightgbm/branch/master)
[![Travis Build Status](https://travis-ci.org/microsoft/LightGBM.svg?branch=master)](https://travis-ci.org/microsoft/LightGBM)
Expand Down