refactor: move shellcheck to separate job

This commit is contained in:
Joe Previte 2022-09-16 21:53:16 -07:00
parent 93f6fd2482
commit f36c1f5b91
No known key found for this signature in database
GPG Key ID: 2C91590C6B742C24
3 changed files with 45 additions and 1 deletions

View File

@ -64,6 +64,50 @@ jobs:
run: yarn lint run: yarn lint
if: success() if: success()
lint-sh:
name: Lint shell files
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v23.2
with:
files: |
**.sh
**.bats
- name: Install Node.js v16
if: steps.changed-files.outputs.any_changed == 'true'
uses: actions/setup-node@v3
with:
node-version: "16"
- name: Fetch dependencies from cache
if: steps.changed-files.outputs.any_changed == 'true'
id: cache-yarn
uses: actions/cache@v3
with:
path: "node_modules"
key: yarn-build-${{ hashFiles('yarn.lock') }}
restore-keys: |
yarn-build-
- name: Install dependencies
if: steps.changed-files.outputs.any_changed == 'true' && steps.cache-yarn.outputs.cache-hit != 'true'
run: SKIP_SUBMODULE_DEPS=1 yarn --frozen-lockfile
- name: Lint shell files
if: steps.changed-files.outputs.any_changed == 'true'
run: yarn lint:sh
- name: Fail workflow
if: failure()
uses: andymckay/cancel-action@0.2
build: build:
name: Build name: Build
needs: prebuild needs: prebuild

View File

@ -6,7 +6,6 @@ main() {
eslint --max-warnings=0 --fix $(git ls-files "*.ts" "*.tsx" "*.js" | grep -v "lib/vscode") eslint --max-warnings=0 --fix $(git ls-files "*.ts" "*.tsx" "*.js" | grep -v "lib/vscode")
tsc --noEmit --skipLibCheck tsc --noEmit --skipLibCheck
shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090,SC2002 $(git ls-files "*.sh" | grep -v "lib/vscode")
if command -v helm && helm kubeval --help > /dev/null; then if command -v helm && helm kubeval --help > /dev/null; then
helm kubeval ci/helm-chart helm kubeval ci/helm-chart
fi fi

View File

@ -27,6 +27,7 @@
"_audit": "./ci/dev/audit.sh", "_audit": "./ci/dev/audit.sh",
"fmt": "./ci/dev/fmt.sh", "fmt": "./ci/dev/fmt.sh",
"lint": "./ci/dev/lint.sh", "lint": "./ci/dev/lint.sh",
"lint:sh": "shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090,SC2002 $(git ls-files '*.sh' | grep -v 'lib/vscode')",
"test": "echo 'Run yarn test:unit or yarn test:e2e' && exit 1", "test": "echo 'Run yarn test:unit or yarn test:e2e' && exit 1",
"ci": "./ci/dev/ci.sh", "ci": "./ci/dev/ci.sh",
"watch": "VSCODE_DEV=1 VSCODE_IPC_HOOK_CLI= NODE_OPTIONS='--max_old_space_size=32384 --trace-warnings' ts-node ./ci/dev/watch.ts", "watch": "VSCODE_DEV=1 VSCODE_IPC_HOOK_CLI= NODE_OPTIONS='--max_old_space_size=32384 --trace-warnings' ts-node ./ci/dev/watch.ts",