Skip to content

TST: GitHub Actions as CI - #10388

Merged
pllim merged 11 commits into
astropy:masterfrom
pllim:last-actions-hero
Nov 12, 2020
Merged

pllim merged 11 commits into
astropy:masterfrom
pllim:last-actions-hero

Conversation

@pllim

@pllim pllim commented May 22, 2020 •

Copy link
Copy Markdown
Member

Update: Due to Travis CI changes in pricing, we decided to push ahead with this as soon as we have a minimal viable product. We will fix the rest of the jobs in follow-up PRs.

This is a small proof-of-concept of using GitHub Actions as CI. Might expand if there is buy-in, or abandon if there isn't.

Pros

  • Artifact support but I haven't tried to use it yet.
  • Better integration with GitHub UI.
    • The cancel button is easier to access than Azure Pipelines.
  • Unlike Azure, no need for special Microsoft account or let Microsoft access GitHub credentials. (The latter is probably moot point, har har...).
  • Performance on par with Azure (theoretically, considering they probably share the same servers or something...).
  • Potentially useful for other things too, like bot work and delivery.

Cons

CI jobs and features to implement (please check off if done)

From .travis.yml:

  • Caching with ccache and .hypothesis.
  • pytest conditions in test modules using TRAVIS env var.
  • Slack notification (both on success and failure) for cron job.
  • Initial tests stage:
    • Python 3.7 with minimal dependencies
    • Python 3.8 with all optional dependencies (-v --develop, --durations=50, clang)
    • Code style checks
  • Comprehensive tests stage:
    • Python 3.7 with oldest supported version of all dependencies (--open-files)
    • Python 3.7 with numpy 1.17 and full coverage (--remote-data=astropy, LC_CTYPE=C.ascii, LC_ALL=C) -- need codecov token
  • Final tests stage:
    • Python 3.8 with all optional dependencies
    • Python 3.7 with remote data and dev version of key dependencies (--remote-data=any) -- allowed to fail
  • Cron:
    • Python 3.7 with all optional dependencies for OSX (clang, --remote-data=astropy)
    • Python 3.7 with dev version of key dependencies
    • Documentation link check
    • Python dev with basic dependencies (3.9-dev, --durations=50, clang)
    • Big-endian s390x architecture with apt (arch: s390x, ASTROPY_USE_SYSTEM_ALL=1) (@astrofrog will do in a follow-up PR)
    • ARM64 architecture with apt (arch: arm64, ASTROPY_USE_SYSTEM_ALL=1) (@astrofrog will do in a follow-up PR)
    • Bundling with pyinstaller

From .circleci/config.yml:

  • 32-bit and parallel (custom astropy.cfg, Python 3.7 -n=4 --durations=50, Python 3.8 py38-test-double)
  • image-tests-mpl302
  • image-tests-mpl310
  • image-tests-mpldev

From azure-piplines.yml:

  • Build wheels and publish to PyPI for release. (@astrofrog and @Cadair decided to keep Azure for now.)

TODO

  • Fix failures. It kicked off at https://github.com/pllim/astropy/actions/runs but probably affected by the degraded GitHub service that was happening.
    • Once Actions reports to the PR, will adding branch filters back break it?
  • Discuss and compare to WIP: Azure pipelines configuration #8445 .
  • See what to do with the cron stuff -- separate or same YAML?
  • See how much more we can port to Actions from Travis CI and maybe even CircleCI. Should use matrix where possible.
  • Remove ported jobs from the other CIs.
  • Figure out the badge situations in README.
  • Determine if we are happy to make remote/numpy dev be not allowed failures since there isn't an equivalent feature
  • See if we can add --open-files back to a newer job in future PR.
  • See if codecov reports back to PR. If not, find solution.

Possible links of interest

Thanks to everyone who provided these resources:

@Cadair

Cadair commented May 24, 2020

Copy link
Copy Markdown
Member

The cancel button is easier to access than Azure Pipelines.

Don't they both ingrate with the GH actions UI for this? You can restart pipelines from the actions tab as well.

image

@pllim

This comment has been minimized.

@Cadair

Cadair commented May 26, 2020

Copy link
Copy Markdown
Member

The GH account integration with pipelines has improved a lot in the last few months.

@pllim pllim mentioned this pull request Aug 14, 2020
2 tasks done
@pllim pllim modified the milestones: v4.2, v5.0 Oct 21, 2020
Comment thread .github/workflows/ci_workflows.yml Outdated
# Full tests with coverage checks.
coverage_test:
runs-on: ubuntu-latest
needs: [code_style, initial_tests]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could try and keep things simple and not worry about replicating stages for now - we could have a single jobs section with an include matrix?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of stages I think we could rely on Actions' fast-fail functionality (default) which means that all jobs stop if one fail. In practice this means if e.g. code style fails it won't waste time on longer builds for example.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Up to you. I was just trying to recreate what we had at the time.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the issue is that the stages makes everything much more verbose. I think I would prefer if we could make things more concise and avoid repetition and then decide if adding stages back are worth it?

Comment thread .github/workflows/ci_workflows.yml Outdated
# The following is needed to avoid issues if e.g. Matplotlib tries
# to open a GUI window.
env:
SETUP_XVFB: True

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was a ci-helpers thing

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this PR been open for a while and probably need upgrades.

@astrofrog

Copy link
Copy Markdown
Member

@pllim - since there was a conflict, and to pick up the fact actions now works in PRs, I took the liberty of rebasing this and removing the temporary commit. I also added a commit which simplifies the configuration a lot by getting rid of the stages (this reduces a lot of configuration duplication). Once we are happy with the config, we could change fail-fast to true which means that if some of the faster builds (e.g. code style or minimal deps) fail the whole CI stops, which in effect reproduces what we were trying to accomplish with stages. We could add stages back as you had them of course, but I think we should aim to have a CI config file as simple as possible. Finally, I've removed jobs from the Travis configuration which are now in Actions. I have a backup of your branch if needed for any reason though. I haven't yet added the ability to use clang for one of the Linux jobs.

@astrofrog

Copy link
Copy Markdown
Member

One thing we should decide is how to handle allowed failures - since each job appears as one entry here maybe we don't actually need to replicate this functionality, and that way remote data and numpy dev failures won't be hidden away but are also easy to ignore.

Comment thread .github/workflows/ci_workflows.yml Resolved
@astrofrog
astrofrog force-pushed the last-actions-hero branch 2 times, most recently from 913de6f to 41afca2 Compare November 12, 2020 12:38
@astrofrog

Copy link
Copy Markdown
Member

I've also now copied over most cron jobs, except the arm and s390x arch ones which I can do a follow up PR for later. I made a separate file for cron otherwise it gets a bit messy to skip some jobs and not others for cron and I haven't found a way to hide them in pull requests then. I've also added a TMP commit to enable cron builds here so we can check they run.

@astrofrog

Copy link
Copy Markdown
Member

The main thing I haven't implemented is the use of clang which was specified in the Travis file for some jobs. Is that actually something we want/need? We could get rid of that and just make the MacOS X build be non-cron which would then by default use clang?

@Cadair - you could always push your changes here to move the image tests away from CircleCI?

@Cadair

Cadair commented Nov 12, 2020

Copy link
Copy Markdown
Member

As far as i can tell actions artifacts aren't up to it. I suggest we just leave circle for now and focus on killing off Travis.

@astrofrog

astrofrog commented Nov 12, 2020 •

Copy link
Copy Markdown
Member

Ok so looking at the failures for now:

  • test_update_parallel was skipped on Travis but also fails on Actions so I'm now pushing a commit to skip it on all CI (fixed)
  • Python 3.7 with oldest supported version of all dependencies fails because there are some open files after the tests (mainly FITS files I think). @saimn any idea what could be going on there?
  • The link checker is failing because https://docs.astropy.org/en/v4.0/whatsnew/4.0.html is broken (any ideas why?)
  • There are some real failures with Numpy dev I think (cc @mhvk)
  • Python dev (now 3.10) fails because Numpy isn't compatible yet. Maybe we can just comment it out for now so we can keep an eye on what the latest failures are

@saimn

saimn commented Nov 12, 2020

Copy link
Copy Markdown
Contributor

Re-clang: yes I think we had clang on linux because the macos queue on Travis was too slow. So if we can have a macos job by default, we don't need clang on linux.

@astrofrog

Copy link
Copy Markdown
Member

@saimn - ok let's do that. The MacOS X builds start up pretty quickly on Actions.

@pllim
pllim force-pushed the last-actions-hero branch from 966df97 to f0d7cd0 Compare November 12, 2020 17:35
@pllim
pllim force-pushed the last-actions-hero branch from f0d7cd0 to a7e7500 Compare November 12, 2020 18:03
Comment thread .github/workflows/ci_workflows.yml Resolved
@pllim
pllim marked this pull request as ready for review November 12, 2020 18:23
@@ -1,4 +1,4 @@
name: Run tests
name: CI

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: This name has to match what is on README

[ci skip]
@pllim
pllim force-pushed the last-actions-hero branch from b5e87d3 to dc0c21b Compare November 12, 2020 18:54

@bsipocz bsipocz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor comments only, no need to address them here, they are just thought for the follow-up.

on:
schedule:
# run every Monday at 6am UTC
- cron: '0 6 * * 1'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this frequent enough? We used to run cron jobs daily.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. We can follow up as separate PR.

Comment thread .github/workflows/ci_workflows.yml Resolved
Comment thread README.rst
=======

|Travis Status| |CircleCI Status| |Coverage Status| |PyPI Status| |Documentation Status|
|Actions Status| |CircleCI Status| |Coverage Status| |PyPI Status| |Documentation Status|

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

travis isn't completely removed yet, so maybe keep both?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't run no more. We can add it back if we decide to pay.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, indeed. I only said it based on that the config remained.

@pllim
pllim merged commit 7a97f04 into astropy:master Nov 12, 2020
@pllim
pllim deleted the last-actions-hero branch November 12, 2020 19:21
@pllim pllim mentioned this pull request Nov 12, 2020
4 tasks

@Cadair Cadair left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@astrofrog

Copy link
Copy Markdown
Member

🎉

@mwcraig

mwcraig commented Nov 12, 2020

Copy link
Copy Markdown
Member

Nice work! 🎉

@bsipocz

bsipocz commented Nov 23, 2020

Copy link
Copy Markdown
Member

I've added this to the backport as a first step of getting #11050 addressed, and to get some CI on the 4.2.x branch. I'm certain that more backports and/or fine-tuning will be necessary (cleaning up cron as that is not run on non-master branches, etc., adding back 3.6 testing, etc.), but still getting this is superb for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants