Testing Julia packages on x86_64 Alpine Linux with Drone CI

Alpine Linux is a lightweight Linux distributions, the base installation can be as little as 5-6 MiB. It’s different from most common distributions in that it’s based on the musl C library.

There have already been a few official binaries of Julia for the musl C library (and so for Alpine Linux), but v1.6-rc2 is the first release where JLL packages, widely common in the ecosystem, will work properly with musl.

It’s now a good time to start testing some packages, especially those calling into binary libraries, on Alpine Linux. There is also a Docker image of Julia for Alpine, which we can use on Drone CI for testing. A .drone.yml script to run CI for a Julia package on x86_64 (aka amd64) Alpine Linux can be

---
kind: pipeline
name: linux - amd64 - Julia 1.6 (Alpine)

platform:
  os: linux
  arch: amd64

steps:
- name: Run tests
  image: julia:1.6-alpine
  commands:
  - "julia --project=. --check-bounds=yes --color=yes -e 'using InteractiveUtils; versioninfo(verbose=true)'"
  - "julia --project=. --check-bounds=yes --color=yes -e 'using Pkg; Pkg.build()'"
  - "julia --project=. --check-bounds=yes --color=yes -e 'using Pkg; Pkg.test(coverage=true)'"

trigger:
  branch:
  - main

...

This is the Jsonnet file I used to generate it:

local Pipeline(os, arch, version, alpine=false) = {
    kind: "pipeline",
    name: os+" - "+arch+" - Julia "+version+(if alpine then " (Alpine)" else ""),
    platform: {
        os: os,
        arch: arch
    },
    steps: [
        {
            name: "Run tests",
            image: "julia:"+version+(if alpine then "-alpine" else ""),
            commands: [
                "julia --project=. --check-bounds=yes --color=yes -e 'using InteractiveUtils; versioninfo(verbose=true)'",
                "julia --project=. --check-bounds=yes --color=yes -e 'using Pkg; Pkg.build()'",
                "julia --project=. --check-bounds=yes --color=yes -e 'using Pkg; Pkg.test(coverage=true)'"
            ]
        }
    ],
    trigger: {
        branch: ["main"]
    }
};

[
    # Pipeline("linux", "arm",   "1.3.1"),
    # Pipeline("linux", "arm",   "1.4.1"),
    # Pipeline("linux", "arm64", "1.3"),
    # Pipeline("linux", "arm64", "1.6"),
    Pipeline("linux", "amd64", "1.6", true),
]

Note that the same script allows you to generate the build configurations for armv7l (aka arm) and armv8l (aka arm64) platforms with Ubuntu, as explained in Testing on ARM with Drone CI, just uncomment the desired lines.

For the record, in principle you can also use the Julia Alpine Docker image in GitHub Actions to run CI of your package, but the workflow julia-actions/julia-runtest won’t work (unless you install bash), so you’d need a different workflow for that. Thus, I preferred to test on Alpine with Drone.

5 Likes