#!/usr/bin/env bash # Smoke test for the runner image. Runs inside the built image: # docker run --rm -i bash -s -- < tests/default.sh # shellcheck disable=SC1091,SC2016 set -euo pipefail version="${1:?usage: default.sh }" . /etc/os-release [[ "${VERSION_ID}" == "${version}" ]] || { echo "expected Ubuntu ${version}, got ${VERSION_ID}" >&2 exit 1 } # The runner relies on these to detect the image and the tool cache. [[ "${ImageOS}" == "ubuntu${version%%.*}" ]] || { echo "bad ImageOS: ${ImageOS}" >&2; exit 1; } [[ "${IMAGE_OS}" == "ubuntu${version%%.*}" ]] || { echo "bad IMAGE_OS: ${IMAGE_OS}" >&2; exit 1; } [[ "${AGENT_TOOLSDIRECTORY}" == /opt/hostedtoolcache ]] [[ "${RUNNER_TOOL_CACHE}" == /opt/hostedtoolcache ]] [[ "${USER}" == root ]] # setup-node must find a complete node tool-cache entry, otherwise it downloads node. node_dir="$(echo /opt/hostedtoolcache/node/*/x64)" [[ -f "${node_dir}.complete" ]] || { echo "no complete node tool cache entry" >&2; exit 1; } test -w "${node_dir}" su nobody -s /bin/sh -c 'test -w /opt/hostedtoolcache && test -w /opt/pipx/venvs && test -w /opt/pipx_bin' test -d /github git config --system --get-all safe.directory | grep -qxF '*' # Everything below is what workflows used to download on every run. node --version npm --version pnpm --version corepack --version python3 --version docker --version docker buildx version docker compose version git --version git lfs version jq --version yq --version tea --version go version rustc --version cargo --version cargo zigbuild --help > /dev/null rustup target list --installed | grep -qx 'aarch64-unknown-linux-musl' zig version gh --version trivy --version nfpm --version yamllint --version echo "smoke test passed for Ubuntu ${version}"