Skip to content

Commit

Permalink
Improve the performance of the CI jobs
Browse files Browse the repository at this point in the history
- Run the project checks in parallel
  This should speed up CI by running the checks at the same time.
  It doesn't give the possible 5x improvement because of the limited CI resources.
- Add npm cache to Github action cache
  As well as caching node_modules we now also cache `~/.npm`, which will speed up cases where the dependencies have changed.
- Run tests independently of other checks
- Use incremental TS builds when type checking
- Use eslint cache
  • Loading branch information
petebacondarwin committed Jan 17, 2022
1 parent edc4b53 commit 7dfb877
Show file tree
Hide file tree
Showing 10 changed files with 428 additions and 15 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pages-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: 16.7
cache: "npm"

- uses: actions/cache@v2
id: node-modules-cache
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/prereleases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: 16.7
cache: "npm"

- uses: actions/cache@v2
id: node-modules-cache
Expand Down
42 changes: 40 additions & 2 deletions .github/workflows/pullrequests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Pull Request
on: pull_request

jobs:
test:
name: "Pull Request" # todo: we should add a pull request number here
check:
name: "Checks"
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
Expand All @@ -16,6 +16,7 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: 16.7
cache: "npm"

- uses: actions/cache@v2
id: node-modules-cache
Expand All @@ -25,8 +26,45 @@ jobs:
*/*/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}

- uses: actions/cache@v2
id: eslint-cache
with:
path: |
.eslintcache
tsconfig.tsbuildinfo
key: ${{ runner.os }}-eslint-tsbuildinfo-${{ hashFiles('**/*.ts','**/*.js', 'package.json', 'tsconfig.json') }}

- name: Install NPM Dependencies
run: npm install

- name: Check for errors
run: npm run check

test:
name: "Tests"
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Use Node.js 16.7
uses: actions/setup-node@v2
with:
node-version: 16.7
cache: "npm"

- uses: actions/cache@v2
id: node-modules-cache
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}

- name: Install NPM Dependencies
run: npm install

- name: Run build and test
run: npm run build-and-test
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: 16.7
cache: "npm"

- uses: actions/cache@v2
id: node-modules-cache
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.DS_Store
node_modules/
wrangler-dist/
packages/wrangler/wrangler.toml
packages/wrangler/wrangler.toml
tsconfig.tsbuildinfo
.eslintcache
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"clipboardy",
"cloudflared",
"esbuild",
"eslintcache",
"estree",
"execa",
"iarna",
Expand All @@ -16,6 +17,7 @@
"pgrep",
"PKCE",
"Positionals",
"tsbuildinfo",
"undici",
"wasmvalue",
"weakmap",
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ The code is checked for type errors by [TypeScript](https://www.typescriptlang.o

- Type check all the code in the repository
```sh
> npm run type-check
> npm run check:type
```
- VS Code will also run type-checking while editing source code, providing immediate feedback.

Expand All @@ -107,7 +107,7 @@ The code is checked for linting errors by [ESLint](https://eslint.org/).

- Run the linting checks
```sh
> npm run lint
> npm run check:lint
```
- The repository has a recommended VS Code plugin to run ESLint checks while editing source code, providing immediate feedback.

Expand All @@ -117,7 +117,7 @@ The code is checked for formatting errors by [Prettier](https://prettier.io/).

- Run the formatting checks
```sh
> npm run format-check
> npm run check:format
```
- The repository has a recommended VS Code plugin to run Prettier checks, and to automatically format using Prettier, while editing source code, providing immediate feedback.

Expand Down
Loading

0 comments on commit 7dfb877

Please sign in to comment.