I've been using Travis CI fairly extensively since 2013, when I moved my personal OSS projects from Bitbucket to GitHub. It's a great service and a much-appreciated boon to the open-source community.
However, since Travis announced that their .org variant is shutting down soon, I wanted to check out some of the alternatives, and GitHub actions (GHA) seemed very interesting.
So this week I've migrated pycparser and a few of my other OSS projects over to GHA. This turned out to be very easy! Here's a brief recap.
Workflow configuration
To activate GHA for pycparser, all I had to do is create the following YAML file as .github/workflows/ci.yml in the repository:
name: pycparser-tests
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [2.7, 3.6, 3.7, 3.8]
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Test
run: |
python tests/all_tests.py
Some notes:
- This workflow fires on two kinds of events: pushes to the master branch and PRs to the master branch. Each PR will have an automatic CI run for each change (every new commit pushed).
- It runs in multiple configurations: the cross-product of Python versions and OSes, as specified.
- The run: entry is the command the runs the tests.
- While pycparser doesn't have any dependencies, it's easy to have those too by adding pip install $whatever lines to run: before the actual test execution line.
First impressions
My first impressions of GHA compared to Travis:
- Actions run much faster; the CI jobs schedule pretty much immediately. On Travis you might have to wait for multiple minutes.
- Out-of-the-box Windows and Mac OS option! I couldn't get these with the free Travis variant and had to augment my CI solution for pycparser by running on Windows through AppVeyor. Now I only need to maintain a single CI workflow.
- Travis seems to have better documentation and configurability at this point; while the GHA documentation is comprehensive, it's a bit scattered and harder to follow. This is something I hope will improve over time.
I like what I'm seeing from GHA so far; the ability to set up a CI workflow very easily without bouncing between multiple Web UIs is a blessing, and GHA appears to be a capable, performant platform with a convenient selection of OSes.
I'm still using Travis for some projects and will continue comparing the two over the coming months.