microcks / test-github-action

GitHub Action for launching a Microcks test
https://microcks.io
Apache License 2.0
4 stars 1 forks source link
api contract-testing github-actions microcks testing

GitHub Action for launching a Microcks test

This is a GitHub Action you may use in your Workflow to launch a Microcks test on a deployed API endpoint. Microcks tests allow you to validate an API endpoint against its OpenAPI specification, AsyncAPI specification or Postman collection definition. If test succeeds (ie. API endpoint is compliant with API contract) the workflow is pursuing, if not it fails. This action is basically a wrapper around the Microcks CLI and provides the same configuration capabilities.

License Project Chat Artifact HUB CNCF Landscape

Build Status

Fossa license and security scans

FOSSA Status FOSSA Status FOSSA Status

OpenSSF best practices on Microcks core

CII Best Practices OpenSSF Scorecard

Community

To get involved with our community, please make sure you are familiar with the project's Code of Conduct.

What it needs?

The test action needs 3 arguments:

With a bunch of mandatory flags:

And some optional ones:

How to use it?

Obviously we can find this action with GitHub Actions Marketplace :wink:

You may add the Action to your Workflow directly from the GitHub UI.

marketplace

Step 1 - Configure the GitHub action

name: my-workflow
on: [push]
jobs:
  my-job:
    runs-on: ubuntu-latest
    environment: Development
    steps:
      - uses: microcks/test-github-action@v1
        with:
          apiNameAndVersion: 'API Pastry - 2.0:2.0.0'
          testEndpoint: 'http://my-api-pastry.apps.cluster.example.com'
          runner: OPEN_API_SCHEMA
          microcksURL: 'https://microcks.apps.acme.com/api/'
          keycloakClientId:  ${{ secrets.MICROCKS_SERVICE_ACCOUNT }}
          keycloakClientSecret:  ${{ secrets.MICROCKS_SERVICE_ACCOUNT_CREDENTIALS }}
          waitFor: '10sec'

Step 2 - Configure the Secrets

As you probably saw just above, we do think it's a best practice to use GitHub Secrets (general or tied to Environment like in the example) to hold the Keycloak credentials (client Id and Secret). See below the Secrets configuration we've used for the example:

secret configuration