This document describes how to build and test this project, to work on this project you need the following tools installed:
The automation necessary to accomplish the objective is concentrated on the Makefile
, the organization of each task is defined by the targets. Targets are the entrypoint for the project automation tasks, the most important are described below.
To compile the project run make
without any arguments, i.e.:
make
Project testing is subdivided as unit and end-to-end tests, in order to run all tests in the project use the test
target, i.e.:
make test
Please consider the section below to better understand requirements for end-to-end tests.
Unit tests will be exercised by the test-unit
target. For instance:
make test-unit
During development you might want to narrow down the scope, this can be achieved using the ARGS
variable, the flags informed are appended on the go test
command.
For example, narrowing down TestInventory
function:
make test-unit ARGS='-run=^"TestInventory$$"'
End-to-end tests (E2E) will assert the project features against the real dependencies, before running the test-e2e
target you will need to provide the Shipwright Build instance, including its dependencies. Please follow this documentation section first.
With the dependencies in place, run:
make test-e2e
Please consider the GitHub Actions section below to have a more practical way of running E2E tests in your own laptop.
Continuous integration (CI) tests are managed by GitHub Actions, to run these jobs locally please consider this documentation section which describes the dependencies and settings required.
After you're all set, run the following target to execute all jobs:
make act
The CI jobs will exercise unit and end-to-end tests sequentially, alternatively you may want to run a single suite at the time, that can be achieved using ARGS
(on act
target).
Using ARGS
you can run a single job
passing flags to act command-line. For instance, in order to only run unit tests (make test-unit
):
make act ARGS="--job=test-unit"