Skip to content

Commit a45d5cb

Browse files
Consolidate duplication in Earthfile
1 parent c59b800 commit a45d5cb

File tree

2 files changed

+38
-109
lines changed

2 files changed

+38
-109
lines changed

.github/workflows/ci.yml

Lines changed: 30 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -17,96 +17,42 @@ jobs:
1717
- name: Check Formatting
1818
run: make format-check PYTHON_RUN="uv run --group=format"
1919

20-
build-alpine:
20+
build-matrix:
21+
name: Build & Test
22+
runs-on: ubuntu-latest
2123
strategy:
24+
fail-fast: false
2225
matrix:
23-
alpine_version:
24-
- "3.19"
25-
- "3.20"
26-
- "3.21"
27-
- "3.22"
28-
- latest
29-
- edge
30-
# This arg is formatted in this way so that it is easily understandable in
31-
# the GitHub Actions web interface
26+
from:
27+
# Alpine
28+
- alpine:3.19
29+
- alpine:3.20
30+
- alpine:3.21
31+
- alpine:3.22
32+
- alpine:latest
33+
- alpine:edge
34+
# Ubuntu
35+
- ubuntu:24.04
36+
- ubuntu:latest
37+
# Debian
38+
- debian:12.11
39+
- debian:latest
40+
- debian:unstable
41+
# GCC versions
42+
- gcc:15.2.0
43+
- gcc:14.3.0
44+
- gcc:13.4.0
45+
- gcc:12.5.0
46+
- gcc:latest
47+
# Clang versions
48+
- +env.llvm --llvm_major_version=19
49+
- +env.llvm --llvm_major_version=20
3250
vcpkg_arg: &vcpkg_arg
3351
- use_vcpkg=false
3452
- use_vcpkg=true
35-
name: Build on Alpine
36-
runs-on: ubuntu-latest
37-
steps:
38-
- *checkout
39-
- name: Run Build
40-
run: |
41-
bash tools/earthly.sh +build-alpine \
42-
--alpine_version=${{matrix.alpine_version}} \
43-
--${{matrix.vcpkg_arg}}
44-
45-
build-ubuntu:
46-
strategy:
47-
matrix:
48-
ubuntu_version:
49-
- "24.04"
50-
- latest
51-
vcpkg_arg: *vcpkg_arg
52-
name: Build on Ubuntu
53-
runs-on: ubuntu-latest
54-
steps:
55-
- *checkout
56-
- run: |
57-
bash tools/earthly.sh +build-ubuntu \
58-
--ubuntu_version=${{matrix.ubuntu_version}} \
59-
--${{matrix.vcpkg_arg}}
60-
61-
build-debian:
62-
strategy:
63-
fail-fast: true
64-
matrix:
65-
debian_version:
66-
- "12.11"
67-
- latest
68-
- unstable
69-
vcpkg_arg: *vcpkg_arg
70-
name: Build on Debian
71-
runs-on: ubuntu-latest
7253
steps:
7354
- *checkout
7455
- run: |
75-
bash tools/earthly.sh +build-debian \
76-
--debian_version=${{matrix.debian_version}} \
56+
bash tools/earthly.sh +build \
57+
--from=${{matrix.from}} \
7758
--${{matrix.vcpkg_arg}}
78-
79-
build-gcc-matrix:
80-
strategy:
81-
fail-fast: true
82-
matrix:
83-
gcc_version:
84-
- 15.2.0
85-
- 14.3.0
86-
- 13.4.0
87-
- 12.5.0
88-
89-
runs-on: ubuntu-latest
90-
name: "Build with GCC"
91-
steps:
92-
- *checkout
93-
- name: Build
94-
run: |
95-
bash tools/earthly.sh +build-gcc \
96-
--gcc_version=${{matrix.gcc_version}}
97-
98-
build-clang-matrix:
99-
strategy:
100-
fail-fast: true
101-
matrix:
102-
version_arg:
103-
- clang_version_major=20
104-
- clang_version_major=19
105-
runs-on: ubuntu-latest
106-
name: Build with Clang
107-
steps:
108-
- *checkout
109-
- name: Build
110-
run: |
111-
bash tools/earthly.sh +build-clang \
112-
--${{matrix.version_arg}}

Earthfile

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ VERSION 0.8
33
# Tweak the default container registry used for pulling system images.
44
ARG --global default_container_registry = "docker.io"
55

6-
build-gcc:
7-
ARG --required gcc_version
8-
# GCC provides a GCC container, based on Debian
9-
FROM $default_container_registry/gcc:$gcc_version
6+
build:
7+
ARG --required from
8+
FROM --pass-args $from
109
DO --pass-args +BOOTSTRAP_BUILD_INSTALL_EXPORT
1110

12-
build-clang:
13-
ARG --required clang_version_major
11+
env.llvm:
12+
ARG --required llvm_major_version
1413
# LLVM doesn't provide a container, so we just use Ubuntu and the automated
1514
# LLVM installser script to get the appropriate major version
1615
FROM $default_container_registry/ubuntu:24.04
@@ -19,26 +18,10 @@ build-clang:
1918
RUN __install lsb-release software-properties-common gnupg
2019
# Install the major version using the automated LLVM installer:
2120
RUN curl -Ls https://apt.llvm.org/llvm.sh -o llvm.sh && \
22-
bash llvm.sh "$clang_version_major"
21+
bash llvm.sh "$llvm_major_version"
2322
# Declare our preferred compiler version using CC and CXX env vars
24-
ENV CC=clang-$clang_version_major
25-
ENV CXX=clang++-$clang_version_major
26-
DO --pass-args +BOOTSTRAP_BUILD_INSTALL_EXPORT
27-
28-
build-alpine:
29-
ARG alpine_version=3.20
30-
FROM $default_container_registry/alpine:$alpine_version
31-
DO --pass-args +BOOTSTRAP_BUILD_INSTALL_EXPORT
32-
33-
build-debian:
34-
ARG debian_version=12.11
35-
FROM $default_container_registry/debian:$debian_version
36-
DO --pass-args +BOOTSTRAP_BUILD_INSTALL_EXPORT
37-
38-
build-ubuntu:
39-
ARG ubuntu_version=24.04
40-
FROM $default_container_registry/ubuntu:$ubuntu_version
41-
DO --pass-args +BOOTSTRAP_BUILD_INSTALL_EXPORT
23+
ENV CC=clang-$llvm_major_version
24+
ENV CXX=clang++-$llvm_major_version
4225

4326
build-rl:
4427
FROM $default_container_registry/rockylinux:8

0 commit comments

Comments
 (0)