|
| 1 | +name: Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + |
| 11 | +jobs: |
| 12 | + test: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + node-version: [20, 22] |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: Checkout code |
| 21 | + uses: actions/checkout@v4 |
| 22 | + |
| 23 | + - name: Setup Node.js ${{ matrix.node-version }} |
| 24 | + uses: actions/setup-node@v4 |
| 25 | + with: |
| 26 | + node-version: ${{ matrix.node-version }} |
| 27 | + |
| 28 | + - name: Setup pnpm |
| 29 | + uses: pnpm/action-setup@v4 |
| 30 | + |
| 31 | + - name: Get pnpm store directory |
| 32 | + id: pnpm-cache |
| 33 | + shell: bash |
| 34 | + run: | |
| 35 | + echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT |
| 36 | +
|
| 37 | + - name: Setup pnpm cache |
| 38 | + uses: actions/cache@v4 |
| 39 | + with: |
| 40 | + path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} |
| 41 | + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} |
| 42 | + restore-keys: | |
| 43 | + ${{ runner.os }}-pnpm-store- |
| 44 | +
|
| 45 | + - name: Install dependencies |
| 46 | + run: pnpm install --frozen-lockfile |
| 47 | + |
| 48 | + - name: Build packages |
| 49 | + run: pnpm --filter babel-plugin-kstyled --filter kstyled build |
| 50 | + |
| 51 | + - name: Run tests |
| 52 | + run: pnpm --filter babel-plugin-kstyled --filter kstyled test |
| 53 | + |
| 54 | + coverage: |
| 55 | + runs-on: ubuntu-latest |
| 56 | + needs: test |
| 57 | + |
| 58 | + steps: |
| 59 | + - name: Checkout code |
| 60 | + uses: actions/checkout@v4 |
| 61 | + |
| 62 | + - name: Setup Node.js |
| 63 | + uses: actions/setup-node@v4 |
| 64 | + with: |
| 65 | + node-version: '20' |
| 66 | + |
| 67 | + - name: Setup pnpm |
| 68 | + uses: pnpm/action-setup@v4 |
| 69 | + |
| 70 | + - name: Get pnpm store directory |
| 71 | + id: pnpm-cache |
| 72 | + shell: bash |
| 73 | + run: | |
| 74 | + echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT |
| 75 | +
|
| 76 | + - name: Setup pnpm cache |
| 77 | + uses: actions/cache@v4 |
| 78 | + with: |
| 79 | + path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} |
| 80 | + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} |
| 81 | + restore-keys: | |
| 82 | + ${{ runner.os }}-pnpm-store- |
| 83 | +
|
| 84 | + - name: Install dependencies |
| 85 | + run: pnpm install --frozen-lockfile |
| 86 | + |
| 87 | + - name: Build packages |
| 88 | + run: pnpm --filter babel-plugin-kstyled --filter kstyled build |
| 89 | + |
| 90 | + - name: Run tests with coverage |
| 91 | + run: pnpm --filter babel-plugin-kstyled --filter kstyled test -- --coverage |
| 92 | + |
| 93 | + - name: Upload coverage to Codecov |
| 94 | + uses: codecov/codecov-action@v4 |
| 95 | + with: |
| 96 | + files: ./coverage/lcov.info |
| 97 | + flags: unittests |
| 98 | + name: codecov-umbrella |
| 99 | + fail_ci_if_error: false |
0 commit comments