before_script:
  - module add  python/3.6.1-2-anaconda
  - pip install --user pytest-pythonpath==0.7.1 pytest-cov==2.5.1
  - module load nextflow/0.31.0
  - ln -s /project/shared/bicf_workflow_ref/workflow_testdata/chipseq/*fastq.gz test_data/

stages:
  - unit
  - astrocyte
  - single
  - multiple
  - skip

user_configuration:
  stage: unit
  script:
  - pytest -m unit --cov=./workflow/scripts

bash_tests:
  stage: unit
  script:
    - module load singularity/3.0.2
    - module load deeptools/2.5.0.1
    - singularity run docker://bats/bats:v1.1.0 --tap workflow/tests/plot_profile.bats

astrocyte:
  stage: astrocyte
  script:
  - module load astrocyte/0.1.0
  - module unload nextflow
  - cd ..
  - astrocyte_cli validate chipseq_analysis
  artifacts:
    expire_in: 2 days

single_end_mouse:
  stage: single
  only:
    - master
  script:
  - nextflow run workflow/main.nf --astrocyte true -resume
  - pytest -m singleend

paired_end_human:
  stage: single
  only:
    - branches
  except:
    - master
  script:
  - nextflow run workflow/main.nf --designFile "$CI_PROJECT_DIR/test_data/design_ENCSR729LGA_PE.txt" --genome 'GRCh38' --pairedEnd true --astrocyte false -resume
  - pytest -m pairedend

single_end_diff:
  stage: multiple
  only:
    - branches
  except:
    - master
  script:
  - nextflow run workflow/main.nf --designFile "$CI_PROJECT_DIR/test_data/design_diff_SE.txt" --genome 'GRCm38' --astrocyte false -resume
  - pytest -m singleend
  - pytest -m singlediff

paired_end_diff:
  only:
    - master
  stage: multiple
  script:
  - nextflow run workflow/main.nf --designFile "$CI_PROJECT_DIR/test_data/design_diff_PE.txt" --genome 'GRCh38' --pairedEnd true --astrocyte false -resume
  - pytest -m pairedend
  - pytest -m paireddiff

single_end_skip:
  stage: skip
  only:
    - master
  script:
  - nextflow run workflow/main.nf --designFile "$CI_PROJECT_DIR/test_data/design_diff_SE.txt" --genome 'GRCm38' --skipDiff true --skipMotif true --skipPlotProfile true --astrocyte false -resume
  - pytest -m singleskip_true