Skip to content

Commit

Permalink
ci(perf): 👷 add perf improvements to ci builds
Browse files Browse the repository at this point in the history
  • Loading branch information
navin-moorthy committed Jun 29, 2022
1 parent 1a8511e commit bc6e02c
Show file tree
Hide file tree
Showing 9 changed files with 325 additions and 114 deletions.
34 changes: 0 additions & 34 deletions .github/workflows/build.yml

This file was deleted.

34 changes: 0 additions & 34 deletions .github/workflows/lint.yml

This file was deleted.

133 changes: 133 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: Build

on:
push:
branches: [main]
pull_request:
branches:
- main

jobs:
install:
name: Install node_modules
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache node_modules
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn --prefer-offline --frozen-lockfile

lint:
name: Lint
needs: install
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc

- name: Cache node_modules
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn --prefer-offline --frozen-lockfile

- name: Lint
run: yarn lint

build:
name: Build
needs: install
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc

- name: Cache node_modules
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn --prefer-offline --frozen-lockfile

- name: Built
run: yarn build

test:
name: Test (${{ matrix.shard }})
needs: install
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shard: ["1/2", "2/2"]

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc

- name: Cache node_modules
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn --prefer-offline --frozen-lockfile

- name: Test
run: yarn test -- --maxWorkers 2 --shard ${{ matrix.shard }}
41 changes: 0 additions & 41 deletions .github/workflows/test.yml

This file was deleted.

1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16
1 change: 1 addition & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const config = {
},
},
},
"storybook-addon-turbo-build",
],
};

Expand Down
32 changes: 29 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,33 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"git.branchProtection": ["main"],
"yaml.schemas": {
"https://json.schemastore.org/github-workflow.json": "file:///Users/navin/Documents/github/react-tailwind/.github/workflows/build.yml"
}
"editor.tabSize": 2,
"editor.guides.bracketPairs": true,
"editor.rulers": [80, 100, 120],
"editor.wordWrap": "bounded",
"editor.wordWrapColumn": 120,
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"files.eol": "\n",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"prettier.enable": true,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.addMissingImports": true,
// "source.organizeImports": true,
// "source.sortImports": true,
// "source.fixAll": true
"source.fixAll.eslint": true
// "source.fixAll.stylelint": true
},
"eslint.enable": true,
"eslint.useESLintClass": true,
"eslint.validate": [
"javascript",
"javascriptreact",
"vue",
"typescript",
"typescriptreact",
"html"
]
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@
"size-limit": "5.0.5",
"sort-package-json": "1.57.0",
"storybook-addon-preview": "2.2.0",
"storybook-addon-turbo-build": "^1.1.0",
"tailwindcss": "3.1.4",
"ts-node": "10.8.1",
"tslib": "2.4.0",
Expand Down
Loading

0 comments on commit bc6e02c

Please sign in to comment.