Commit f5be7bc5 authored by vintache-d's avatar vintache-d
Browse files

add files for continuous integration with gitlab-ci

parent eb2db90e
#!/bin/bash
# usage : bash scripts/setupConda.sh JENKINS_WORKSPACE
# list directory contents for the Jenkins worskspace directory
echo "JENKINS_WORKSPACE=$1"
ls -al ${1}
# remove conda environments
echo "=== remove conda environments ==="
rm -Rf ${1}/.conda
rm -Rf ${1}/.condarc
rm -Rf ${1}/.continuum
rm -Rf ${1}/miniconda
# Download miniconda
wget --quiet https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ${1}/miniconda.sh
/bin/bash ${1}/miniconda.sh -b -p ${1}/miniconda
rm -f ${1}/miniconda.sh
# Setup PATH
export PATH=${1}/miniconda/bin:$PATH
# Install of the exome environment
# /bin/bash ${1}/CONDA/createEnv.sh
# List environment
echo "=== list available conda environments ==="
conda env list
#!/bin/bash
# usage : bash executePipeline.sh WORKSPACE SNAKEMAKE_JOBS
# usage : bash executePipeline.sh projectFile configFile
echo "WORKSPACE=$1"
echo "SNAKEMAKE_JOBS=$2"
echo "PROJECT_FILE="$1
echo "CONFIG_FILE="$2
export PATH=${1}/miniconda/bin:$PATH
export PATH=./miniconda/bin:$PATH
echo $PATH
export LC_ALL=en_US.utf8
export LANG=en_US.utf-8
#export LC_ALL=C.UTF-8
#export LANG=C.UTF-8
# Creation of a conda virtual environment
echo "=== create a conda environment ==="
conda create -qy -n snakemake snakemake --override-channels -c conda-forge -c bioconda
# Activation of conda virtual environment
echo "=== activate the conda environment ==="
source activate snakemake
# Configure json environment : Single End or Pair Ends
echo "=== configure the pipeline environement ==="
# cp myConfig.json config.json
# Activation of RNAseq_quantif_pipeline
echo "=== activate the rna conda environment ==="
source ./miniconda/etc/profile.d/conda.sh
conda activate rna
# Run pipeline
echo "=== run the pipeline ==="
echo "number of snakemake jobs : $SNAKEMAKE_JOBS"
snakemake -rp --jobs ${2} --latency-wait 60 --config projf="CONFIG/project.json" reff="CONFIG/references.json" conff="CONFIG/config.json" --use-conda
snakemake -rp --cores 2 --config proj=$1 conf=$2
# check the result
echo "=== check the result ==="
export nbLines=`wc -l .ci/jenkins/data/md5sumFile | gawk -F" " '{ print $1 }'`
export nbSuccess=`md5sum --check .ci/jenkins/data/md5sumFile | grep 'OK' | wc -l`
export nbLines=`wc -l .ci/scripts/data/md5sumFile | gawk -F" " '{ print $1 }'`
export nbSuccess=`md5sum --check .ci/scripts/data/md5sumFile | grep 'OK' | wc -l`
if [[ "$nbLines" == "$nbSuccess" ]]; then
echo "succes"
......@@ -46,5 +36,3 @@ fi
# Desactivation of the conda virtual environment
echo "=== deactivate the conda environment ==="
source deactivate
echo "=== remove conda environment ==="
conda env remove -qy -n snakemake
#!/bin/bash
# usage : bash scripts/setupConda.sh
# list directory contents for the Jenkins worskspace directory
ls -al
# remove conda environments
echo "=== remove conda environments ==="
rm -Rf .conda
rm -Rf .condarc
rm -Rf .continuum
rm -Rf miniconda
# Download miniconda
wget --quiet https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ./miniconda.sh
/bin/bash ./miniconda.sh -b -p ./miniconda
rm -f ./miniconda.sh
eval "$(./miniconda/bin/conda shell.bash hook)"
conda init
export PATH=./miniconda/bin:$PATH
echo "=== mise à jour de conda ==="
conda update conda
echo "=== setup conda channel priority ==="
conda config --add channels defaults
conda config --add channels ostrokach
conda config --add channels conda-forge
conda config --add channels bioconda
conda config --set channel_priority flexible
echo "=== disable safety checks ==="
conda config --set safety_checks disabled
echo "=== install the conda environment rna from the git sources ==="
# Install the microSysMics environments
conda env create -n rna -qf CONDA/rna.yml
# List environment
echo "=== list the available conda environments ==="
conda env list
# remove unused files : cache files, package tarballs, and the entire package cache
conda clean -afy
# remove unused files : static libraries
find miniconda -follow -type f -name '*.a' -delete
# remove unused files : python bytecode
find miniconda -follow -type f -name '*.pyc' -delete
# List environment
echo "=== list available conda environments ==="
conda env list
image: docker:stable-git
variables:
DOCKER_DRIVER: overlay
services:
- docker:dind
stages:
- build
- test
before_script:
- echo $CI_JOB_TOKEN | docker login --username gitlab-ci-token --password-stdin $CI_REGISTRY
build:
stage: build
only:
- master
script:
- docker pull $CI_REGISTRY_IMAGE || true
- docker build --build-arg HTTP_PROXY="http://proxy-upgrade.univ-nantes.prive:3128"
--build-arg HTTPS_PROXY="http://proxy-upgrade.univ-nantes.prive:3128"
--build-arg FTP_PROXY="http://proxy-upgrade.univ-nantes.prive:3128"
--build-arg http_proxy="http://proxy-upgrade.univ-nantes.prive:3128"
--build-arg https_proxy="http://proxy-upgrade.univ-nantes.prive:3128"
--build-arg ftp_proxy="http://proxy-upgrade.univ-nantes.prive:3128"
-t $CI_REGISTRY_IMAGE .
- docker push $CI_REGISTRY_IMAGE
test:
stage: test
only:
- master
script:
- docker run
$CI_REGISTRY_IMAGE ".ci/scripts/executePipeline.sh" "CONFIG/project.json" "CONFIG/config.json"
when: on_success # s'exécutera uniquement si le job `job:build` passe
# import a docker image based on centOS6 and tini
FROM krallin/centos-tini:latest
# maintainer name and email
MAINTAINER Damien Vintache <damien.vintache@univ-nantes.fr>
# update centos6; install wget git and which
RUN yum update -y -q && yum install -y -q wget which && yum clean all
# create and prepare workdir
RUN cd ../../ && mkdir -p /home/RNAseq_quantif_pipeline
COPY . /home/RNAseq_quantif_pipeline
WORKDIR /home/RNAseq_quantif_pipeline
# Clean previous output data
# Useless in case of docker container creation
# RUN bash .ci/scripts/cleanData.sh out_dada2
# Remove conda files
# Install conda
# Update path
# Create conda virtual environments
RUN bash .ci/scripts/setupConda.sh
# Update path
# Configure the pipeline
# Run the pipeline
RUN chmod +x .ci/scripts/executePipeline.sh
ENTRYPOINT ["/bin/bash", "-l", "-c" ]
CMD [".ci/scripts/executePipeline.sh CONFIG/project.json CONFIG/config.json"]
Supports Markdown
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