Setup actionlint and shellcheck prior to running pre-commit

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
Pedro Algarvio 2023-01-31 05:39:43 +00:00
parent 736a7ca16f
commit 3d89f81fb5
No known key found for this signature in database
GPG key ID: BB36BF6584A298FF
4 changed files with 68 additions and 2 deletions

View file

@ -0,0 +1,29 @@
---
name: setup-actionlint
description: Setup actionlint
inputs:
version:
description: The version of actionlint
default: v1.6.23
runs:
using: composite
steps:
- name: Cache actionlint Binary
uses: actions/cache@v3
with:
path: /usr/local/bin/actionlint
key: ${{ runner.os }}-${{ runner.arch }}-actionlint-${{ inputs.version }}
- name: Setup actionlint
shell: bash
run: |
if ! command -v actionlint; then
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/${{ inputs.version }}/scripts/download-actionlint.bash)
mv ./actionlint /usr/local/bin/actionlint
fi
- name: Show actionlint Version
shell: bash
run: |
actionlint --version

View file

@ -0,0 +1,31 @@
---
name: setup-shellcheck
description: Setup shellcheck
inputs:
version:
description: The version of shellcheck
default: v0.9.0
runs:
using: composite
steps:
- name: Cache shellcheck Binary
uses: actions/cache@v3
with:
path: /usr/local/bin/shellcheck
key: ${{ runner.os }}-${{ runner.arch }}-shellcheck-${{ inputs.version }}
- name: Setup shellcheck
shell: bash
run: |
if ! command -v shellcheck; then
wget https://github.com/koalaman/shellcheck/releases/download/${{ inputs.version }}/shellcheck-${{ inputs.version }}.${{ runner.os }}.x86_64.tar.xz
tar xf shellcheck-${{ inputs.version }}.${{ runner.os }}.x86_64.tar.xz
mv shellcheck-${{ inputs.version }}/shellcheck /usr/local/bin/shellcheck
rm -rf shellcheck-${{ inputs.version }}.${{ runner.os }}.x86_64.tar.xz shellcheck-${{ inputs.version }}
fi
- name: Show shellcheck Version
shell: bash
run: |
shellcheck --version

View file

@ -26,17 +26,19 @@ jobs:
run: |
echo "deb http://deb.debian.org/debian buster-backports main" >> /etc/apt/sources.list
apt-get update
apt-get install -y enchant git gcc make zlib1g-dev libc-dev libffi-dev g++ libxml2 libxml2-dev libxslt-dev libcurl4-openssl-dev libssl-dev libgnutls28-dev
apt-get install -y wget curl enchant git gcc make zlib1g-dev libc-dev libffi-dev g++ libxml2 libxml2-dev libxslt-dev libcurl4-openssl-dev libssl-dev libgnutls28-dev
apt-get install -y git/buster-backports
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-actionlint
- uses: ./.github/actions/setup-shellcheck
- name: Install Pre-Commit
env:
PIP_INDEX_URL: https://pypi-proxy.saltstack.net/root/local/+simple/
PIP_EXTRA_INDEX_URL: https://pypi.org/simple
run: |
pip install wheel pre-commit==${PRE_COMMIT_VERSION}
pip install wheel "pre-commit==${PRE_COMMIT_VERSION}"
pre-commit install --install-hooks
- name: Check ALL Files On Branch

View file

@ -28,6 +28,10 @@ repos:
args:
- pre-commit
- actionlint
additional_dependencies:
- boto3==1.21.46
- pyyaml==6.0
- jinja2==3.1.2
- repo: https://github.com/saltstack/pip-tools-compile-impersonate
rev: "4.6"