Commit 314359be authored by Duncan Macleod's avatar Duncan Macleod

ci: restructured tests

one test job per os/env
parent 95efdfba
Pipeline #59452 failed
......@@ -6,10 +6,11 @@ image: docker:latest
stages:
- render
- build-and-test
- test
- deploy
variables:
CONDA_PKGS_DIRS: "${CI_PROJECT_DIR}/.cache/pkgs"
CVMFS_REPO: "ligo-containers.opensciencegrid.org"
CVMFS_PATH: "/cvmfs/${CVMFS_REPO}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}"
DOCKER_DRIVER: "overlay"
......@@ -63,15 +64,13 @@ variables:
- environments/
expire_in: 1 day
cache:
key: "${CI_JOB_NAME}"
paths:
- miniconda/pkgs
- .cache/pkgs
render:linux:
<<: *render
image: continuumio/miniconda3
cache:
paths:
- /opt/conda/pkgs
render:osx:
<<: *render
......@@ -81,48 +80,35 @@ render:osx:
- *install-miniconda-osx
- *init-conda
# -- build-and-test ---------
# -- test -------------------
.build-and-test: &build-and-test
stage: build-and-test
.test: &test
stage: test
dependencies:
- render:linux
before_script:
- *init-conda
script:
- export ENV_PATH="$(pwd)/environments/${CI_JOB_NAME#build-and-test:}"
# build
- |
for ymlf in ${ENV_PATH}/*.yaml; do
conda env create --file ${ymlf};
done
# copy test files into place
- mkdir -pv test
- find packages -name "*.py" | xargs -I{} cp -v {} test/
- cd test
# test
# FIXME: once the branches are set up, we can probably get
# away with only testing the environment for the
# target branch, for now we test everything
- mkdir -p ${CI_PROJECT_DIR}/test-reports
- |
for ymlf in ${ENV_PATH}/*.yaml; do
NAME=$(basename ${ymlf} .yaml);
conda install --name=${NAME} pytest;
conda activate ${NAME};
python -m pytest ${ENV_PATH}/${NAME}-test-*.py -v --junitxml=${CI_PROJECT_DIR}/test-reports/${NAME}.xml;
done
# parse job name to get OS and environment
- read OS_NAME ENV_NAME <<<$(echo ${CI_JOB_NAME} | awk -F':' '{print $2,$3}')
# create environment
- conda env create --file environments/${OS_NAME}/${ENV_NAME}.yaml
- conda activate ${ENV_NAME}
- conda install --name=${ENV_NAME} --yes pytest
- python -m pytest
environments/${OS_NAME}/${ENV_NAME}-test-*.py
--verbose
--junitxml=${ENV_NAME}-test-report.xml
artifacts:
reports:
junit: test-reports/*.xml
build-and-test:linux:
<<: *build-and-test
image: continuumio/miniconda3
dependencies:
- render:linux
junit: "*-test-report.xml"
cache:
key: "${CI_JOB_NAME}"
paths:
- .cache/pkgs
build-and-test:osx:
<<: *build-and-test
stage: build-and-test
.test-osx: &test-osx
<<: *test
tags:
- macos_highsierra
dependencies:
......@@ -131,7 +117,135 @@ build-and-test:osx:
- *install-miniconda-osx
- *init-conda
build-and-test:cvmfs-container:
test:linux:ligo-py27:
<<: test
only:
- stable@lscsoft/conda
- merge_requests
- schedules
- triggers
test:linux:ligo-py27-proposed:
<<: test
only:
- proposed@lscsoft/conda
- merge_requests
- schedules
- triggers
test:linux:ligo-py27-testing:
<<: test
only:
- testing@lscsoft/conda
- merge_requests
- schedules
- triggers
test:linux:ligo-py27-unstable:
<<: test
only:
- testing@lscsoft/conda
- merge_requests
- schedules
- triggers
test:linux:ligo-py37:
<<: test
only:
- stable@lscsoft/conda
- merge_requests
- schedules
- triggers
test:linux:ligo-py37-proposed:
<<: test
only:
- proposed@lscsoft/conda
- merge_requests
- schedules
- triggers
test:linux:ligo-py37-testing:
<<: test
only:
- testing@lscsoft/conda
- merge_requests
- schedules
- triggers
test:linux:ligo-py37-unstable:
<<: test
only:
- testing@lscsoft/conda
- merge_requests
- schedules
- triggers
test:osx:ligo-py27:
<<: test-osx
only:
- stable@lscsoft/conda
- merge_requests
- schedules
- triggers
test:osx:ligo-py27-proposed:
<<: test-osx
only:
- proposed@lscsoft/conda
- merge_requests
- schedules
- triggers
test:osx:ligo-py27-testing:
<<: test-osx
only:
- testing@lscsoft/conda
- merge_requests
- schedules
- triggers
test:osx:ligo-py27-unstable:
<<: test-osx
only:
- testing@lscsoft/conda
- merge_requests
- schedules
- triggers
test:osx:ligo-py37:
<<: test-osx
only:
- stable@lscsoft/conda
- merge_requests
- schedules
- triggers
test:osx:ligo-py37-proposed:
<<: test-osx
only:
- proposed@lscsoft/conda
- merge_requests
- schedules
- triggers
test:osx:ligo-py37-testing:
<<: test-osx
only:
- testing@lscsoft/conda
- merge_requests
- schedules
- triggers
test:osx:ligo-py37-unstable:
<<: test-osx
only:
- testing@lscsoft/conda
- merge_requests
- schedules
- triggers
test:cvmfs-container:
<<: *docker-job
stage: build-and-test
except:
......@@ -161,7 +275,7 @@ deploy:stable:
# -- documentation ----------
docs:
stage: build-and-test
stage: test
dependencies:
- render:linux
- render:osx
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment