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 · 7 comments
Closed

CI via GitHub actions #2353

guolinke opened this issue Aug 24, 2019 · 7 comments

Comments

@guolinke
Copy link
Member

@guolinke guolinke commented Aug 24, 2019

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

This comment has been minimized.

Copy link
Contributor

@hayesall hayesall commented Aug 24, 2019

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

This comment has been minimized.

Copy link
Collaborator

@StrikerRUS StrikerRUS commented Aug 24, 2019

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.

@guolinke guolinke mentioned this issue Aug 25, 2019
11 of 89 tasks complete
@jameslamb

This comment has been minimized.

Copy link
Collaborator

@jameslamb jameslamb commented Aug 25, 2019

@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

This comment has been minimized.

Copy link
Contributor

@hayesall hayesall commented Aug 26, 2019

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

This comment has been minimized.

Copy link
Collaborator

@StrikerRUS StrikerRUS commented Sep 8, 2019

@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

This comment has been minimized.

Copy link
Collaborator

@StrikerRUS StrikerRUS commented Dec 15, 2019

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

This comment has been minimized.

Copy link
Collaborator

@StrikerRUS StrikerRUS commented Dec 15, 2019

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.

@StrikerRUS StrikerRUS closed this Dec 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.