From b00dee4100ca13c6de887ddb4beb0fb53ab66584 Mon Sep 17 00:00:00 2001 From: Alex Lowe Date: Sun, 19 Jan 2025 19:24:01 -0500 Subject: [PATCH] ci: add actionlint --- .github/workflows/tests.yaml | 12 +++++++----- .pre-commit-config.yaml | 4 ++++ Makefile | 14 ++++++++++++++ 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 47f8c45..54fb797 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -22,11 +22,11 @@ jobs: - name: Begin async installations id: install run: | - pyright_change=$(sudo snap install --no-wait --classic pyright) - shellcheck_change=$(sudo snap install --no-wait shellcheck) - uv_change=$(sudo snap install --no-wait --classic astral-uv) - ruff_change=$(sudo snap install --no-wait ruff) - echo snap_changes="$pyright_change $shellcheck_change $uv_change $ruff_change" >> $GITHUB_OUTPUT + pyright_change="$(sudo snap install --no-wait --classic pyright)" + shellcheck_change="$(sudo snap install --no-wait shellcheck)" + uv_change="$(sudo snap install --no-wait --classic astral-uv)" + ruff_change="$(sudo snap install --no-wait ruff)" + echo snap_changes="$pyright_change $shellcheck_change $uv_change $ruff_change" >> "$GITHUB_OUTPUT" - name: Checkout uses: actions/checkout@v4 with: @@ -61,6 +61,7 @@ jobs: - name: Test across all Python versions shell: bash run: | + # shellcheck disable=SC2086 for python_version in $PYTHON_VERSIONS; do echo ::group::Python $python_version make test UV_PYTHON=$python_version @@ -71,6 +72,7 @@ jobs: - name: Test with the lowest supported libraries shell: bash run: | + # shellcheck disable=SC2086 for python_version in $PYTHON_VERSIONS; do echo ::group::Python $python_version make test UV_PYTHON=$python_version UV_RESOLUTION=lowest diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1c12f1a..1e2ae1a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,3 +30,7 @@ repos: - id: rstcheck additional_dependencies: - rstcheck[toml,sphinx] + - repo: https://github.com/rhysd/actionlint + rev: v1.7.7 + hooks: + - id: actionlint diff --git a/Makefile b/Makefile index 77fb2af..846b5da 100644 --- a/Makefile +++ b/Makefile @@ -37,6 +37,10 @@ lint-types: uv run --group lint pyright uv run --group lint mypy +.PHONY: lint-actions +lint-actions: install-actionlint + actionlint + .PHONY: test test: uv run pytest @@ -61,3 +65,13 @@ else $(warning Unknown how to install dependencies on this system. Please install the equivalents of the following debian packages:) $(info libxml2-dev libxslt1-dev clang) endif + +.PHONY: install-actionlint +install-actionlint: +ifneq ($(shell which actionlint),) + @# Actionlint already installed +else ifneq ($(shell which go),) + go install github.com/rhysd/actionlint/cmd/actionlint@latest +else + $(error Please install go to use actionlint) +endif