From 103f1dd78c9ea4f946401883879672090c680ff5 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Mon, 7 Oct 2024 19:40:02 +0000 Subject: [PATCH] actionlint: Switch to prebuilt binary instead of docker Previously `format.sh` and the github workflow used docker or podman to run actionlint. This now will use an installed version if found, and will otherwise download and run a prebuilt binary from a github release. Signed-off-by: Russell Bryant --- .github/workflows/actionlint.dockerfile | 3 --- .github/workflows/actionlint.yml | 9 ++------- .gitignore | 3 +++ format.sh | 22 +--------------------- tools/actionlint.sh | 13 +++++++++++++ 5 files changed, 19 insertions(+), 31 deletions(-) delete mode 100644 .github/workflows/actionlint.dockerfile create mode 100755 tools/actionlint.sh diff --git a/.github/workflows/actionlint.dockerfile b/.github/workflows/actionlint.dockerfile deleted file mode 100644 index 01ac68066d44e..0000000000000 --- a/.github/workflows/actionlint.dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -# Since dependabot cannot update workflows using docker, -# we use this indirection since dependabot can update this file. -FROM docker.io/rhysd/actionlint:1.7.1@sha256:435ecdb63b1169e80ca3e136290072548c07fc4d76a044cf5541021712f8f344 diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml index be8964dbe699b..38e23651eefef 100644 --- a/.github/workflows/actionlint.yml +++ b/.github/workflows/actionlint.yml @@ -32,11 +32,6 @@ jobs: with: fetch-depth: 0 - - name: "Download actionlint" + - name: "Run actionlint" run: | - docker build --tag actionlint - < .github/workflows/actionlint.dockerfile - - - name: "Check workflow files" - run: | - echo "::add-matcher::.github/workflows/matchers/actionlint.json" - docker run --volume="${PWD}:/repo" --workdir=/repo actionlint -color + tools/actionlint.sh -color diff --git a/.gitignore b/.gitignore index 5367ece834890..1ea6e3419db2a 100644 --- a/.gitignore +++ b/.gitignore @@ -199,3 +199,6 @@ hip_compat.h # Benchmark dataset benchmarks/*.json + +# Linting +actionlint diff --git a/format.sh b/format.sh index 7769548c2f659..a0df92b350133 100755 --- a/format.sh +++ b/format.sh @@ -287,27 +287,7 @@ fi echo 'vLLM clang-format: Done' echo 'vLLM actionlint:' - -DOCKER="" -if command -v "docker" &>/dev/null; then - DOCKER="docker" -elif command -v "podman" &>/dev/null; then - DOCKER="podman" -else - echo "Docker or Podman are not installed. Please install one if you want to lint GitHub CI configuration." -fi - -actionlint() { - if [ -z "$DOCKER" ]; then - return - fi - # Ensure we use the same version of actionlint as CI - IMAGE="vllm/actionlint:latest" - ${DOCKER} build --tag "${IMAGE}" - < .github/workflows/actionlint.dockerfile - ${DOCKER} run --volume="${PWD}:/repo:z" --workdir=/repo "${IMAGE}" -color -} - -actionlint +tools/actionlint.sh -color echo 'vLLM actionlint: Done' if ! git diff --quiet &>/dev/null; then diff --git a/tools/actionlint.sh b/tools/actionlint.sh new file mode 100755 index 0000000000000..f6a8b5e83a2de --- /dev/null +++ b/tools/actionlint.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +if command -v actionlint &> /dev/null; then + actionlint "$@" + exit 0 +elif [ -x ./actionlint ]; then + ./actionlint "$@" + exit 0 +fi + +# download a binary to the current directory - v1.7.3 +bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/aa0a7be8e566b096e64a5df8ff290ec24fa58fbc/scripts/download-actionlint.bash) +./actionlint "$@"