Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bfdffb4

Browse files
authored
chore: separate linting checks to their own step (typescript-eslint#1801)
If linting/formatting/spelling fails, it should not block running the tests. If they do block, they can increase the iteration time for contributors, because they will have to fix them before they can see the status of their tests. By not blocking, a contributor will be able to submit a PR, and come back ~5min later knowing they will be able to see if their code passes linting _and_ tests. This should also knock ~40-60s off of the perceived runtime, as it parallelises some of the work.
1 parent f3160b4 commit bfdffb4

File tree

2 files changed

+41
-12
lines changed

2 files changed

+41
-12
lines changed

.cspell.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"**/**/ROADMAP.md",
1212
"**/*.{json,snap}",
1313
".cspell.json",
14-
"yarn.lock"
14+
"yarn.lock",
15+
".github/workflows/**"
1516
],
1617
"dictionaries": [
1718
"typescript",

.github/workflows/ci.yml

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ env:
1313

1414
jobs:
1515
primary_code_validation_and_tests:
16-
name: Primary code validation and tests
16+
name: Typecheck and tests
1717
runs-on: ubuntu-latest
1818
steps:
1919
- uses: actions/checkout@v2
@@ -49,15 +49,6 @@ jobs:
4949
- name: Typecheck all packages
5050
run: yarn typecheck
5151

52-
- name: Check code formatting
53-
run: yarn format-check
54-
55-
- name: Run linting
56-
run: yarn lint
57-
58-
- name: Validate spelling
59-
run: yarn check:spelling
60-
6152
- name: Run unit tests
6253
run: yarn test
6354
env:
@@ -71,6 +62,43 @@ jobs:
7162
flags: unittest
7263
name: codecov
7364

65+
linting_and_style:
66+
name: Code style and lint
67+
runs-on: ubuntu-latest
68+
steps:
69+
- uses: actions/checkout@v2
70+
- name: Use Node.js ${{ env.PRIMARY_NODE_VERSION }}
71+
uses: actions/setup-node@v1
72+
with:
73+
node-version: ${{ env.PRIMARY_NODE_VERSION }}
74+
75+
- name: Get yarn cache directory path
76+
id: yarn-cache-dir-path
77+
run: echo "::set-output name=dir::$(yarn cache dir)"
78+
79+
- uses: actions/cache@v1
80+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
81+
with:
82+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
83+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
84+
restore-keys: |
85+
${{ runner.os }}-yarn-
86+
87+
# This also runs a build as part of the postinstall bootstrap
88+
- name: Install dependencies and build
89+
run: |
90+
yarn --ignore-engines --frozen-lockfile
91+
yarn check-clean-workspace-after-install
92+
93+
- name: Check code formatting
94+
run: yarn format-check
95+
96+
- name: Run linting
97+
run: yarn lint
98+
99+
- name: Validate spelling
100+
run: yarn check:spelling
101+
74102
integration_tests:
75103
name: Run integration tests on primary Node.js version
76104
runs-on: ubuntu-latest
@@ -143,7 +171,7 @@ jobs:
143171
publish_canary_version:
144172
name: Publish the latest code as a canary version
145173
runs-on: ubuntu-latest
146-
needs: [primary_code_validation_and_tests, unit_tests_on_other_node_versions, integration_tests]
174+
needs: [primary_code_validation_and_tests, unit_tests_on_other_node_versions, linting_and_style, integration_tests]
147175
if: github.ref == 'refs/heads/master'
148176
steps:
149177
- uses: actions/checkout@v2

0 commit comments

Comments
 (0)