name: nf-core CI
# This workflow runs the pipeline with the minimal test dataset to check that it completes without any syntax errors
on:
  push:
    branches:
      - dev
  pull_request:
  release:
    types: [published]

env:
  NXF_ANSI_LOG: false

jobs:
  test:
    name: Run pipeline with test data
    # Only run on push if this is the nf-core dev branch (merged PRs)
    if: "${{ github.event_name != 'push' || (github.event_name == 'push' && github.repository == 'nf-core/rnaseq') }}"
    runs-on: ubuntu-latest
    strategy:
      matrix:
        NXF_VER:
          - "21.10.3"
          - "latest-everything"
    steps:
      - name: Check out pipeline code
        uses: actions/checkout@v2

      - name: Install Nextflow
        uses: nf-core/setup-nextflow@v1
        with:
          version: "${{ matrix.NXF_VER }}"

      - name: Run pipeline with test data
        run: |
          nextflow run ${GITHUB_WORKSPACE} -profile test,docker --outdir ./results

  star_salmon:
    name: Test STAR Salmon with workflow parameters
    if: ${{ github.event_name != 'push' || (github.event_name == 'push' && github.repository == 'nf-core/rnaseq') }}
    runs-on: ubuntu-latest
    strategy:
      matrix:
        parameters:
          - "--skip_qc"
          - "--skip_trimming"
          - "--gtf false"
          - "--star_index false"
          - "--transcript_fasta false"
          - "--min_mapped_reads 90"
          - "--with_umi"
          - "--with_umi --skip_trimming"
          - "--remove_ribo_rna --skip_qualimap"
          - "--bam_csi_index"
          - "--save_align_intermeds --save_reference"
          - "--featurecounts_group_type false"
    steps:
      - name: Check out pipeline code
        uses: actions/checkout@v2

      - name: Install Nextflow
        run: |
          wget -qO- get.nextflow.io | bash
          sudo mv nextflow /usr/local/bin/

      - name: Run pipeline with STAR and various parameters
        run: |
          nextflow run ${GITHUB_WORKSPACE} -profile test,docker --aligner star_salmon ${{ matrix.parameters }} --outdir ./results

  star_rsem:
    name: Test STAR RSEM with workflow parameters
    if: ${{ github.event_name != 'push' || (github.event_name == 'push' && github.repository == 'nf-core/rnaseq') }}
    runs-on: ubuntu-latest
    strategy:
      matrix:
        parameters:
          - "--skip_qc"
          - "--rsem_index false"
    steps:
      - name: Check out pipeline code
        uses: actions/checkout@v2

      - name: Install Nextflow
        run: |
          wget -qO- get.nextflow.io | bash
          sudo mv nextflow /usr/local/bin/

      - name: Run pipeline with RSEM STAR and various parameters
        run: |
          nextflow run ${GITHUB_WORKSPACE} -profile test,docker --aligner star_rsem ${{ matrix.parameters }} --outdir ./results

  hisat2:
    name: Test HISAT2 with workflow parameters
    if: ${{ github.event_name != 'push' || (github.event_name == 'push' && github.repository == 'nf-core/rnaseq') }}
    runs-on: ubuntu-latest
    strategy:
      matrix:
        parameters:
          - "--skip_qc"
          - "--hisat2_index false"
    steps:
      - name: Check out pipeline code
        uses: actions/checkout@v2

      - name: Install Nextflow
        run: |
          wget -qO- get.nextflow.io | bash
          sudo mv nextflow /usr/local/bin/

      - name: Run pipeline with HISAT2 and various parameters
        run: |
          nextflow run ${GITHUB_WORKSPACE} -profile test,docker --aligner hisat2 ${{ matrix.parameters }} --outdir ./results

  salmon:
    name: Test Salmon with workflow parameters
    if: ${{ github.event_name != 'push' || (github.event_name == 'push' && github.repository == 'nf-core/rnaseq') }}
    runs-on: ubuntu-latest
    strategy:
      matrix:
        parameters:
          - "--skip_qc --skip_alignment"
          - "--salmon_index false --transcript_fasta false"
    steps:
      - name: Check out pipeline code
        uses: actions/checkout@v2

      - name: Install Nextflow
        run: |
          wget -qO- get.nextflow.io | bash
          sudo mv nextflow /usr/local/bin/

      - name: Run pipeline with Salmon and various parameters
        run: |
          nextflow run ${GITHUB_WORKSPACE} -profile test,docker --pseudo_aligner salmon ${{ matrix.parameters }} --outdir ./results
