Pipeline restructure #18
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v3 | |
with: | |
lfs: true | |
- 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: Setup Nextflow | |
uses: nf-core/setup-nextflow@v1 | |
- 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 | |
- 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 |