From fe70ebf4d6bd95339ed339ea91f813671059e78b Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Fri, 16 Sep 2022 22:37:16 -0700 Subject: [PATCH] refactor: delete lint, add typecheck job --- .github/workflows/build.yaml | 47 +++++++++++++++++++++++++++++++++--- ci/dev/lint.sh | 12 --------- package.json | 2 +- 3 files changed, 44 insertions(+), 17 deletions(-) delete mode 100755 ci/dev/lint.sh diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 08b36b247..b695c7785 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -60,10 +60,6 @@ jobs: run: yarn fmt if: success() - - name: Run yarn lint - run: yarn lint - if: success() - lint-sh: name: Lint shell files runs-on: ubuntu-latest @@ -108,6 +104,49 @@ jobs: if: failure() uses: andymckay/cancel-action@0.2 + typecheck: + name: Check TypeScript types + 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: | + ./src/**/* + + - 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: Run tsc on TypeScript files + if: steps.changed-files.outputs.any_changed == 'true' + run: yarn typecheck + + - name: Fail workflow + if: failure() + uses: andymckay/cancel-action@0.2 + lint-ts: name: Lint TypeScript files runs-on: ubuntu-latest diff --git a/ci/dev/lint.sh b/ci/dev/lint.sh deleted file mode 100755 index 1542dc224..000000000 --- a/ci/dev/lint.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -main() { - cd "$(dirname "$0")/../.." - - tsc --noEmit --skipLibCheck - - cd "$OLDPWD" -} - -main "$@" diff --git a/package.json b/package.json index dd0cef023..2833c02df 100644 --- a/package.json +++ b/package.json @@ -26,11 +26,11 @@ "publish:docker": "./ci/steps/docker-buildx-push.sh", "_audit": "./ci/dev/audit.sh", "fmt": "./ci/dev/fmt.sh", - "lint": "./ci/dev/lint.sh", "lint:helm": "./ci/dedv/helm.sh", "lint:sh": "shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090,SC2002 $(git ls-files '*.sh' | grep -v 'lib/vscode')", "lint:ts": "eslint --max-warnings=0 --fix $(git ls-files '*.ts' '*.tsx' '*.js' | grep -v 'lib/vscode')", "test": "echo 'Run yarn test:unit or yarn test:e2e' && exit 1", + "typecheck": "tsc -p tsconfig.json --noEmit --skipLibCheck", "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", "icons": "./ci/dev/gen_icons.sh"