I'm struggling to make work a simple CI/CD pipeline with dependencies between stages. This is my .gitlab-ci.yml
file:
image: gcc
stages:
- build
- test
build_app:
stage: build
script:
- make
- make install
test_app:
stage: test
script:
- run app ...
dependencies:
- build_app
So the build stage will compile the application and install it under /usr/local/bin/. The above example will fail because the test stage does not find the executable, even when it is states as dependent on the build step (it seems it is not attached by default).
If I define /usr/local/bin/app
as an artifact it will also fail, because these must be relative and child of $CI_PROJECT_DIR
(reference).
So I'm now trying to do some modifications on it but I feel I do not really understand what is going on there. I finally tried to attach the file compiled (APP
) in the repository directory as an artifact (without using make install), and calling that binary for testing (eg. ./APP
instead of APP
). This way, it works, but I feel like I had to renounce to the make install instruction, and also that there is probably a much better and straightforward way to implement this.
Is there a recommended way to perform this task?