Skip to content

Commit

Permalink
ci(code-check): code check workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
JaleelB committed Jul 22, 2024
1 parent 3a7bb27 commit c8ddec0
Show file tree
Hide file tree
Showing 6 changed files with 235 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
blank_issues_enabled: false
contact_links:
- name: General questions
url: https://github.com/sadmann7/skateshop/discussions?category=general
url: https://github.com/JaleelB/readium-x/discussions?category=general
about: Please ask and answer questions here
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ body:
id: terms
attributes:
label: Before submitting
description: By submitting this issue, you agree to follow our [Contributing Guidelines](https://github.com/sadmann7/skateshop/blob/main/CONTRIBUTING.md).
description: By submitting this issue, you agree to follow our [Contributing Guidelines](https://github.com/JaleelB/readium-x/blob/main/CONTRIBUTING.md).
options:
- label: I've made research efforts and searched the documentation
required: true
Expand Down
118 changes: 118 additions & 0 deletions .github/workflows/cc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Code check

on:
pull_request:
branches: ["*"]
push:
branches: ["main"]

jobs:
lint:
runs-on: ubuntu-latest
name: Lint
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- uses: pnpm/[email protected]
name: Install pnpm
id: pnpm-install
with:
version: 8.6.1
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

- run: pnpm lint

format:
runs-on: ubuntu-latest
name: Format
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- uses: pnpm/[email protected]
name: Install pnpm
id: pnpm-install
with:
version: 8.6.1
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

- run: pnpm format:check

tsc:
runs-on: ubuntu-latest
name: Typecheck
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- uses: pnpm/[email protected]
name: Install pnpm
id: pnpm-install
with:
version: 8.6.1
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

- run: pnpm typecheck
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
"build": "next build",
"start": "next start",
"lint": "next lint",
"lint:fix": "next lint --fix",
"typecheck": "tsc --noEmit",
"format:write": "prettier --write \"**/*.{ts,tsx,mdx}\" --cache",
"format:check": "prettier --check \"**/*.{ts,tsx,mdx}\" --cache",
"check": "pnpm lint && pnpm typecheck && pnpm format:check",
"test": "vitest",
"db:push": "drizzle-kit push --config=drizzle.config.ts",
"db:migrate": "node -r esbuild-register ./src/db/migrate.ts",
Expand Down Expand Up @@ -78,6 +83,8 @@
"drizzle-kit": "^0.22.8",
"eslint": "^8.57.0",
"eslint-config-next": "14.2.4",
"prettier": "^3.3.3",
"prettier-plugin-tailwindcss": "^0.6.5",
"postcss": "^8.4.39",
"tailwindcss": "^3.4.4",
"typescript": "^5.5.2",
Expand Down
69 changes: 69 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 39 additions & 0 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/** @type {import('prettier').Config & import('prettier-plugin-tailwindcss').PluginOptions} */
const config = {
endOfLine: "lf",
semi: false,
singleQuote: false,
tabWidth: 2,
trailingComma: "es5",
importOrder: [
"^(react/(.*)$)|^(react$)",
"^(next/(.*)$)|^(next$)",
"<THIRD_PARTY_MODULES>",
"",
"^types$",
"^@/types/(.*)$",
"^@/config/(.*)$",
"^@/lib/(.*)$",
"^@/hooks/(.*)$",
"^@/components/ui/(.*)$",
"^@/components/(.*)$",
"^@/styles/(.*)$",
"^@/app/(.*)$",
"",
"^[./]",
],
importOrderSeparation: false,
importOrderSortSpecifiers: true,
importOrderBuiltinModulesToTop: true,
importOrderParserPlugins: ["typescript", "jsx", "decorators-legacy"],
importOrderMergeDuplicateImports: true,
importOrderCombineTypeAndValueImports: true,
tailwindAttributes: ["tw"],
tailwindFunctions: ["cva"],
plugins: [
"@ianvs/prettier-plugin-sort-imports",
"prettier-plugin-tailwindcss",
],
};

export default config;

0 comments on commit c8ddec0

Please sign in to comment.