zenflow/composite-service

View on GitHub
.github/workflows/CI.yml

Summary

Maintainability
Test Coverage
name: CI
on: [push, pull_request]
jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: '18'
      - uses: actions/cache@v3
        with:
          path: node_modules
          key: nodeModules-${{ hashFiles('yarn.lock') }}
      - run: yarn install --frozen-lockfile
      - run: yarn lint
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: '18'
      - uses: actions/cache@v3
        with:
          path: node_modules
          key: nodeModules-${{ hashFiles('yarn.lock') }}
      - run: yarn install --frozen-lockfile
      - run: yarn build
      - uses: actions/upload-artifact@v3
        with:
          name: dist
          path: dist/
  test:
    needs: [build]
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, windows-latest]
        node: [16, 18, 19]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node }}
      - uses: actions/cache@v3
        with:
          path: node_modules
          key: matrix-nodeModules-${{ matrix.os }}-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
      - uses: actions/download-artifact@v3
        with:
          name: dist
          path: dist/
      - run: yarn install --frozen-lockfile
      - run: yarn test-only
  release:
    needs: [lint, build, test]
    runs-on: ubuntu-latest
    if: github.ref == 'refs/heads/master'
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v3
      - uses: actions/download-artifact@v3
        with:
          name: dist
          path: dist/
      - uses: cycjimmy/semantic-release-action@v3
        with:
          semantic_version:
          extra_plugins: |
            @semantic-release/changelog
            @semantic-release/git
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}