allmyfutures/postcss-custom-media-generator

View on GitHub
.github/workflows/test.yml

Summary

Maintainability
Test Coverage
name: Continuous Integration

on: [push, pull_request]

env:
  PNPM_VERSION: "7"
  NODE_VERSION: "18.x"

jobs:
  test:
    if: "!contains(github.event.head_commit.message, '[skip ci]')"

    name: "${{ matrix.os }} | Node ${{ matrix.node }}"

    runs-on: ${{ matrix.os }}

    strategy:
      matrix:
        node-version: [16.x, 18.x]
        os: [ubuntu-latest]

    steps:
      - uses: actions/checkout@v3
      - uses: pnpm/action-setup@v2.2.2
        with:
          version: ${{ env.PNPM_VERSION }}
      - uses: actions/setup-node@v2
        with:
          node-version: ${{ matrix.node-version }}
          cache: pnpm
          cache-dependency-path: pnpm-lock.yaml
      - run: pnpm i --frozen-lockfile --production false
      - run: pnpm test -- --coverage
      - run: pnpm prettier --check .
      - name: report coverage to code climate
        if: ${{ matrix.node-version == '18.x' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
        run: |
          curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
          chmod +x ./cc-test-reporter
          ./cc-test-reporter format-coverage -t lcov coverage/lcov.info
          ./cc-test-reporter upload-coverage
        env:
          CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}