wf-transcriptomes-v202/.gitlab-ci.yml
Chris Wright dd2c1efd91 Condaenv
2021-01-29 18:05:35 +00:00

83 lines
2.5 KiB
YAML

stages:
- build_and_run
- release
image: ${IMAGE}
variables:
BASEIMAGE: ${CI_REGISTRY}/${CURRENT_TEMPLATE_IMAGE}
.install-nextflow: &install-nextflow |
wget -qO- https://get.nextflow.io | bash
.install-conda: &install-conda |
wget -q https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh -b -p ./miniconda
source ./miniconda/bin/activate
conda init
conda-run:
image: ubuntu:20.04
stage: build_and_run
before_script:
- apt update && apt install -y wget default-jre
- *install-nextflow
- *install-conda
script:
- ./nextflow run workflow.nf
-w ${OUTPUT}/workspace
-profile conda
--reads test_data/reads.fq.gz
--out_dir ${OUTPUT}
build-image:
stage: build_and_run
before_script:
- apk add wget openjdk11 bash
- *install-nextflow
script:
- echo ${CI_BUILD_TOKEN} | docker login --username gitlab-ci-token --password-stdin ${CI_REGISTRY}
- TAG="${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}"
- docker build --no-cache -t "${TAG}" -f Dockerfile . --build-arg BASEIMAGE=${BASEIMAGE}
# run letting nextflow orchestrate the containers
- docker tag "${TAG}" "${CI_PROJECT_NAME}:latest"
- OUTPUT="template-workflow"
- ./nextflow run workflow.nf
-w ${OUTPUT}/workspace
-profile standard
--reads test_data/reads.fq.gz
--out_dir ${OUTPUT}
# push
- if [[ ${CI_COMMIT_BRANCH} == 'dev' ]]; then
SHATAG=${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA};
echo "Pushing ${SHATAG}";
docker tag ${TAG} ${SHATAG};
docker push ${SHATAG};
fi;
only:
- branches
artifacts:
paths:
# Add the output directory for the test
- "template-workflow"
expire_in: 1 day
# Retag the image for git tags (releases)
release:
stage: release
script:
- echo ${CI_BUILD_TOKEN} | docker login --username gitlab-ci-token --password-stdin ${CI_REGISTRY}
- SHATAG=${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}
- RELTAG=${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}
- echo "Pulling ${SHATAG}"
- docker pull ${SHATAG}
- echo "Pushing ${TAG}"
- docker tag ${SHATAG} ${RELTAG}
- docker push ${RELTAG}
only:
- tags