Skip to content
Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Latest commit

 

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mimicker logo
GitHub Action

Mimicker Action

Start a Mimicker HTTP mock server in your CI workflows — zero config required.

Action tests GitHub Marketplace Docs


Usage

Minimal — no stubs file (add stubs via API at runtime)

steps:
  - uses: mimickerhq/mimicker-action@v1

  - name: Hit your mock
    run: curl http://localhost:8080/__mimicker__/health

With a stubs YAML file

steps:
  - uses: actions/checkout@v4

  - uses: mimickerhq/mimicker-action@v1
    with:
      config: stubs/api.yaml

  - name: Run tests against the mock
    run: pytest

Custom port

- uses: mimickerhq/mimicker-action@v1
  with:
    port: 9090

Capture the URL as an output

- uses: mimickerhq/mimicker-action@v1
  id: mock

- run: curl ${{ steps.mock.outputs.url }}/my-endpoint

Stub coverage report (detect test decay)

After your tests run, call the report script to get a summary of which stubs were hit and which were never exercised. The report is written to the GitHub Actions job summary.

- uses: actions/checkout@v4

- uses: mimickerhq/mimicker-action@v1
  id: mock
  with:
    config: stubs/api.yaml

- name: Run tests
  run: pytest

- name: Mimicker coverage report
  if: always()
  run: bash ${{ steps.mock.outputs.report-script }}

Add fail-on-unused: true to fail the job if any stub was never hit:

- uses: mimickerhq/mimicker-action@v1
  id: mock
  with:
    config: stubs/api.yaml
    fail-on-unused: true

- name: Run tests
  run: pytest

- name: Mimicker coverage report
  if: always()
  run: bash ${{ steps.mock.outputs.report-script }}

Inputs

Input Description Default
port Port to run Mimicker on 8080
config Path to a stubs YAML file (relative to repo root)
version Mimicker Docker image tag latest
wait-timeout Seconds to wait for the server to become healthy 30
fail-on-unused Fail the job if any stubs were never hit (detects test decay) false

Outputs

Output Description
url Base URL of the running server, e.g. http://localhost:8080
report-script Path to a shell script that writes the stub coverage report to the job summary. Call it with if: always() after your tests.

Stubs file format

# stubs/api.yaml
routes:
  - method: GET
    path: /users
    status: 200
    body:
      - id: 1
        name: Alice

  - method: POST
    path: /orders
    status: 201
    body:
      id: 42
      status: created

See the Mimicker docs for the full YAML reference.


Examples

Working examples you can clone and run:

Example What it shows
basic Minimal setup — no stubs, health check only
with-stubs YAML stubs + curl assertions
coverage-report Stub coverage tracking and fail-on-unused

License

Apache 2.0 — see LICENSE.

About

GitHub Action to run Mimicker HTTP mock server in CI workflows

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors