feat: implement quality gates with CI/CD pipeline and pre-commit hooks #5
This file contains hidden or 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
| name: CI | |
| on: | |
| push: | |
| branches: [main, master, develop] | |
| pull_request: | |
| branches: [main, master, develop] | |
| jobs: | |
| quality-checks: | |
| name: Quality Checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| - name: Extract pnpm version from package.json | |
| id: get-pnpm-version | |
| run: | | |
| if jq -e '.packageManager' package.json > /dev/null; then | |
| PM_FIELD=$(jq -r '.packageManager' package.json) | |
| if [[ $PM_FIELD == pnpm@* ]]; then | |
| echo "PNPM_VERSION=${PM_FIELD#pnpm@}" >> $GITHUB_ENV | |
| else | |
| echo "PNPM_VERSION=latest" >> $GITHUB_ENV | |
| fi | |
| else | |
| echo "PNPM_VERSION=latest" >> $GITHUB_ENV | |
| fi | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| - name: Get pnpm store directory | |
| shell: bash | |
| run: | | |
| echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
| - name: Setup pnpm cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.STORE_PATH }} | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm-store- | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build packages | |
| run: pnpm build | |
| - name: Type check | |
| run: pnpm typecheck | |
| - name: Lint check | |
| run: pnpm lint | |
| - name: Check formatting | |
| run: pnpm format:check |