Skip to content

CI via GitHub actions #2353

Closed
Closed

Description

@guolinke

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

Activity

  1. hayesall commented on Aug 24, 2019

    @hayesall
    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
  2. StrikerRUS commented on Aug 24, 2019

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

  3. jameslamb commented on Aug 25, 2019

    @jameslamb
    Member

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

  4. hayesall commented on Aug 26, 2019

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

  5. StrikerRUS commented on Sep 8, 2019

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

  6. StrikerRUS commented on Dec 15, 2019

    @StrikerRUS
    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"
    
  7. StrikerRUS commented on Dec 15, 2019

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

  8. self-assigned this
    on May 22, 2020
  9. jameslamb commented on May 22, 2020

    @jameslamb
    Member

    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)

  10. StrikerRUS commented on May 22, 2020

    @StrikerRUS
    Collaborator

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

  11. jameslamb commented on May 22, 2020

    @jameslamb
    Member

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

  12. StrikerRUS commented on May 22, 2020

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

  13. jameslamb commented on May 22, 2020

    @jameslamb
    Member

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

  14. added 2 commits that reference this issue on Jun 10, 2020
    0070bab
    553857d
  15. github-actions commented on Aug 23, 2023

    @github-actions
    Contributor

    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.

  16. locked as resolved and limited conversation to collaborators on Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions