Commit 4c2e98d1 authored by Chris Cheshire's avatar Chris Cheshire
Browse files

Added unit testing to CI

parent 075a3e80
Loading
Loading
Loading
Loading
+88 −1
Original line number Diff line number Diff line
@@ -9,6 +9,9 @@ on:
    types: [published]

jobs:
  ##############################
  ### SMALL INTEGRATION TEST ###
  ##############################
  test:
    name: Run standard pipeline test
    # Only run on push if this is the nf-core dev branch (merged PRs)
@@ -33,6 +36,9 @@ jobs:
      - name: Run pipeline with test data
        run: |
          nextflow run ${GITHUB_WORKSPACE} -profile docker,test
  ##############################
  ### LARGE INTEGRATION TEST ###
  ##############################
  test_full_small:
    name: Run extended pipeline test
    # Only run on push if this is the nf-core dev branch (merged PRs)
@@ -57,3 +63,84 @@ jobs:
      - name: Run pipeline with test data
        run: |
          nextflow run ${GITHUB_WORKSPACE} -profile docker,test_full_small
  ##############################
  ###      UNIT TESTS        ###
  ##############################
  unit_tests:
    name: ${{ matrix.nxf_version }} ${{ matrix.tags }}
    if: ${{ github.event_name != 'push' || (github.event_name == 'push' && github.repository == 'nf-core/cutandrun') }}
    runs-on: ubuntu-20.04
    env:
      NXF_ANSI_LOG: false
    strategy:
      matrix:
        nxf_version: ["21.04.0", '']
        tags: ["samplesheet", "verify_output/input", "verify_output/align", "verify_output/peak_calling", "verify_output/reporting", verify_output/save", "verify_output/skip"]
    steps:
      - uses: actions/checkout@v2

      - name: Set up Python
        uses: actions/setup-python@v2
        with:
          python-version: "3.x"

      - uses: actions/cache@v2
        with:
          path: ~/.cache/pip
          key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
          restore-keys: |
            ${{ runner.os }}-pip-
      - name: Set up Python
        uses: actions/setup-python@v2
        with:
          python-version: "3.x"

      - name: Install Python dependencies
        run: python -m pip install --upgrade pip pytest-workflow

      - uses: actions/cache@v2
        with:
          path: /usr/local/bin/nextflow
          key: ${{ runner.os }}-nextflow-${{ matrix.nxf_version }}
          restore-keys: |
            ${{ runner.os }}-nextflow-
      - name: Install Nextflow
        env:
          NXF_VER: ${{ matrix.nxf_version }}
          CAPSULE_LOG: none
        run: |
          wget -qO- get.nextflow.io | bash
          sudo mv nextflow /usr/local/bin/
      - name: Set up Singularity
        if: matrix.profile == 'singularity'
        uses: eWaterCycle/setup-singularity@v5
        with:
          singularity-version: 3.7.1

      - name: Setup miniconda
        if: matrix.profile == 'conda'
        uses: conda-incubator/setup-miniconda@v2
        with:
          auto-update-conda: true
          channels: conda-forge,bioconda,defaults
          python-version: ${{ matrix.python-version }}

      - name: Conda clean
        if: matrix.profile == 'conda'
        run: conda clean -a

      # Test the module
      - name: Run pytest-workflow
        # only use one thread for pytest-workflow to avoid race condition on conda cache.
        run: TMPDIR=~ PROFILE=${{ matrix.profile }} pytest --tag ${{ matrix.tags }} --symlink --kwdof

      - name: Upload logs on failure
        if: failure()
        uses: actions/upload-artifact@v2
        with:
          name: logs-${{ matrix.tags }}-${{ matrix.profile }}-${{ matrix.nxf_version }}
          path: |
            /home/runner/pytest_workflow_*/*/.nextflow.log
            /home/runner/pytest_workflow_*/*/log.out
            /home/runner/pytest_workflow_*/*/log.err
            /home/runner/pytest_workflow_*/*/work
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
  command: nextflow run main.nf -profile docker,test_tech_reps --save_merged_fastq true --only_preqc true
  tags:
    - verify_output
    - verify_output/save
    - verify_output/save_merged
  files:
    - path: results/01_prealign/merged_fastq/h3k27me3_R1_1.merged.fastq.gz
+1 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
  command: nextflow run main.nf -profile docker,test --save_reference true --only_genome true
  tags:
    - verify_output
    - verify_output/save
    - verify_output/save_ref
  files:
    - path: results/00_genome/target/hg38-chr20-genes.bed
+1 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
  command: nextflow run main.nf -profile docker,test --only_preqc true --save_trimmed true
  tags:
    - verify_output
    - verify_output/save
    - verify_output/save_trimmed
  files:
    - path: results/01_prealign/trimgalore/h3k27me3_R1_1.trimmed.fastq.gz
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
  command: nextflow run main.nf -profile docker,test --only_preqc true --skip_fastqc true
  tags:
    - verify_output
    - verify_output/skip
    - verify_output/skip_fastqc
    - verify_output/skip_fastqc/true
  files:
Loading