@@ -45,10 +45,14 @@ commands:
4545 type : string
4646 default : " 7"
4747 description : " Pytest version to use for testing"
48+ add_specific_requirements :
49+ type : string
50+ default : " "
51+ description : " Add specific requirements listed in a file to the environment. "
4852 extra_deps :
4953 type : string
5054 default : " "
51- description : " Extra dependencies to install"
55+ description : " Extra dependencies to install (given as a space separated string) "
5256 channels :
5357 type : string
5458 default : " https://conda.anaconda.org/conda-forge"
@@ -75,6 +79,10 @@ commands:
7579 echo $dep >> requirements.txt
7680 done
7781 fi
82+ cat "" >> requirements.txt
83+ if [ "<< parameters.add_specific_requirements >>" != "" ]; then
84+ cat "<< parameters.add_specific_requirements >>" >> requirements.txt
85+ fi
7886 - run :
7987 name : " Create environment"
8088 command : |
@@ -107,6 +115,27 @@ commands:
107115 micromamba install -n project -y python=<< parameters.python >> $requirements -c $channels
108116 micromamba install -n project -y << parameters.extra_deps >> -c $channels
109117
118+ lint-project :
119+ description : " Check code style"
120+ steps :
121+ - run :
122+ name : " Check formatting (black)"
123+ command : |
124+ eval "$(micromamba shell hook --shell=bash)"
125+ micromamba activate project
126+ black .
127+ - run :
128+ name : " Check code style (flake8)"
129+ command : |
130+ eval "$(micromamba shell hook --shell=bash)"
131+ micromamba activate project
132+ flake8 .
133+ - run :
134+ name : " Check import order (isort)"
135+ command : |
136+ eval "$(micromamba shell hook --shell=bash)"
137+ micromamba activate project
138+ isort .
110139 test-project :
111140 description : " Run all the test and store the results"
112141 parameters :
@@ -164,10 +193,13 @@ commands:
164193workflows :
165194 PR :
166195 jobs :
196+ - lint
167197 - build :
168198 matrix : *build-matrix
169199 name : " build-py<< matrix.python >>-pytest << matrix.pytest >>"
170200 filters : *PR-only
201+ requires :
202+ - lint
171203
172204 deploy :
173205 jobs :
@@ -186,6 +218,12 @@ workflows:
186218
187219
188220jobs :
221+ lint :
222+ docker : *image
223+ steps :
224+ - make-env :
225+ add_specific_requirements : requirements.dev.txt
226+ - lint-project
189227 build :
190228 docker : *image
191229 parameters :
0 commit comments