GitHub Action that installs Hoverfly, so that it can be used in subsequent steps in your GitHub Actions CI/CD pipeline (e.g. when running tests that use Hoverfly).
Using this action is as simple as:
- create a
.github\workflows
directory in your repository - create a
YAML
file in the
.github\workflows
directory (file name can be anything you like, with either a.yml
or.yaml
file extension), with this content:
---
name: Hoverfly
on:
push:
jobs:
install-hoverfly:
name: Install
runs-on: ubuntu-latest
steps:
- name: Install Hoverfly
uses: agilepathway/hoverfly-github-action@main
with:
runner_github_workspace_path: ${{ github.workspace }}
You will also typically have additional steps both before and after the Hoverfly installation step, e.g. to checkout your code and to run your tests. Here's an example:
---
name: Run tests
on:
push:
jobs:
run-tests:
name: Install Hoverfly and run tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Hoverfly
uses: agilepathway/hoverfly-github-action@main
with:
runner_github_workspace_path: ${{ github.workspace }}
- name: Run Tests
run: <command-to-run-your-tests>
Once the Hoverfly installation has completed, both the Hoverfly and Hoverctl commands are available to you for the remainder of your GitHub Actions workflow:
hoverfly
hoverctl
Example:
steps:
- name: Install Hoverfly
uses: agilepathway/hoverfly-github-action@main
with:
version: v1.3.6
runner_github_workspace_path: ${{ github.workspace }}
version
can be any released Hoverfly version.
If you do not provide a version, it will default to the
latest release.
As per the above examples, you have to provide the following parameter:
runner_github_workspace_path: ${{ github.workspace }}
The value must always be ${{ github.workspace }}
This is so that the Hoverfly binaries are added to the path properly.
The Hoverfly binaries are installed at ${{ github.workspace }}/bin
(The GitHub workspace directory is persistent throughout the GitHub Action workflow, which means that the binaries are available to any subsequent workflow steps.)
To enable HTTPS Hoverfly simulations, follow this example:
steps:
- name: Install Hoverfly
uses: agilepathway/hoverfly-github-action@main
with:
runner_github_workspace_path: ${{ github.workspace }}
- name: Enable https calls to be simulated by Hoverfly
run: install-and-trust-hoverfly-default-cert.sh
This script installs and trusts the default Hoverfly certificate, after which you can go ahead and simulate HTTPS calls (see this example in the end-to-end tests).
Our Hoverfly GitHub Action automatically makes this https cert
install script available
(in the same ${{ github.workspace }}/bin
directory which we add to the path and which the
Hoverfly binaries are located in too).
The tests contain further configuration examples.
The project is open source and all contributions are very welcome 🙂 💥 👍
See the DEPENDENCIES.md