name: nf-core linting
# This workflow is triggered on pushes and PRs to the repository.
# It runs the `nf-core lint` and markdown lint tests to ensure that the code meets the nf-core guidelines
on:
  push:
  pull_request:
  release:
    types: [published]

jobs:
  Markdown:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1
        with:
          node-version: '10'
      - name: Install markdownlint
        run: npm install -g markdownlint-cli
      - name: Run Markdownlint
        run: markdownlint ${GITHUB_WORKSPACE} -c ${GITHUB_WORKSPACE}/.github/markdownlint.yml
  YAML:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: actions/setup-node@v1
        with:
          node-version: '10'
      - name: Install yaml-lint
        run: npm install -g yaml-lint
      - name: Run yaml-lint
        run: yamllint $(find ${GITHUB_WORKSPACE} -type f -name "*.yml")
  nf-core:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Install Nextflow
        run: |
          wget -qO- get.nextflow.io | bash
          sudo mv nextflow /usr/local/bin/
      - uses: actions/setup-python@v1
        with:
          python-version: '3.6'
          architecture: 'x64'
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install nf-core
      - name: Run nf-core lint
        run: nf-core lint ${GITHUB_WORKSPACE}
