We develop and maintain two phpIPAM related projects (phpypam, phpipam-ansible-modules). To ensure a good code quality we test it against a phpipam installation within github workspaces. Formaly we use github containerized services to run the tests. This approach was not perfect because we have to manage same code in multiple places. So we decided to create a github action to setup a clean phpipam installation.
Usage
The action is hosted in a separate repository and available on github marketplace. To use it you have to add the following to your github workflow:
steps:
- uses: actions/checkout@v2
- uses: codeaffen/phpipam-action@v2
with:
ipam_version: "1.4x"
If the action finishes successfully you will be able to run your api tests against the phpipam installation.
- name: "Test phpipam api"
run: |
curl -k --user Admin:ipamadmin -X POST https://localhost/api/ansible/user/
With the ipam_version
parameter you will be able to test against different phpipam versions by using githubs build matrix feature. This is done by defining a job as follows:
Parameters
We provide the following parameters to configure the phpipam instance database:
- ipam_version: the phpipam version to install: Default: “latest”
- ipam_database_host: Database host phpipam connects to. Default: “database”
- ipam_database_user: Database user phpipam needs to authenticate. Default: “phpipam”
- ipam_database_pass: Database password phpipam needs to authenticate. Default: “phpipam”
- ipam_database_name: Database name phpipam uses. Default: “phpipam”
- database_root_password: Root password for the database. Default: “root”
Note: If you define a database host, the database (ipam_database_name) needs to be created or emptied before the action can be executed.
further resources
To get more information you can use the following sources: