From Travis CI to GitHub Actions

From Travis CI to GitHub Actions

·

3 min read

You'll know why I'm migrating from Travis CI to GitHub Actions.

I was happy with Travis CI but I needed one feature

Travis CI

Cost for open source repositories

When you've not validated with Travis CI about your open source repository, you don't have OSS only credits. In that case, you're using the 10000 credits included with the Free plan.

At this time, I'm near 44% used this month so it's a moderate usage and my biggest repository (aiokafka) doesn't use Travis CI but GitHub Actions otherwise I'll be out of credits.

Very slow… cost more credits

It's not a joke but reality…

On my latex-builder, my latex build (executing the shell script) is:

I win 64.96 seconds, it's good… Remember that 1 minute of a run is 10 credits on Travis CI.

GitHub Actions

GitHub loves Open Source repositories

Unlimited builds for open source repositories and I love it, aiokafka has a cost of 0.

My two latest builds are:

A lot of time because tests include Linux, Mac, and Windows…

On-Premise

GitHub Actions has a runner available to install on all operating systems to send jobs to self-hosted hardware and it was the ultimate thing to invite me to migrate.

The only counterpart is a requirement, this f*cking Docker daemon. I needed to find the right host to install it because I use, exclusively, Podman.

Look at the change

Let's look at how it's a lot different between Travis CI and GitHub Actions on a private repo (my CV).

Travis CI (old CI)

language: minimal
dist: focal

git:
  quiet: true

services: docker

addons:
  apt:
    update: true
    packages:
      - rclone

before_script:
  - mkdir -p ~/.config/rclone
  - echo $rclone_b64 | base64 -d > ~/.config/rclone/rclone.conf
  - docker pull ghcr.io/sycured/latex-builder:latest

script:
  - docker run --rm -v $TRAVIS_BUILD_DIR:/shared -v /tmp:/tmp ghcr.io/sycured/latex-builder:latest

after_success:
  - bash -c "rclone copy /tmp/build_cv/cv-en.pdf $objstore:"

GitHub Actions (new CI)

name: ci
on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: [self-hosted, Linux, oraclecloud]
    container:
      image: ghcr.io/sycured/latex-builder:latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Install rclone config file
        env:
          rconf: ${{ secrets.RCLONE_CONF }}
        run: |
          echo "$rconf" | base64 -d > /rclone.conf
      - name: Build
        run: ./run.sh
      - name: Send pdf to objstore
        env:
          objstore: ${{ secrets.S3 }}
        run: "rclone --config /rclone.conf copy /tmp/build_cv/cv-en.pdf $objstore:"

I run it on one self-hosted runner, Linux host, and hosted at Oracle Cloud (I added this label to remember where it hosted the VM).

Another point, I can run directly all my steps inside my container and it's a lot more interesting than doing a docker run followed by a lot of docker exec for another repo.

No pain, no gain!