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

Migrate CI to GitHub Actions as Travis CI is ending their free OSS builds #107

Open
jcrist opened this issue Nov 2, 2020 · 13 comments
Open

Comments

@jcrist
Copy link
Member

jcrist commented Nov 2, 2020

Travis CI is used by several repos in the org. Today they announced they are shutting down their free OSS builds (https://blog.travis-ci.com/2020-11-02-travis-ci-new-billing). Existing users get 10,000 free credits (1000 mins of linux build time), which is not nearly enough to support our CI needs. Per the blog post users can ask for more free credits, which they'll evaluate on a case-by-case basis.

Should we start migrating projects to a different CI system?

@martindurant
Copy link
Member

I think all of the repos I manage are Travis, due to inertia :(
Would be very glad to be shown the smoothest way to move to githubActions.

@jacobtomlinson
Copy link
Member

jacobtomlinson commented Nov 2, 2020

I'm happy to drive an effort to switch to Actions. I can make a start on this now.

Proposed steps:

  • Add a list of all affected repos in this issue
  • Write some clear instructions on how to migrate
  • Open an issue on each repo
  • Raise a PR on each repo to migrate the config
  • Check off the list here

While we are at it should we consider standardising on GitHub Actions? We also have some CircleCI around too right?

@jacobtomlinson
Copy link
Member

Migration steps

Here are some general steps to migrate from Travis CI to GitHub Actions. I'll update this as I work through some migrations to add more detail.

Convert config

Create new CI config .github/workflows/ci.yml and open .travis.yml for reference.

Travis generally has some environment config such as OS, langauge, services, etc along with a build matrix. Then it has a few sections for running bash commands pre_install, install, script, etc.

In GitHub Actions we specify a trigger (e.g on pull request) and a list of jobs to be run. Each job has options such as OS selection and the option to specify a matrix. Then it has a series of steps. Each step can be a bash command or a prebaked "Action". To keep the migration simple it makes sense to use a couple of official Actions to configure the environment and then copy the existing bash commands from .travis.yml.

Example

Here's a simplified example of converting from one to the other.

# .travis.yml

language: python

matrix:
  include:
    - python: 3.7
    - python: 3.8

install:
  - python -m pip install --upgrade pip
  - pip install flake8 pytest
  - pip install -r requirements.txt

script:
  - flake8
  - pytest
# .github/workflows/ci.yml

name: CI

on: [push, pull_request]

jobs:
  build:

    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: [3.7, 3.8]

    steps:
    - uses: actions/checkout@v2
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install flake8 pytest
        pip install -r requirements.txt
    - name: Lint with flake8
      run: |
        flake8
    - name: Test with pytest
      run: |
        pytest

Test workflow

Raise a PR and test the new workflow.

Ensure Travis is disabled

Your PR to migrate should delete the .travis.yml file. This may be enough to disable Travis CI as there is a config option to only run Travis if the file exists which defaults to true. However you may still need to check this in the Travis settings.

Update badges

We also need to update the README badges to point to the new workflow.

Badge URL: https://github.com/<ORG>/<REPO>/workflows/<WORKFLOW NAME>/badge.svg
Badge Link: https://github.com/<ORG>/<REPO>/actions

For example dask-jobqueue already uses GitHub Actions and has the following badge

Markdown

[![Build Status](https://github.com/dask/dask-jobqueue/workflows/CI/badge.svg)](https://github.com/dask/dask-jobqueue/actions)

RST

.. |Build Status| image:: https://github.com/dask/dask-jobqueue/workflows/CI/badge.svg
   :target: https://github.com/dask/dask-jobqueue/actions

Preview

GitHub Actions Badge

@gforsyth
Copy link

gforsyth commented Nov 2, 2020

Each job has options such as OS selection and the option to specify a matrix.

A note of light caution -- currently if you have a matrix of say Python versions and OS in the same workflow file, if one of those matrix entries failed you can't restart it individually, you have to trigger a full re-run of everything defined in that file. On xonsh we've subsetted them into one os per workflow file so we can at least individually restart Windows runs or MacOS runs

@jacobtomlinson
Copy link
Member

jacobtomlinson commented Nov 2, 2020

Repo Current CI Issue Migration PR New CI Further action required
dask/dask CI Status No
dask/distributed CI Status No
dask/dask-image CircleCI CI Status No
dask/helm-chart CI Status No
dask/adlfs - - Maybe?
dask/dask-examples Build Status No
dask/fastparquet CI Status No
dask/dask-cloudprovider CI Status No
dask/dask-tutorial CI Status No
dask/dask-labextension labextension No
dask/dask-jobqueue Build Status - - - No
dask/dask-glm CI Status No
dask/dask-ml - - Maybe? (Travis has been removed, but still also using Azure pipelines)
dask/gcsfs CI Status No
dask/dask-gateway CI Status No
dask/dask-mpi Tests No
dask/dask-kubernetes Build Status - - - No
dask/s3fs CI Status No
dask/dask-lightgbm Build Status No
dask/dask-docker Docker build No
dask/dask-xgboost - - No (archived)
dask/dask-yarn - - Yes
dask/cachey CI Status No
dask/dask-benchmarks - - Maybe?
dask/zict CI Status No
dask/partd CI Status No

@martindurant
Copy link
Member

martindurant commented Nov 2, 2020

From the intake org: fsspec (and a bucket full of intake specific things)

@jacobtomlinson
Copy link
Member

The table above is now complete. This is a list of all active repos and their current CI.

Any currently using Travis I have opened an issue to migrate to GitHub Actions. Any using something else like Circle of Azure DevOps I've opened an issue asking whether we should migrate. Feedback on individual issues from folks who work on those projects is appreciated.

I'll also keep the table up to date as we open PRs and migrate over.

@westurner
Copy link

westurner commented Nov 10, 2020

Is there a script to convert from one YAML build spec to another? There may already be tool written in Python for converting between various CI configs?

Looks like drone-yaml (which is depended upon by drone-cli) can convert from BitBucket & GitLab, but not yet CircleCI, TravisCI, or GitHub
only to drone CI YML.
https://github.com/drone/drone-yaml/blob/6f4d6dfb39e40f92d31cb113f2cdcb19387d163b/yaml/converter/convert.go#L17-L27

If you can put most of the CI config in tox.ini with tox-travis or tox-gh-actions, you can more easily run equivalent local builds (and have less build config to convert)


Note that self-hosted GitHub runners (~GitLab CI Runners (Go)) are an option for faster local or cloud builds:

@westurner
Copy link

Would "Move to GitHub Actions instead of just asking Travis CI for more OSS build quota" be a more accurate issue title?

@jacobtomlinson
Copy link
Member

Is there a script to convert from one YAML build spec to another?

Possibly, but part of the goal here is to make use of GitHub Actions features, simplify CI and add more consistency. So doing a direct conversion may not be the best approach here.

If you can put most of the CI config in tox.ini with tox-travis or tox-gh-actions, you can more easily run equivalent local builds (and have less build config to convert)

Much of the benefit of using tox is for creating environments for you, then automating the commands. We already do much of this with conda and CI scripts. I'm not sure if we've ever discussed using a tool like tox, but if we did there would need to be a clear benefit over what we have today.

Note that self-hosted GitHub runners (~GitLab CI Runners (Go)) are an option for faster local or cloud builds

In order to use self hosted runners we would need to self host them somewhere. A big part of the motivation here is to move to a reliable and free provider.

Would "Move to GitHub Actions instead of just asking Travis CI for more OSS build quota" be a more accurate issue title?

Adding a reference to the GitHub Actions migration seems sensible. Asking Travis for more quota does not feel like a sustainable solution.

@jacobtomlinson jacobtomlinson changed the title Travis CI is ending their free OSS builds Migrate CI to GitHub Actions as Travis CI is ending their free OSS builds Nov 10, 2020
@CJ-Wright
Copy link

One thing you might consider is using conda-forge's tooling to provision CIs. This way you are somewhat abstracted from the underlying CI system and as new CI tooling comes out you can take advantage of it without having to do the migration yourself. A simple conda-smithy rerender will put you on the latest CIs conda-forge has templated out. A walk through of how to do this is here: https://conda-forge.org/docs/user/ci-skeleton.html and I gave a demo/tutorial for this at anacondacon 2020 (wherever those videos landed).

@westurner
Copy link

westurner commented Nov 11, 2020

https://conda-forge.org/docs/maintainer/adding_pkgs.html ::

[...] how to contribute packages to conda-forge.

https://conda-forge.org/docs/maintainer/updating_pkgs.html#example-workflow-for-updating-a-package

https://conda-forge.org/docs/maintainer/updating_pkgs.html#pushing-to-regro-cf-autotick-bot-branch :

When a new version of a package is released on PyPI/CRAN/.., we have a bot that automatically creates version updates for the feedstock. In most cases you can simply merge this PR and it should include all changes. When certain things have changed upstream, e.g. the dependencies, you will still have to do changes to the created PR. As feedstock maintainer, you don’t have to create a new PR for that but can simply push to the branch the bot created.

bot commands recognized in GH PR comments:

@westurner
Copy link

TIL there's also a
https://github.com/pypa/gh-action-pypi-publish GitHub action.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants