Update .gitlab-ci.yml file to follow example by Duncan
Duncan has kindly provided some template .gitlab-ci.yml file example for use in pyDARM
using some new templates he has set up. I copy and paste the example he provided, in the case that we lose access to his example file. We may wish to bring this in at an opportune moment perhaps in between major merge requests.
# include templates from gitlab-ci-templates
# for docs see https://computing.docs.ligo.org/gitlab-ci-templates
include:
- project: computing/gitlab-ci-templates
file:
- /conda/base.yml
- /python/lint.yml
- /python/test.yml
stages:
- test
- lint
# ---------------------------
# lint the code with flake8
# using the job template from
# .python:flake8
# ---------------------------
lint:
extends:
# https://computing.docs.ligo.org/gitlab-ci-templates/python/#pythonflake8
- .python:flake8
stage: lint
needs: []
python3:
extends:
# extend from the conda:base job to get default conda configuration
# https://computing.docs.ligo.org/gitlab-ci-templates/conda/#.conda:base
- .conda:base
image: igwn/base:conda
stage: test
needs: []
before_script:
# run the `before_script` block from the conda:base template
- !reference [".conda:base", before_script]
# create a conda environment to run the tests in
- conda create --name pydarm-test
coverage
numpy
pip
python=3
scipy
- conda activate pydarm-test
- python -m pip install
dttxml
script:
- conda activate pydarm-test # just in case
# run unittests with coverage
- python3 -m coverage run --source=pydarm
-m unittest discover
# test the CLIs
- python3 -m coverage run --append --source=pydarm
-m pydarm --help
- python3 -m coverage run --append --source=pydarm
-m pydarm fr --help
after_script:
# print coverage report
- export PYTHON="${CONDA_ENVS_PATH}/pydarm-test/bin/python3"
- !reference [".python:pytest", after_script]
# clean the conda cache
- !reference [".conda:cache", after_script]
# parse the coverage total from the report
coverage: '/^TOTAL\s+.*\s+(\d+\.?\d*)%/'