Skip to content

Commit f36c1f5

Browse files
committed
refactor: move shellcheck to separate job
1 parent 93f6fd2 commit f36c1f5

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

.github/workflows/build.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,50 @@ jobs:
6464
run: yarn lint
6565
if: success()
6666

67+
lint-sh:
68+
name: Lint shell files
69+
runs-on: ubuntu-latest
70+
timeout-minutes: 5
71+
steps:
72+
- name: Checkout repo
73+
uses: actions/checkout@v3
74+
75+
- name: Get changed files
76+
id: changed-files
77+
uses: tj-actions/changed-files@v23.2
78+
with:
79+
files: |
80+
**.sh
81+
**.bats
82+
83+
- name: Install Node.js v16
84+
if: steps.changed-files.outputs.any_changed == 'true'
85+
uses: actions/setup-node@v3
86+
with:
87+
node-version: "16"
88+
89+
- name: Fetch dependencies from cache
90+
if: steps.changed-files.outputs.any_changed == 'true'
91+
id: cache-yarn
92+
uses: actions/cache@v3
93+
with:
94+
path: "node_modules"
95+
key: yarn-build-${{ hashFiles('yarn.lock') }}
96+
restore-keys: |
97+
yarn-build-
98+
99+
- name: Install dependencies
100+
if: steps.changed-files.outputs.any_changed == 'true' && steps.cache-yarn.outputs.cache-hit != 'true'
101+
run: SKIP_SUBMODULE_DEPS=1 yarn --frozen-lockfile
102+
103+
- name: Lint shell files
104+
if: steps.changed-files.outputs.any_changed == 'true'
105+
run: yarn lint:sh
106+
107+
- name: Fail workflow
108+
if: failure()
109+
uses: andymckay/cancel-action@0.2
110+
67111
build:
68112
name: Build
69113
needs: prebuild

ci/dev/lint.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ main() {
66

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

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"_audit": "./ci/dev/audit.sh",
2828
"fmt": "./ci/dev/fmt.sh",
2929
"lint": "./ci/dev/lint.sh",
30+
"lint:sh": "shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090,SC2002 $(git ls-files '*.sh' | grep -v 'lib/vscode')",
3031
"test": "echo 'Run yarn test:unit or yarn test:e2e' && exit 1",
3132
"ci": "./ci/dev/ci.sh",
3233
"watch": "VSCODE_DEV=1 VSCODE_IPC_HOOK_CLI= NODE_OPTIONS='--max_old_space_size=32384 --trace-warnings' ts-node ./ci/dev/watch.ts",

0 commit comments

Comments
 (0)