It seems we can use github actions for the CI tests:
https://help.github.com/en/articles/about-github-actions
Workflows run in Linux, macOS, Windows, and containers on GitHub-hosted servers. You can create workflows using actions defined in your repository, open source actions in a public repository on GitHub, or a published Docker container image.
You can execute up to 20 workflows concurrently per repository.
You can execute up to 1000 API requests in an hour across all actions within a repository.
Each job in a workflow can run for up to 6 hours of execution time.
You can run up to 20 jobs concurrently per repository across all workflows.
From these descriptions, it seems better than other CIs we are using.
@StrikerRUS
Badges in the README can be updated too, here's an example:
The syntax should look like this (courtesy of Reddit user /u/peaceiris in this thread)
https://github.com/{github_id}/{repository}/workflows/{workflow_name}/badge.svg
It seems we can use github actions for the CI tests:
I think we can start from tests for R-package. @jameslamb created #2335 for that recently. R tests will require new script files for stuff installation and test itself, so it's good way to not adjust our existing scripts, but develop new ones from the scratch and learn new CI platform.
@StrikerRUS yes that's a good idea, I've been wanting to learn GitHub actions for CI.
I'll try that for #2335 (just assigned to myself).
I adapted the Travis matrix to a GitHub Actions matrix. It's nowhere close to being ready for a pull request, but there aren't many examples yet so I figured I'd share what I've found.
The workflow documentation is a good place to start, but it's still being expanded.
@hayesall Thank you very much! You freed me from fear of the blank page! Your work was really helpful for me.
@jameslamb I played with GitHub Actions today and managed to set something that tries to run all our tests on three platforms. It still suffers from environmental issues which result in command not found errors. However, feel free to start from this draft.
https://github.com/microsoft/LightGBM/tree/github_actions
I removed all other CIs from that branch to not waste their resources.
Posting my draft of the action with the aim to remove stale github_actions branch.
One more thing to do is to find way to preserve conda's activation across different shell scripts.
name: GitHub Actions
on: [push]
jobs:
test:
name: ${{ matrix.task }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
task: [regular, sdist, bdist, if-else, pylint, mpi-source, mpi-pip, gpu-source, gpu-pip]
os: [ubuntu-latest, macOS-latest, windows-latest]
include:
- task: regular
python_version: 3.6
- task: sdist
python_version: 2.7
- task: mpi-source
method: source
- task: mpi-pip
method: pip
- task: gpu-source
method: source
python_version: 3.5
- task: gpu-pip
method: pip
python_version: 3.6
exclude:
- os: macOS-latest
task: pylint
- os: macOS-latest
task: gpu-source
- os: macOS-latest
task: gpu-pip
- os: windows-latest
task: if-else
- os: windows-latest
task: pylint
- os: windows-latest
task: mpi-source
- os: windows-latest
task: mpi-pip
- os: windows-latest
task: gpu-source
- os: windows-latest
task: gpu-pip
steps:
- name: Checkout repository
uses: actions/checkout@v1
with:
fetch-depth: 1
submodules: true
- name: Setup and run tests on Linux and macOS
if: matrix.os != 'windows-latest'
shell: bash
run: |
if [[ "${{ matrix.task }}" == "gpu-source" || "${{ matrix.task }}" == "gpu-pip" ]]; then
export TASK="gpu"
elif [[ "${{ matrix.task }}" == "mpi-source" || "${{ matrix.task }}" == "mpi-pip" ]]; then
export TASK="mpi"
fi
export METHOD="${{ matrix.method }}"
if [ -z ${{ matrix.python_version }} ]; then
export PYTHON_VERSION="3.7"
else
export PYTHON_VERSION=${{ matrix.python_version }}
fi
export HOME_DIRECTORY="$HOME"
export BUILD_DIRECTORY="$GITHUB_WORKSPACE"
if [[ "${{ matrix.os }}" == "macOS-latest" ]]; then
export OS_NAME="macos"
export COMPILER="gcc"
elif [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
export OS_NAME="linux"
export COMPILER="clang"
fi
export GITHUB_ACTIONS="true"
export CONDA_ENV="test-env"
export LGB_VER=$(head -n 1 VERSION.txt)
export AMDAPPSDK_PATH=$HOME/AMDAPPSDK
export LD_LIBRARY_PATH="$AMDAPPSDK_PATH/lib/x86_64:$LD_LIBRARY_PATH"
export OPENCL_VENDOR_PATH=$AMDAPPSDK_PATH/etc/OpenCL/vendors
$GITHUB_WORKSPACE/.ci/setup.sh
$GITHUB_WORKSPACE/.ci/test.sh
- name: Setup and run tests on Windows
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
if ("${{ matrix.python_version }}" -ne "") {
$env:PYTHON_VERSION="${{ matrix.python_version }}"
} else {
$env:PYTHON_VERSION="3.7"
}
$env:HOME_DIRECTORY=$env:HOME
$env:BUILD_DIRECTORY=$env:GITHUB_WORKSPACE
$env:GITHUB_ACTIONS="true"
$env:CONDA_ENV="test-env"
& "$env:CONDA/Scripts/activate"
& "$env:CONDA/Scripts/conda" config --set always_yes yes --set changeps1 no
& "$env:CONDA/Scripts/conda" update -q -y conda
& "$env:CONDA/Scripts/conda" create -q -y -n $env:CONDA_ENV python=$env:PYTHON_VERSION joblib matplotlib numpy pandas psutil pytest python-graphviz scikit-learn scipy
& "$env:CONDA/Scripts/activate" $env:CONDA_ENV
& "$env:GITHUB_WORKSPACE/.ci/test_windows.ps1"
Closed in favor of being in #2302. We decided to keep all feature requests in one place.
Welcome to contribute this feature! Please re-open this issue (or post a comment if you are not a topic starter) if you are actively working on implementing this feature.
re-opening this because I'm actively working on it, to try to give us more CI capacity for all the work going on in the R package (#3065 and https://github.com/jameslamb/LightGBM/pull/25)
@jameslamb If I'm not mistaken, Azure Pipelines and GitHub Actions share the same containers. Maybe this information will help you somehow.
@StrikerRUS that does help! I got very close on my fork last night, actually: https://github.com/jameslamb/LightGBM/pull/28
Was able to get past the command not found errors for conda and some other issues. My goal is to get that PR working on my fork for at least lint task and all r-package tasks across all operating systems, and then I'll open a PR here for us to discuss. I think a good starting point could be only to use it for R tests, since those often take the longest. I'd especially like to move the two r-package tests off of AppVeyor, since we are limited to all builds there running sequentially.
@jameslamb
Was able to get past the command not found errors for conda and some other issues.
Wow, great! That is exact place where I abandoned my attempts to get it work. 馃檪
Agree with all your other points!
Your work up to https://github.com/microsoft/LightGBM/issues/2353#issuecomment-565809654 was extremely helpful!
Most helpful comment
Posting my draft of the action with the aim to remove stale
github_actionsbranch.One more thing to do is to find way to preserve conda's activation across different shell scripts.