diff --git a/.circ b/.circ deleted file mode 100755 index c11337f..0000000 --- a/.circ +++ /dev/null @@ -1,154 +0,0 @@ -# Print usage information -_ci_usage() { - cat <<-MSG - Run CI tests - - Commands: - run run the pipeline in '\$CI_DIR' - check compute checksums and validate results - clean remove the temporary directory used for vaildation - - Notes: - If '\$CI_DIR' is in the Nextflow asset folder the pipeline is run using the GitHub repository - to allow to change revision from the comand line, e.g.: - - CI_DIR=~/.nextflow/assets/guigolab/grape-nf ci test -r v0.4.1 - MSG -} - -# Get canonical path of either a directory or a file -_ci_canonicalize_path() { - if [ -d "$1" ]; then - _ci_canonicalize_dir_path "$1" - else - _ci_canonicalize_file_path "$1" - fi -} - -# Get canonical path of a directory -_ci_canonicalize_dir_path() { - (cd "$1" 2>/dev/null && pwd -P) -} - -# Get canonical path of a file -_ci_canonicalize_file_path() { - local dir file - dir=$(dirname -- "$1") - file=$(basename -- "$1") - (cd "$dir" 2>/dev/null && printf '%s/%s\n' "$(pwd -P)" "$file") -} - -# Check that Nextflow is installed and download it to the current -# folder otherwise -_ci_setup_nxf() { - if ! nextflow &>/dev/null; then - export PATH=$PWD:$PATH - if [ ! -x nextflow ]; then - curl -fsSL get.nextflow.io | bash && chmod +x nextflow - fi - fi -} - -# Get the content of a BAM file for checksum -_ci_normalize_bam() { - docker run --rm -v $CI_DIR:$CI_DIR -v $1:$1 -w $PWD grapenf/samtools:1.3.1 bash -c "samtools view -h $2 | grep -v '@CO\|@PG' | LC_ALL=C sort > $(basename $2) 2>/dev/null" -} - -# Get file to the CI output directory either by creating a symlink -# or normalizing a BAM file -_ci_get_file() { - local baseDir=$1 - local filename=$2 - case "$filename" in - *.bam) - _ci_normalize_bam "$baseDir" "$filename" ;; - *.bed|*.bw|*.results|*.json|*.g[tf]f) - ln -fs "$filename";; - *) - echo "'${filename##*.}' extension not supported";; - esac -} - -# Get current script being sourced -_ci_get_script_dir() { - local CI_SCRIPT="$1" - if [ ! -z "$BASH_SOURCE" ] - then - CI_SCRIPT=${BASH_SOURCE[0]} - fi - echo $(_ci_canonicalize_path $(dirname ${CI_SCRIPT})) -} - -# Run the pipeline for CI -_ci_run() { - local WF=${CI_DIR} - if [[ "$CI_DIR" =~ "$HOME/.nextflow/asset" ]]; then - local ORG=$(basename $(dirname $CI_DIR)) - local REPO=$(basename $CI_DIR) - WF="${ORG}/${REPO}" - fi - _ci_setup_nxf && nextflow run ${WF} -profile $CI_PROFILE "${CI_RUNOPTS[@]}" "$@" -} - -# Check pipeline results for CI -_ci_check() { - (mkdir -p $CI_OUTDIR && cd $CI_OUTDIR - echo $CI_PROFILE > .ci_profile - cut -f 3 ../pipeline.db | while read f - do - _ci_get_file $(_ci_canonicalize_path ..) $f - done - md5sum -c ${CI_DIR}/data/$CI_PROFILE.md5) -} - -# Cleanup CI result directory -_ci_clean() { - rm --interactive=never -r $CI_OUTDIR -} - -# Perform a ful CI test -_ci_test() { - # Define colors - local RED="\033[1;31m" - local GREEN="\033[1;32m" - local YELLOW="\033[1;33m" - local BLUE="\033[1;34m" - local NORMAL="\033[0m" - - echo -e "==$YELLOW Running with profile -> $BLUE${CI_PROFILE}$NORMAL" \ - && _ci_run "$@" \ - && echo -e "==$YELLOW Compute MD5 checksums$NORMAL" \ - && _ci_check \ - && echo -e "==$GREEN SUCCESS$NORMAL" \ - && echo -e "==$YELLOW Cleaning up$NORMAL" \ - && _ci_clean \ - && echo -e "==$YELLOW DONE$NORMAL" && exit 0 \ - || echo -e "==$RED FAILED$NORMAL" && exit 1 -} - -# Main command -ci() { - case $1 in - run) - shift - (_ci_run "$@");; - check) - shift - (_ci_check);; - clean) - shift - (_ci_clean);; - test) - shift - (_ci_test "$@");; - *) - _ci_usage;; - esac -} - -# Define CI environment variables -CI_DIR=${CI_DIR-"$(_ci_get_script_dir $0)"} -CI_LOG=${CI_LOG-"pipeline-ci.log"} -CI_PROFILE=${CI_PROFILE-"starrsem"} -CI_OUTDIR=${CI_OUTDIR-"checksum"} -CI_RUNOPTS=("-process.errorStrategy=terminate" "-with-docker" "-ansi-log" "false" "--rsemCalcCI") diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 409736a..35de279 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,7 +5,6 @@ on: branches: - master - dev - - test-refactor pull_request: branches: - master