tkrotoff/fetch

View on GitHub
.github/workflows/node.js.yml

Summary

Maintainability
Test Coverage
# https://github.com/actions/starter-workflows/blob/9f245d9aba830ad16a097a45c78331a05114d815/ci/node.js.yml

name: Node.js CI

# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#on
on: push

jobs:
  build:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [18.x]

    steps:
      - uses: actions/checkout@v3
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node-version }}
          cache: 'npm'
      - run: npm ci
      - run: npx playwright install --with-deps
      - run: npm run lint
      - run: npm run build
      - run: npm run npm:install:examples
      - run: npm run build:examples
      - run: npm run tsc:examples
      - run: npm run start:examples
      - run: npm run test:undici
      - run: npm run test:e2e
      - run: npm run test:coverage:whatwg-fetch
      - run: npm run test:coverage:examples

      - name: Upload coverage to Code Climate
        run: |
          curl --location https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > cc-test-reporter
          chmod +x cc-test-reporter
          ./cc-test-reporter format-coverage --input-type clover --output coverage.fetch.json coverage/clover.xml
          ./cc-test-reporter format-coverage --input-type clover --output coverage.node-example.json examples/node/coverage/clover.xml
          ./cc-test-reporter format-coverage --input-type clover --output coverage.web-example.json examples/web/coverage/clover.xml
          ./cc-test-reporter sum-coverage --output coverage.total.json --parts 3 coverage.*.json
          ./cc-test-reporter upload-coverage --input coverage.total.json
        env:
          CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}

      # FIXME https://github.com/codecov/codecov-action/issues/600#issuecomment-1003567615
      - name: Upload coverage to Codecov
        run: |
          curl --remote-name https://uploader.codecov.io/v0.1.14/linux/codecov
          chmod +x codecov
          ./codecov --file coverage/coverage-final.json --file examples/node/coverage/coverage-final.json --file examples/web/coverage/coverage-final.json