conekta/conekta-node

View on GitHub
.github/workflows/nodejs.yml

Summary

Maintainability
Test Coverage
name: Node.js CI

on:
  push:
    branches: [ main, master ]
  pull_request:
    branches: [ main, master ]

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [14, 16, 18, 20]
    steps:
      - uses: actions/checkout@v3

      - name: Setup Node.js 20 for Mockoon CLI
        uses: actions/setup-node@v2
        with:
          node-version: '20'

      - name: Run Mockoon CLI
        uses: mockoon/cli-action@v1
        with:
          version: '6.0.1'
          data-file: 'https://raw.githubusercontent.com/conekta/openapi/main/mocks/conekta_api.json'
          port: 3000

      - name: Setup Node.js for test
        uses: actions/setup-node@v2
        with:
          node-version: ${{ matrix.node-version }}

      - name: Install dependencies
        run: npm install

      - name: Execute test
        run: make test
        env:
          BASE_PATH: http://localhost:3000

      - name: Publish code coverage
        if: matrix.node-version == 14
        uses: paambaati/codeclimate-action@v5.0.0
        env:
          CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
        with:
          coverageLocations: |
            ${{github.workspace}}/coverage*.lcov:lcov