diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 9418dd5..2ca7351 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -26,6 +26,9 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Install the build dependencies + run: ./packaging/install-ci-deps.sh + - name: Check the version files agree run: ./packaging/check-version.sh diff --git a/.gitea/workflows/package.yml b/.gitea/workflows/package.yml index 939b71e..a4d3449 100644 --- a/.gitea/workflows/package.yml +++ b/.gitea/workflows/package.yml @@ -31,6 +31,9 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Install the build dependencies + run: ./packaging/install-ci-deps.sh + - name: Check the version files agree run: ./packaging/check-version.sh @@ -74,6 +77,9 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Install the build dependencies + run: ./packaging/install-ci-deps.sh + - name: Read the version file id: version run: echo "version=$(./packaging/check-version.sh)" >> "$GITHUB_OUTPUT" diff --git a/packaging/install-ci-deps.sh b/packaging/install-ci-deps.sh new file mode 100755 index 0000000..7ef05ed --- /dev/null +++ b/packaging/install-ci-deps.sh @@ -0,0 +1,44 @@ +#!/bin/sh +# Install on the Arch CI runner everything the linter, ./dev.sh build and +# makepkg need. Idempotent: nothing is handed to pacman when it is already +# installed, and sudo is only used when something is actually missing. +# +# The runner user needs passwordless sudo for pacman the first time; once the +# packages are there, the script is a no-op and no privilege is required. +set -eu + +packages="git go python pkgconf ncurses rsync which file jq curl nodejs ruff \ + harfbuzz zlib libpng lcms2 xxhash openssl shader-slang pixman cairo freetype2 \ + fontconfig libcanberra systemd-libs simde libx11 libxcb libxrandr libxinerama \ + libxcursor libxi libxrender xorgproto libxkbcommon libxkbcommon-x11 mesa dbus \ + wayland wayland-protocols wayland-utils tar xz kitty-shell-integration \ + kitty-terminfo" + +missing="" +for package in $packages; do + if ! pacman -Q "$package" > /dev/null 2>&1; then + missing="$missing $package" + fi +done + +# base-devel is a group, so verbose queries do not report it as a package. +for tool in gcc make fakeroot; do + if ! command -v "$tool" > /dev/null 2>&1; then + missing="$missing base-devel" + break + fi +done + +if [ -z "$missing" ]; then + echo 'All the build dependencies are already installed.' + exit 0 +fi + +echo "Installing:$missing" +# pacman refuses to run without a terminal prompt for the password when the +# runner user has no NOPASSWD rule; fail with the list instead of hanging. +if ! sudo -n pacman -S --needed --noconfirm $missing; then + echo "::error::could not install:$missing" + echo '::error::give the runner user passwordless sudo for pacman or preinstall these packages.' + exit 1 +fi