Moving CI from Travis to GitHub Actions

After relying on Travis CI for personal open-source projects since 2013, the announced shutdown of Travis's .org variant prompted a search for alternatives. GitHub Actions (GHA) looked promising, so I migrated pycparser and several other projects over this week. The process turned out to be straightforward.

GitHub actions icon

A Minimal Workflow File

Enabling GHA for pycparser required creating a single YAML file at .github/workflows/ci.yml:

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

Three details are worth noting:

  • The workflow triggers on two event types: pushes to master and pull requests targeting master. Every new commit pushed to an open PR gets its own CI run.
  • Jobs run as the cross-product of the listed Python versions and operating systems.
  • Dependencies can be added by inserting pip install ... lines into the run: block before the test command; pycparser itself has none.

Comparing GHA to Travis

Initial impressions, measured against Travis:

  • Speed: GHA schedules jobs almost immediately. Travis often required waiting several minutes for a slot.
  • OS coverage: Windows and macOS runners are available out of the box. The free Travis tier lacked these, so pycparser previously needed AppVeyor as a secondary CI service for Windows. Now a single workflow covers everything.
  • Documentation: Travis currently has more polished and better-organized docs. GHA's documentation is comprehensive but scattered, making it harder to navigate. That should improve with time.

So far, GHA looks capable and performant. The ability to define a full CI pipeline in one workflow file without moving between web UIs is a clear win. Travis remains in use for some projects, and a direct comparison will continue over the coming months.