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 via GitHub actions #2353

Closed
guolinke opened this issue Aug 24, 2019 · 13 comments
Closed

CI via GitHub actions #2353

guolinke opened this issue Aug 24, 2019 · 13 comments

Comments

@guolinke
Copy link
Collaborator

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

@hayesall
Copy link
Contributor

Badges in the README can be updated too, here's an example:

GitHub Actions status

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

@StrikerRUS
Copy link
Collaborator

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.

@jameslamb
Copy link
Collaborator

@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).

@hayesall
Copy link
Contributor

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.

@StrikerRUS
Copy link
Collaborator

@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.

@StrikerRUS
Copy link
Collaborator

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"

@StrikerRUS
Copy link
Collaborator

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.

@jameslamb
Copy link
Collaborator

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 jameslamb#25)

@StrikerRUS
Copy link
Collaborator

@jameslamb If I'm not mistaken, Azure Pipelines and GitHub Actions share the same containers. Maybe this information will help you somehow.

@jameslamb
Copy link
Collaborator

@StrikerRUS that does help! I got very close on my fork last night, actually: jameslamb#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.

@StrikerRUS
Copy link
Collaborator

@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!

@jameslamb
Copy link
Collaborator

Your work up to #2353 (comment) was extremely helpful!

ChipKerchner pushed a commit to ChipKerchner/LightGBM that referenced this issue Jun 10, 2020
…ft#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
ChipKerchner pushed a commit to ChipKerchner/LightGBM that referenced this issue Jun 11, 2020
…ft#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
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants