mirror of
https://github.com/saltstack/salt.git
synced 2025-04-15 17:20:19 +00:00
Setup actionlint
and shellcheck
prior to running pre-commit
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
736a7ca16f
commit
3d89f81fb5
4 changed files with 68 additions and 2 deletions
29
.github/actions/setup-actionlint/action.yml
vendored
Normal file
29
.github/actions/setup-actionlint/action.yml
vendored
Normal 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
|
31
.github/actions/setup-shellcheck/action.yml
vendored
Normal file
31
.github/actions/setup-shellcheck/action.yml
vendored
Normal 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
|
6
.github/workflows/pre-commit-action.yml
vendored
6
.github/workflows/pre-commit-action.yml
vendored
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Add table
Reference in a new issue