-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: setup husky and workflows (#257)
- Loading branch information
1 parent
1999d92
commit 5f22fba
Showing
6 changed files
with
385 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Development CI/CD | ||
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
types: [opened, synchronize, reopened, edited, ready_for_review] | ||
|
||
jobs: | ||
# Currently, not needed as netlify is used for deployment | ||
# build: | ||
# uses: ./.github/workflows/build.yml | ||
# with: | ||
# fail-on-error: true | ||
|
||
prettier: | ||
# needs: build | ||
uses: ./.github/workflows/prettier.yml | ||
with: | ||
fail-on-error: true | ||
|
||
eslint: | ||
# needs: build | ||
uses: ./.github/workflows/eslint.yml | ||
with: | ||
fail-on-error: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Eslint Check | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
fail-on-error: | ||
description: 'Fail on error' | ||
required: false | ||
default: false | ||
type: boolean | ||
|
||
jobs: | ||
eslint: | ||
name: Eslint Check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: 'yarn' | ||
cache-dependency-path: '**/yarn.lock' | ||
|
||
- name: Use Dev Cache | ||
id: dev-cache | ||
uses: actions/cache@v3 | ||
env: | ||
cache-name: cache-dev | ||
with: | ||
# Path for node_modules | ||
path: '**/node_modules' | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-name }}- | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
- if: ${{steps.dev-cache.outputs.cache-hit != 'true'}} | ||
name: Install Dependencies | ||
run: yarn install | ||
|
||
- name: Eslint Check | ||
run: yarn lint:find | ||
continue-on-error: ${{ github.event.inputs.fail-on-error != 'true'}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Prettier Check | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
fail-on-error: | ||
description: 'Fail on error' | ||
required: false | ||
default: false | ||
type: boolean | ||
|
||
jobs: | ||
prettier: | ||
name: Prettier Check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: 'npm' | ||
cache-dependency-path: '**/yarn.lock' | ||
|
||
- name: Use Dev Cache | ||
id: dev-cache | ||
uses: actions/cache@v3 | ||
env: | ||
cache-name: cache-dev | ||
with: | ||
# Path for node_modules | ||
path: '**/node_modules' | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-name }}- | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
- if: ${{steps.dev-cache.outputs.cache-hit != 'true'}} | ||
name: Install Dependencies | ||
run: yarn install | ||
|
||
- name: Prettier Check | ||
run: yarn prettier:check | ||
continue-on-error: ${{ !inputs.fail-on-error }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
yarn lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.