Skip to content

Pipeline restructure #16

Pipeline restructure

Pipeline restructure #16

Workflow file for this run

name: run-pipeline
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository with LFS
uses: actions/checkout@v2
with:
lfs: true
- name: Setup Nextflow
uses: nf-core/setup-nextflow@v1
- name: Check if Dockerfile has changed
run: |
if git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep 'Dockerfile'; then
echo "DOCKERFILE_CHANGED=true" >> $GITHUB_ENV
else
echo "DOCKERFILE_CHANGED=false" >> $GITHUB_ENV
fi
- name: Docker Login (for pull or push)
run: |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Build Docker image (if changed)
if: env.DOCKERFILE_CHANGED == 'true'
run: |
docker build -t eppicenter/mad4hatter:latest .
- name: Pull Docker image (if not built)
if: env.DOCKERFILE_CHANGED == 'false'
run: |
docker pull eppicenter/mad4hatter:latest
- name: Run Nextflow Pipeline (Docker)
run: |
nextflow -q run main.nf --readDIR ${GITHUB_WORKSPACE}/data/testdata --target v4 -profile test,docker --genome v1 -c conf/test.config
- name: Archive Work Directory
if: failure() # Only archive if the workflow failed
run: |
tar -czf work-dir.tar.gz /home/runner/work/mad4hatter/mad4hatter/work/
- name: Upload Work Directory
if: failure() # Only upload if the workflow failed
uses: actions/upload-artifact@v2
with:
name: work-dir
path: work-dir.tar.gz
- name: Push Docker image (if built)
if: env.DOCKERFILE_CHANGED == 'true'
run: |
docker push eppicenter/mad4hatter:latest