catdad/shellton

View on GitHub
.github/workflows/ci.yml

Summary

Maintainability
Test Coverage
name: CI

on:
  push:

env:
  FORCE_COLOR: 1

jobs:
  test:
    strategy:
      matrix:
        os: [macos-latest, windows-latest, ubuntu-latest]
        node: [18, 16, 14]
        include:
          - os: ubuntu-latest
            node: 12
          - os: macos-latest
            node: 10
          - os: windows-latest
            node: 8
          - os: macos-latest
            node: 6
          - os: windows-latest
            node: 4
          - os: windows-latest
            node: '0.12'
          - os: ubuntu-latest
            node: '0.10'
    runs-on: ${{matrix.os}}
    name: test (node@${{matrix.node}}, ${{matrix.os}})
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node }}
      - run: npm install
      - if: ${{ matrix.node != '0.10' }}
        run: npm test
      - if: ${{ matrix.node == '0.10' }}
        name: Special test with retries for node@0.10
        run: npm test || npm test || npm test

  coverage:
    strategy:
      matrix:
        os: [macos-latest, windows-latest, ubuntu-latest]
        node: [16]
    runs-on: ${{matrix.os}}
    name: coverage (node@${{matrix.node}}, ${{matrix.os}})
    env:
      CODECLIMATE_REPO_TOKEN: f50b5c7ebd68103f6233b46602a1607896b8ddcfe25355a11d865aa5acd60758
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node }}
      - run: npm install
      - run: npm run coverage
      - run: npm run cov-report

  publish:
    needs:
      - test
      - coverage
    if: startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 16
          registry-url: https://registry.npmjs.org/
      - run: npm publish
        env:
          NODE_AUTH_TOKEN: ${{secrets.npm_token}}