Skip to content

Commit c59b800

Browse files
Significantly simplify dep setup and add more CI platforms
1 parent b8f7c92 commit c59b800

File tree

7 files changed

+278
-137
lines changed

7 files changed

+278
-137
lines changed

.github/workflows/ci.yml

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,12 @@ jobs:
2121
strategy:
2222
matrix:
2323
alpine_version:
24-
- "3.21"
25-
- "3.20"
2624
- "3.19"
25+
- "3.20"
26+
- "3.21"
27+
- "3.22"
28+
- latest
29+
- edge
2730
# This arg is formatted in this way so that it is easily understandable in
2831
# the GitHub Actions web interface
2932
vcpkg_arg: &vcpkg_arg
@@ -39,6 +42,40 @@ jobs:
3942
--alpine_version=${{matrix.alpine_version}} \
4043
--${{matrix.vcpkg_arg}}
4144
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
72+
steps:
73+
- *checkout
74+
- run: |
75+
bash tools/earthly.sh +build-debian \
76+
--debian_version=${{matrix.debian_version}} \
77+
--${{matrix.vcpkg_arg}}
78+
4279
build-gcc-matrix:
4380
strategy:
4481
fail-fast: true

Earthfile

Lines changed: 62 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,40 @@ ARG --global default_container_registry = "docker.io"
55

66
build-gcc:
77
ARG --required gcc_version
8+
# GCC provides a GCC container, based on Debian
89
FROM $default_container_registry/gcc:$gcc_version
9-
ARG warnings_as_errors=true
10-
DO --pass-args +BOOTSTRAP_BUILD_INSTALL_EXPORT \
11-
--warnings_as_errors=$warnings_as_errors \
12-
--build_deps "ccache" \
13-
--vcpkg_bs_deps "build-essential perl git pkg-config linux-libc-dev curl zip unzip"
10+
DO --pass-args +BOOTSTRAP_BUILD_INSTALL_EXPORT
1411

1512
build-clang:
1613
ARG --required clang_version_major
14+
# LLVM doesn't provide a container, so we just use Ubuntu and the automated
15+
# LLVM installser script to get the appropriate major version
1716
FROM $default_container_registry/ubuntu:24.04
1817
DO +INIT
1918
# Required for the LLVM installer:
2019
RUN __install lsb-release software-properties-common gnupg
20+
# Install the major version using the automated LLVM installer:
2121
RUN curl -Ls https://apt.llvm.org/llvm.sh -o llvm.sh && \
2222
bash llvm.sh "$clang_version_major"
23+
# Declare our preferred compiler version using CC and CXX env vars
2324
ENV CC=clang-$clang_version_major
2425
ENV CXX=clang++-$clang_version_major
25-
ARG warnings_as_errors=true
26-
DO --pass-args +BOOTSTRAP_BUILD_INSTALL_EXPORT \
27-
--warnings_as_errors=$warnings_as_errors \
28-
--build_deps "ccache" \
29-
--vcpkg_bs_deps "build-essential perl git pkg-config linux-libc-dev curl zip unzip"
26+
DO --pass-args +BOOTSTRAP_BUILD_INSTALL_EXPORT
3027

3128
build-alpine:
3229
ARG alpine_version=3.20
3330
FROM $default_container_registry/alpine:$alpine_version
34-
ARG warnings_as_errors=true
35-
DO --pass-args +BOOTSTRAP_BUILD_INSTALL_EXPORT \
36-
--build_deps "build-base git cmake gcc g++ ninja make ccache python3" \
37-
--vcpkg_bs_deps "pkgconfig linux-headers perl bash tar zip unzip curl" \
38-
--third_deps "fmt-dev boost-dev openssl-dev"
31+
DO --pass-args +BOOTSTRAP_BUILD_INSTALL_EXPORT
3932

4033
build-debian:
41-
FROM $default_container_registry/debian:12
42-
DO --pass-args +BOOTSTRAP_BUILD_INSTALL_EXPORT \
43-
--build_deps "build-essential cmake git ninja-build python3 ccache" \
44-
--vcpkg_bs_deps "perl pkg-config linux-libc-dev curl zip unzip" \
45-
--third_deps "libfmt-dev libboost-url1.81-dev libboost-container1.81-dev libssl-dev"
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
4642

4743
build-rl:
4844
FROM $default_container_registry/rockylinux:8
@@ -88,13 +84,17 @@ run:
8884
# Miscellaneous system init
8985
INIT:
9086
FUNCTION
91-
COPY --chmod=755 tools/__install tools/__bool tools/__boolstr /usr/local/bin/
92-
RUN __install curl
87+
COPY --chmod=755 tools/__tool /usr/local/bin/__tool
88+
RUN __tool __init
89+
# Basic requirements to even function:
90+
RUN __install lsb-release curl
91+
92+
# Obtain uv
9393
ARG uv_version = "0.8.15"
9494
ARG uv_install_sh_url = "https://astral.sh/uv/$uv_version/install.sh"
95-
IF ! uv --version
96-
RUN (curl -LsSf "$uv_install_sh_url" || wget -qO- "$uv_install_sh_url") \
97-
| env UV_UNMANAGED_INSTALL=/opt/uv sh - \
95+
IF ! test -f /usr/local/bin/uv
96+
RUN curl -LsSf "$uv_install_sh_url" \
97+
| env UV_UNMANAGED_INSTALL=/opt/uv sh - \
9898
&& ln -s /opt/uv/uv /usr/local/bin/uv \
9999
&& uv --version
100100
END
@@ -113,28 +113,47 @@ BOOTSTRAP_BUILD_INSTALL_EXPORT:
113113
BOOTSTRAP_DEPS:
114114
FUNCTION
115115
DO +INIT
116-
# Dependencies that are required for the build. Always installed
117-
ARG build_deps
118-
RUN __install $build_deps
119-
# Switch behavior based on whether we use vcpkg
116+
# Do we want to use vcpkg?
120117
ARG use_vcpkg=true
121-
IF ! __bool $use_vcpkg
122-
# No vcpkg. Install system dependencies
123-
ARG third_deps
124-
RUN __install $third_deps
125-
# Install system deps for testing, if needed
126-
ARG test_deps
127-
ARG test=true
128-
IF $test
129-
RUN __install $test_deps
118+
# Are we installing test-only dependencies?
119+
ARG test=true
120+
121+
IF __bool $test
122+
# We use Git to obtain certain test artifacts.
123+
RUN __install git
124+
END
125+
126+
IF __distro_is "Alpine-*"
127+
# Basic Alpine requirements:
128+
RUN __install build-base
129+
IF __bool $use_vcpkg
130+
# Requirements for vcpkg to install our dependencies:
131+
RUN __install pkgconfig linux-headers perl bash tar zip unzip git
132+
ELSE
133+
# Our dependencies, obtained from the system package manager:
134+
RUN __install fmt-dev boost-dev openssl-dev
130135
END
131-
ELSE
132-
# vcpkg may have dependencies that need to be installed to bootstrap
133-
ARG vcpkg_bs_deps
134-
RUN __install $vcpkg_bs_deps
136+
ELSE IF __distro_is "Debian-*" "Ubuntu-*"
137+
RUN __install build-essential
138+
IF __bool $use_vcpkg
139+
RUN __install zip unzip pkg-config
140+
ELSE
141+
RUN __install libfmt-dev libssl-dev
142+
IF apt-cache show libboost-url-dev 2>&1 > /dev/null
143+
# Install the default version, if available
144+
RUN __install libboost-url-dev libboost-container-dev
145+
ELSE
146+
# Older debian requires qualified versions
147+
RUN __install libboost-url1.81-dev libboost-container1.81-dev
148+
END
149+
END
150+
END
151+
152+
# Do some additional setup for vcpkg
153+
IF __bool $use_vcpkg
135154
# Required when bootstrapping vcpkg on Alpine:
136155
ENV VCPKG_FORCE_SYSTEM_BINARIES=1
137-
# Bootstrap dependencies
156+
# Bootstrap dependencies, warming the user-local binary cache
138157
LET src_tmp=/s-tmp
139158
WORKDIR $src_tmp
140159
COPY --dir vcpkg*.json $src_tmp

tools/__bool

Lines changed: 0 additions & 15 deletions
This file was deleted.

tools/__boolstr

Lines changed: 0 additions & 9 deletions
This file was deleted.

tools/__install

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)