Context : I'm trying to setup a gitlab CI/CD that tests my build and runs my pytest tests when pushing my code.
Problem : When I push my code, the CI/CD job fails saying :
/bin/bash: line 55: pytest: command not found
ERROR: Job failed: exit code 1
Question : How do I get rid of the error and how do I setup properly my gitlab CI/CD ?
Details : I've (partially) followed this guide, and I've made a .gitlab-ci.yml
file like this :
image: continuumio/miniconda3:latest
testbuild :
stage: build
script:
- conda create --name test_env --file requirements.txt
- source activate test_env
- python setup.py install
tests:
stage: test
script:
- cd tests && pytest .
My project architecture :
$ tree -L 1
project
├── package1/
├── package2/
├── data/
├── out/
├── __pycache__
├── requirements.txt
├── setup.py
└── tests/
My requirements.txt
(stripped from a lot of useless stuff, for the readers convenience sake), that has been created with the command conda list -e
:
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: linux-64
scikit-learn=0.20.0=py36h4989274_1
scipy=1.1.0=py36hfa4b5c9_1
# ...
setuptools=40.4.3=py36_0
pip=10.0.1=py36_0
py=1.7.0=py36_0
pytest=3.9.1=py36_0
python=3.6.6=h6e4f718_2
wheel=0.32.1=py36_0