diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.yml new file mode 100644 index 0000000..9ac6b37 --- /dev/null +++ b/.github/actions/install/action.yml @@ -0,0 +1,31 @@ +name: 'Install dependencies' + +runs: + using: composite + steps: + - uses: actions/setup-node@v3 + with: + node-version-file: .node-version + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + run_install: false + + - name: Get pnpm store directory + shell: bash + run: | + echo "PNPM_STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - name: Get pnpm cache + id: pnpm-cache + uses: actions/cache@v3 + with: + path: ${{ env.PNPM_STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + shell: bash + run: pnpm install --frozen-lockfile diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml new file mode 100644 index 0000000..e27fa7d --- /dev/null +++ b/.github/workflows/quality.yml @@ -0,0 +1,32 @@ +name: 'Code quality' + +on: + pull_request: + types: + - opened + - synchronize + - reopened + push: + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + lint_and_typecheck: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: ./.github/actions/install + + - run: pnpm typecheck + + - run: pnpm lint + + - run: pnpm prettier -c . diff --git a/.node-version b/.node-version new file mode 100644 index 0000000..d5a1596 --- /dev/null +++ b/.node-version @@ -0,0 +1 @@ +20.10.0 diff --git a/package.json b/package.json index df59ace..a760ee1 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "lint": "eslint .", "prepare": "is-ci || husky install", "start": "next start", - "storybook": "storybook dev -p 6006" + "storybook": "storybook dev -p 6006", + "typecheck": "tsc --noEmit" }, "prettier": "@vercel/style-guide/prettier", "dependencies": { @@ -44,5 +45,6 @@ "prettier": "^3.1.0", "storybook": "^7.6.4", "typescript": "^5" - } + }, + "packageManager": "pnpm@8.12.0" }