YOU54F/jest-pact

View on GitHub
.github/workflows/build-and-test.yml

Summary

Maintainability
Test Coverage
name: Build and test

on:
  push:
  pull_request:
    branches: [master]

jobs:
  build-and-test-osx:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        node-version: [16.x, 18.x, 20.x]
        os: [macos-12, macos-latest]
      fail-fast: false

    steps:
      - uses: actions/checkout@v3
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node-version }}
      - run: scripts/ci/build-and-test.sh
        env:
          NODE_VERSION: ${{ matrix.node-version }}
      - name: Coveralls Parallel
        uses: coverallsapp/github-action@master
        with:
          github-token: ${{ secrets.github_token }}
          flag-name: run-${{ matrix.node-version }}-macos
          parallel: true

  build-and-test-ubuntu:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [16.x, 18.x, 20.x]
      fail-fast: false

    steps:
      - uses: actions/checkout@v3
      # - name: Set MSVS version
      #   run: npm config set msvs_version 2017
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node-version }}
      - run: scripts/ci/build-and-test.sh
        env:
          NODE_VERSION: ${{ matrix.node-version }}
      - name: Coveralls Parallel
        uses: coverallsapp/github-action@master
        with:
          github-token: ${{ secrets.github_token }}
          flag-name: run-${{ matrix.node-version }}-ubuntu
          parallel: true

  build-and-test-windows:
    runs-on: windows-latest
    strategy:
      matrix:
        node-version: [16.x, 18.x, 20.x]
      fail-fast: false

    steps:
      - uses: actions/checkout@v3
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node-version }}
      - name: Fix node-gyp
        run: |-
          npm install --global node-gyp@latest
          npm prefix -g | % {npm config set node_gyp "$_\node_modules\node-gyp\bin\node-gyp.js"}
        shell: pwsh
      - run: bash scripts/ci/build-and-test.sh
        shell: bash
        env:
          NODE_VERSION: ${{ matrix.node-version }}
      - name: Coveralls Parallel
        uses: coverallsapp/github-action@master
        with:
          github-token: ${{ secrets.github_token }}
          flag-name: run-${{ matrix.node-version }}-windows
          parallel: true

  finish:
      needs:
        - build-and-test-osx
        - build-and-test-ubuntu
        - build-and-test-windows
      runs-on: ubuntu-latest
      steps:
      - name: Coveralls Finished
        uses: coverallsapp/github-action@master
        with:
          github-token: ${{ secrets.github_token }}
          parallel-finished: true