diff --git a/.github/workflows/test-exercises.yml b/.github/workflows/test-exercises.yml index 641e204d..6df15fd8 100644 --- a/.github/workflows/test-exercises.yml +++ b/.github/workflows/test-exercises.yml @@ -22,11 +22,10 @@ jobs: - uses: actions/checkout@v6 - name: Install REUSE run: | - ./CI/setup-uv.sh - uv pip install reuse + ./CI/install-uv.sh - name: Validate presence of copyright and license info (python w/reuse) run: | - uv run reuse lint + uvx reuse lint test-exercise: timeout-minutes: 30 runs-on: ubuntu-latest @@ -40,7 +39,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Install build dependencies shell: bash diff --git a/CI/install-uv.sh b/CI/install-uv.sh new file mode 100755 index 00000000..4a9d68d2 --- /dev/null +++ b/CI/install-uv.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +# SPDX-FileCopyrightText: 2026 The P4 Language Consortium +# SPDX-License-Identifier: Apache-2.0 + +set -eu + +UV_VERSION="${UV_VERSION:-0.11.7}" +UV_INSTALL_DIR="${HOME}/.local/bin" + +if command -v uv >/dev/null 2>&1; then + exit 0 +fi + +mkdir -p "${UV_INSTALL_DIR}" + +if command -v curl >/dev/null 2>&1; then + env UV_UNMANAGED_INSTALL="${UV_INSTALL_DIR}" \ + sh -c "$(curl -LsSf https://astral.sh/uv/${UV_VERSION}/install.sh)" +elif command -v wget >/dev/null 2>&1; then + env UV_UNMANAGED_INSTALL="${UV_INSTALL_DIR}" \ + sh -c "$(wget -qO- https://astral.sh/uv/${UV_VERSION}/install.sh)" +else + echo "Neither curl nor wget is available to install uv" >&2 + exit 1 +fi + +export PATH="${UV_INSTALL_DIR}:${PATH}" +if [ -n "${GITHUB_PATH:-}" ]; then + echo "${UV_INSTALL_DIR}" >> "${GITHUB_PATH}" +fi diff --git a/CI/setup-uv.sh b/CI/setup-uv.sh deleted file mode 100755 index 2d24c3b6..00000000 --- a/CI/setup-uv.sh +++ /dev/null @@ -1,16 +0,0 @@ -#! /bin/bash - -# SPDX-FileCopyrightText: 2026 Andy Fingerhut -# -# SPDX-License-Identifier: Apache-2.0 - -sudo apt-get update -# Set up uv for Python dependency management. -# TODO: Consider using a system-provided package here. -sudo apt-get install -y curl -curl -LsSf https://astral.sh/uv/0.6.12/install.sh | sh -# Ensure uv is in the PATH -export PATH="${PATH}:$HOME/.local/bin" -# Create a venv for use by uv, without needing a pyproject.toml file for the project. -uv venv -uv tool update-shell