Merge pull request #79 from muhammedaksam:develop #184
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, develop] | |
| pull_request: | |
| branches: [main, develop] | |
| jobs: | |
| lint-and-test: | |
| name: Lint, Format & Test | |
| runs-on: ubuntu-latest | |
| if: ${{ !contains(github.event.head_commit.message || '', '[skip ci]') && !contains(github.event.pull_request.title || '', '[skip ci]') }} | |
| strategy: | |
| matrix: | |
| node-version: [20.x, 22.x] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| package-manager-cache: false | |
| - name: Install pnpm | |
| run: | | |
| npm install -g [email protected] | |
| 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: Run ESLint | |
| run: pnpm run lint | |
| - name: Check Prettier formatting | |
| run: pnpm run format:check | |
| - name: Run tests | |
| run: pnpm run test | |
| - name: Generate coverage report (Node.js 22 only) | |
| if: matrix.node-version == '22.x' | |
| run: pnpm run test:coverage | |
| - name: Build project | |
| run: pnpm run build | |
| - name: Upload coverage to Codecov (Node.js 22 only) | |
| if: matrix.node-version == '22.x' | |
| uses: codecov/codecov-action@v6 | |
| with: | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| publish-check: | |
| name: Publish Check | |
| runs-on: ubuntu-latest | |
| needs: lint-and-test | |
| if: ${{ !contains(github.event.head_commit.message || '', '[skip ci]') && !contains(github.event.pull_request.title || '', '[skip ci]') }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: '22.x' | |
| package-manager-cache: false | |
| - name: Install pnpm | |
| run: | | |
| npm install -g [email protected] | |
| 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: Check if package can be published | |
| run: pnpm run prepublishOnly |