bed-and-breakfast/templates-open-source

View on GitHub
.github/workflows/ci.yml

Summary

Maintainability
Test Coverage
name: CI
on:
    push:
    pull_request:
jobs:
    commit-check:
        name: Check Conventional Commit
        runs-on: ubuntu-latest
        steps:
            - name: Checkout
              uses: actions/checkout@v3
            - name: Check Conventional Commit
              uses: webiny/action-conventional-commits@v1.1.0
    markdown-link-check:
        name: Check Markdown Links
        runs-on: ubuntu-latest
        steps:
            - name: Checkout
              uses: actions/checkout@v3
            - name: Check markdown links
              uses: gaurav-nelson/github-action-markdown-link-check@v1
    build:
        name: Build
        runs-on: ubuntu-latest
        steps:
            - name: Checkout
              uses: actions/checkout@v3
            - name: Setup Node
              uses: './.github/actions/ci-node-setup'
              with:
                  node-version-file: .nvmrc

            - name: Build
              run: npm run build
            - name: Upload build artifacts
              uses: actions/upload-artifact@v3
              with:
                  name: build
                  path: lib
    lint:
        name: Lint
        runs-on: ubuntu-latest
        steps:
            - name: Checkout
              uses: actions/checkout@v3
            - name: Setup Node
              uses: './.github/actions/ci-node-setup'
              with:
                  node-version-file: .nvmrc

            - name: Lint
              run: npm run lint
            - name: Format
              run: npm run format
    test:
        name: Test (Node ${{ matrix.version }})
        runs-on: ubuntu-latest
        strategy:
            matrix:
                version: [18, lts/*, latest]
                include:
                    - version: 18
                      name: 18
                    - version: lts/*
                      name: lts
                    - version: latest
                      name: latest
        env:
            CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
        steps:
            - name: Checkout
              uses: actions/checkout@v3
            - name: Setup Node (${{ matrix.version }})
              uses: './.github/actions/ci-node-setup'
              with:
                  node-version: ${{ matrix.version }}

            - name: Test (With Coverage)
              run: npm run test:coverage

            - name: Upload test artifacts
              uses: actions/upload-artifact@v3
              if: success() || failure()
              with:
                  name: test-results-${{ matrix.name }}
                  path: test/junit.xml
            - name: Upload coverage artifacts
              uses: actions/upload-artifact@v3
              if: success() || failure()
              with:
                  name: test-coverage-${{ matrix.name }}
                  path: coverage/cobertura-coverage.xml

            - name: Upload coverage reports to Code Climate
              uses: paambaati/codeclimate-action@v4.0.0
              if: ${{ matrix.name == 'lts' }}
              env:
                  CC_TEST_REPORTER_ID: 58fee0878c31e85a459cb081232fb69f843bf41b49d4ddf5bfd89373bbba0e81
              with:
                  coverageLocations: |
                      coverage/cobertura-coverage.xml:cobertura