Skip to content

Commit

Permalink
remove husky and use CI (#661)
Browse files Browse the repository at this point in the history
* ci: split check into parallel jobs

* chore: remove husky

* remove prepare script

* Apply suggestions from code review

Co-authored-by: Benoît Rouleau <[email protected]>

* remove lint staged

* remove check script

* Try to fix `@typescript-eslint` errors in CI (even though there are no errors locally…)

* Looks like that worked, but there are 2 warnings left – try to fix them

* That didn’t work; try something else

---------

Co-authored-by: Benoît Rouleau <[email protected]>
  • Loading branch information
saihaj and benface authored May 28, 2024
1 parent 58a2dbc commit d226d91
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 288 deletions.
76 changes: 73 additions & 3 deletions .github/workflows/ci-cd-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,55 @@ env:
BASE_IMAGE: ghcr.io/graphprotocol/graph-docs-staging

jobs:
build:
lint:
if: contains(github.head_ref, 'crowdin') == false
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- name: Check out the repo
uses: actions/checkout@v4

- name: Set up env
uses: the-guild-org/shared-config/setup@main
with:
nodeVersion: 20
packageManager: pnpm

- name: Install dependencies
run: pnpm install

- name: Lint
run: pnpm lint

format:
if: contains(github.head_ref, 'crowdin') == false
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- name: Check out the repo
uses: actions/checkout@v4

- name: Set up env
uses: the-guild-org/shared-config/setup@main
with:
nodeVersion: 20
packageManager: pnpm

- name: Install dependencies
run: pnpm install

- name: Check formatting
run: pnpm prettier:check

typecheck:
if: contains(github.head_ref, 'crowdin') == false
runs-on: ubuntu-latest
steps:
Expand All @@ -27,8 +75,30 @@ jobs:
- name: Install dependencies
run: pnpm install

- name: Lint and typecheck
run: pnpm check
- name: Typecheck
run: pnpm typecheck

build:
if: contains(github.head_ref, 'crowdin') == false
runs-on: ubuntu-latest
needs: [lint, format, typecheck]
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- name: Check out the repo
uses: actions/checkout@v4

- name: Set up env
uses: the-guild-org/shared-config/setup@main
with:
nodeVersion: 20
packageManager: pnpm

- name: Install dependencies
run: pnpm install

- name: Build Docker image
uses: docker/build-push-action@v5
Expand Down
4 changes: 0 additions & 4 deletions .husky/pre-commit

This file was deleted.

4 changes: 0 additions & 4 deletions .husky/pre-push

This file was deleted.

9 changes: 0 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
"docker:up": "docker run --rm -it -p 3000:80 -v \"$(pwd)/nginx.conf:/etc/nginx/nginx.conf\" docs",
"lint": "eslint . --cache --ignore-path .gitignore --max-warnings 0",
"lint:fix": "eslint . --cache --ignore-path .gitignore --fix; pnpm prettier",
"pre-commit": "lint-staged --concurrent false",
"pre-push": "pnpm build",
"prepare": "husky install && chmod +x .husky/*",
"prettier": "pnpm prettier:check --write",
"prettier:check": "prettier --cache --check .",
"test": "turbo run test",
Expand All @@ -24,8 +21,6 @@
"@edgeandnode/eslint-config": "^2.0.3",
"eslint": "^8.57.0",
"eslint-plugin-mdx": "^2.3.4",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"prettier": "^3.2.5",
"prettier-plugin-tailwindcss": "^0.5.14",
"remark-frontmatter": "^5.0.0",
Expand All @@ -35,9 +30,5 @@
"remark-lint-restrict-elements": "workspace:*",
"turbo": "^1.13.3",
"typescript": "^5.4.5"
},
"lint-staged": {
"**/*.{js,jsx,ts,tsx,mjs,cjs}": "eslint --fix",
"**/*.{js,jsx,ts,tsx,mjs,cjs,md,mdx,yml,yaml,json}": "prettier --write"
}
}
Loading

0 comments on commit d226d91

Please sign in to comment.