From bb838c62019868b6055112897ad229e33196c047 Mon Sep 17 00:00:00 2001 From: Dimitris Marlagkoutsos Date: Thu, 24 Oct 2024 19:04:15 +0200 Subject: [PATCH 1/4] remove ts lint from lint-staged and add it on ci step --- .github/workflows/lint-build-test.yml | 26 +++++++++++++------------- package.json | 3 +-- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/.github/workflows/lint-build-test.yml b/.github/workflows/lint-build-test.yml index 319f02df1..f2d71a8c7 100644 --- a/.github/workflows/lint-build-test.yml +++ b/.github/workflows/lint-build-test.yml @@ -32,8 +32,8 @@ jobs: echo "child-workspace-package-names=$(yarn workspaces list --json | jq --slurp --raw-output 'map(.name) | @json')" >> "$GITHUB_OUTPUT" shell: bash - lint: - name: Lint + build: + name: Build runs-on: ubuntu-latest needs: prepare strategy: @@ -53,7 +53,7 @@ jobs: node-version: ${{ matrix.node-version }} cache: yarn - run: yarn --immutable - - run: yarn lint + - run: yarn build - name: Require clean working directory shell: bash run: | @@ -61,14 +61,13 @@ jobs: echo "Working tree dirty at end of job" exit 1 fi + outputs: + cache-key: ${{ steps.cache.outputs.cache-hit }} - validate-changelog: - name: Validate changelog + lint: + name: Lint runs-on: ubuntu-latest - needs: prepare - strategy: - matrix: - node-version: [20.x] + needs: build steps: - uses: actions/checkout@v4 - name: Install Node.js ${{ matrix.node-version }} @@ -83,7 +82,8 @@ jobs: node-version: ${{ matrix.node-version }} cache: yarn - run: yarn --immutable - - run: yarn changelog:validate + - run: yarn lint + - run: yarn lint:ts - name: Require clean working directory shell: bash run: | @@ -92,8 +92,8 @@ jobs: exit 1 fi - build: - name: Build + validate-changelog: + name: Validate changelog runs-on: ubuntu-latest needs: prepare strategy: @@ -113,7 +113,7 @@ jobs: node-version: ${{ matrix.node-version }} cache: yarn - run: yarn --immutable - - run: yarn build + - run: yarn changelog:validate - name: Require clean working directory shell: bash run: | diff --git a/package.json b/package.json index 74b28f809..89298bd54 100644 --- a/package.json +++ b/package.json @@ -39,8 +39,7 @@ }, "lint-staged": { "*.{js,mjs,cjs,ts,mts,cts}": [ - "eslint --fix", - "bash -c 'yarn lint:ts'" + "eslint --fix" ], "!(CHANGELOG).{json,html,md,yml}": [ "prettier --write" From b0361f8ecb1466ec02967074ca235b008161e9a2 Mon Sep 17 00:00:00 2001 From: Dimitris Marlagkoutsos Date: Thu, 24 Oct 2024 19:15:41 +0200 Subject: [PATCH 2/4] fixing config --- .github/workflows/lint-build-test.yml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint-build-test.yml b/.github/workflows/lint-build-test.yml index f2d71a8c7..b70e2d942 100644 --- a/.github/workflows/lint-build-test.yml +++ b/.github/workflows/lint-build-test.yml @@ -61,13 +61,20 @@ jobs: echo "Working tree dirty at end of job" exit 1 fi - outputs: - cache-key: ${{ steps.cache.outputs.cache-hit }} + - name: Cache build output for workspaces + uses: actions/cache@v3 + with: + path: | + ./packages/*/dist + key: build-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} lint: name: Lint runs-on: ubuntu-latest needs: build + strategy: + matrix: + node-version: [20.x] steps: - uses: actions/checkout@v4 - name: Install Node.js ${{ matrix.node-version }} @@ -82,6 +89,15 @@ jobs: node-version: ${{ matrix.node-version }} cache: yarn - run: yarn --immutable + - name: Restore build cache for workspaces + uses: actions/cache@v3 + with: + path: | + ./packages/*/dist + key: build-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + build-${{ matrix.node-version }}- + build- - run: yarn lint - run: yarn lint:ts - name: Require clean working directory From ccc4150464b7340933edcaa705fbb603d0f0c4e9 Mon Sep 17 00:00:00 2001 From: Dimitris Marlagkoutsos Date: Thu, 24 Oct 2024 19:21:22 +0200 Subject: [PATCH 3/4] revert to run lint:ts after build --- .github/workflows/lint-build-test.yml | 38 +++++++++------------------ 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/.github/workflows/lint-build-test.yml b/.github/workflows/lint-build-test.yml index b70e2d942..4af3ea32c 100644 --- a/.github/workflows/lint-build-test.yml +++ b/.github/workflows/lint-build-test.yml @@ -32,8 +32,8 @@ jobs: echo "child-workspace-package-names=$(yarn workspaces list --json | jq --slurp --raw-output 'map(.name) | @json')" >> "$GITHUB_OUTPUT" shell: bash - build: - name: Build + lint: + name: Lint runs-on: ubuntu-latest needs: prepare strategy: @@ -53,7 +53,7 @@ jobs: node-version: ${{ matrix.node-version }} cache: yarn - run: yarn --immutable - - run: yarn build + - run: yarn lint - name: Require clean working directory shell: bash run: | @@ -61,17 +61,11 @@ jobs: echo "Working tree dirty at end of job" exit 1 fi - - name: Cache build output for workspaces - uses: actions/cache@v3 - with: - path: | - ./packages/*/dist - key: build-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} - lint: - name: Lint + validate-changelog: + name: Validate changelog runs-on: ubuntu-latest - needs: build + needs: prepare strategy: matrix: node-version: [20.x] @@ -89,17 +83,7 @@ jobs: node-version: ${{ matrix.node-version }} cache: yarn - run: yarn --immutable - - name: Restore build cache for workspaces - uses: actions/cache@v3 - with: - path: | - ./packages/*/dist - key: build-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - build-${{ matrix.node-version }}- - build- - - run: yarn lint - - run: yarn lint:ts + - run: yarn changelog:validate - name: Require clean working directory shell: bash run: | @@ -108,8 +92,8 @@ jobs: exit 1 fi - validate-changelog: - name: Validate changelog + build: + name: Build runs-on: ubuntu-latest needs: prepare strategy: @@ -129,7 +113,9 @@ jobs: node-version: ${{ matrix.node-version }} cache: yarn - run: yarn --immutable - - run: yarn changelog:validate + - run: yarn build + - name: Check for TypeScript issues + run: yarn lint:ts - name: Require clean working directory shell: bash run: | From d2f65f80a2ac1422f04b38aef8600a2a4be971e1 Mon Sep 17 00:00:00 2001 From: Dimitris Marlagkoutsos Date: Thu, 24 Oct 2024 19:30:46 +0200 Subject: [PATCH 4/4] Add note Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com> --- .github/workflows/lint-build-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/lint-build-test.yml b/.github/workflows/lint-build-test.yml index 4af3ea32c..ec7cb35b0 100644 --- a/.github/workflows/lint-build-test.yml +++ b/.github/workflows/lint-build-test.yml @@ -114,6 +114,7 @@ jobs: cache: yarn - run: yarn --immutable - run: yarn build + # Due to our use of Node16 module resolution, we have to build before running type checks. - name: Check for TypeScript issues run: yarn lint:ts - name: Require clean working directory