til

Today I Learned: collection of notes, tips and tricks and stuff I learn from day to day working with computers and technology as an open source contributor and product manager

View project on GitHub

Installing Dependencies and Tools

Oftentimes you need additional components to get you software to build using GitHub Actions. I fell over this very informative blog post by Edward Thomson.

He gave the following example, which pretty much outlines some good example:

name: CI

on: [push]

jobs:
  linux:
    runs-on: ubuntu-latest
    steps:
      - run: sudo apt-get install ninja-build
      - run: ninja --version

  windows:
    runs-on: windows-latest
    steps:
      - run: choco install ninja
      - run: ninja --version

  mac:
    runs-on: macos-latest
    steps:
      - run: brew install ninja
      - run: ninja --version

Example lifted from blog post by Edward Thomson.

Using the above approach I was able tweak a GitHub action build of my fork of the Perl distributionDateTime::Astro.

name: Dist::Zilla Action
on:
  push:

env:
  GMP_HOME: /usr
  MPFR_HOME: /usr

jobs:
  linux:
    runs-on: ubuntu-latest
    name: "CI"

    steps:
      - name: "Install C libraries for dependencies"
        run: sudo apt-get update && sudo apt-get install -y libmpfr-dev libgmp-dev cpanminus
      - name: "Checkout repository"
        uses: actions/checkout@v3
      - name: "Building and testing all"
        run: sudo cpanm --with-configure --installdeps . && perl Build.PL && ./Build && ./Build test

Example lifted from a branch jonasbn/DateTime-Astro

In addition to installing the required C libraries. I had to inform the build system of their presence, I did this using environment variables, following the documentation from GitHub.

Resources and References