|
| 1 | +name: Test successful pipeline download with 'nf-core pipelines download' |
| 2 | + |
| 3 | +# Run the workflow when: |
| 4 | +# - dispatched manually |
| 5 | +# - when a PR is opened or reopened to main/master branch |
| 6 | +# - the head branch of the pull request is updated, i.e. if fixes for a release are pushed last minute to dev. |
| 7 | +on: |
| 8 | + workflow_dispatch: |
| 9 | + inputs: |
| 10 | + testbranch: |
| 11 | + description: "The specific branch you wish to utilize for the test execution of nf-core pipelines download." |
| 12 | + required: true |
| 13 | + default: "dev" |
| 14 | + pull_request: |
| 15 | + branches: |
| 16 | + - main |
| 17 | + - master |
| 18 | + |
| 19 | +env: |
| 20 | + NXF_ANSI_LOG: false |
| 21 | + |
| 22 | +jobs: |
| 23 | + configure: |
| 24 | + runs-on: ubuntu-latest |
| 25 | + outputs: |
| 26 | + REPO_LOWERCASE: ${{ steps.get_repo_properties.outputs.REPO_LOWERCASE }} |
| 27 | + REPOTITLE_LOWERCASE: ${{ steps.get_repo_properties.outputs.REPOTITLE_LOWERCASE }} |
| 28 | + REPO_BRANCH: ${{ steps.get_repo_properties.outputs.REPO_BRANCH }} |
| 29 | + steps: |
| 30 | + - name: Get the repository name and current branch |
| 31 | + id: get_repo_properties |
| 32 | + run: | |
| 33 | + echo "REPO_LOWERCASE=${GITHUB_REPOSITORY,,}" >> "$GITHUB_OUTPUT" |
| 34 | + echo "REPOTITLE_LOWERCASE=$(basename ${GITHUB_REPOSITORY,,})" >> "$GITHUB_OUTPUT" |
| 35 | + echo "REPO_BRANCH=${{ github.event.inputs.testbranch || 'dev' }}" >> "$GITHUB_OUTPUT" |
| 36 | +
|
| 37 | + download: |
| 38 | + runs-on: ubuntu-latest |
| 39 | + needs: configure |
| 40 | + steps: |
| 41 | + - name: Check out pipeline code |
| 42 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 |
| 43 | + |
| 44 | + - name: Install Nextflow |
| 45 | + uses: nf-core/setup-nextflow@b4ec1bc7c16a94435159de94a05253542fddf6ef # v3 |
| 46 | + |
| 47 | + - name: Disk space cleanup |
| 48 | + uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1 |
| 49 | + |
| 50 | + - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 |
| 51 | + with: |
| 52 | + python-version: "3.14" |
| 53 | + architecture: "x64" |
| 54 | + |
| 55 | + - name: Setup Apptainer |
| 56 | + uses: eWaterCycle/setup-apptainer@4bb22c52d4f63406c49e94c804632975787312b3 # v2.0.0 |
| 57 | + with: |
| 58 | + apptainer-version: 1.3.4 |
| 59 | + |
| 60 | + - name: Read .nf-core.yml |
| 61 | + id: read_yml |
| 62 | + run: | |
| 63 | + echo "nf_core_version=$(yq '.nf_core_version' ${{ github.workspace }}/.nf-core.yml)" >> "$GITHUB_OUTPUT" |
| 64 | +
|
| 65 | + - name: Install dependencies |
| 66 | + run: | |
| 67 | + python -m pip install --upgrade pip |
| 68 | + pip install nf-core==${{ steps.read_yml.outputs['nf_core_version'] }} |
| 69 | +
|
| 70 | + - name: Make a cache directory for the container images |
| 71 | + run: | |
| 72 | + mkdir -p ./singularity_container_images |
| 73 | +
|
| 74 | + - name: Download the pipeline |
| 75 | + env: |
| 76 | + NXF_SINGULARITY_CACHEDIR: ./singularity_container_images |
| 77 | + run: | |
| 78 | + nf-core pipelines download ${{ needs.configure.outputs.REPO_LOWERCASE }} \ |
| 79 | + --revision ${{ needs.configure.outputs.REPO_BRANCH }} \ |
| 80 | + --outdir ./${{ needs.configure.outputs.REPOTITLE_LOWERCASE }} \ |
| 81 | + --compress "none" \ |
| 82 | + --container-system 'singularity' \ |
| 83 | + --container-library "quay.io" -l "docker.io" -l "community.wave.seqera.io/library/" \ |
| 84 | + --container-cache-utilisation 'amend' \ |
| 85 | + --download-configuration 'yes' |
| 86 | +
|
| 87 | + - name: Inspect download |
| 88 | + run: tree ./${{ needs.configure.outputs.REPOTITLE_LOWERCASE }} |
| 89 | + |
| 90 | + - name: Inspect container images |
| 91 | + run: tree ./singularity_container_images | tee ./container_initial |
| 92 | + |
| 93 | + - name: Count the downloaded number of container images |
| 94 | + id: count_initial |
| 95 | + run: | |
| 96 | + image_count=$(ls -1 ./singularity_container_images | wc -l | xargs) |
| 97 | + echo "Initial container image count: $image_count" |
| 98 | + echo "IMAGE_COUNT_INITIAL=$image_count" >> "$GITHUB_OUTPUT" |
| 99 | +
|
| 100 | + - name: Run the downloaded pipeline (stub) |
| 101 | + id: stub_run_pipeline |
| 102 | + continue-on-error: true |
| 103 | + env: |
| 104 | + NXF_SINGULARITY_CACHEDIR: ./singularity_container_images |
| 105 | + NXF_SINGULARITY_HOME_MOUNT: true |
| 106 | + run: nextflow run ./${{needs.configure.outputs.REPOTITLE_LOWERCASE }}/$( sed 's/\W/_/g' <<< ${{ needs.configure.outputs.REPO_BRANCH }}) -stub -profile test,singularity --outdir ./results |
| 107 | + - name: Run the downloaded pipeline (stub run not supported) |
| 108 | + id: run_pipeline |
| 109 | + if: ${{ steps.stub_run_pipeline.outcome == 'failure' }} |
| 110 | + env: |
| 111 | + NXF_SINGULARITY_CACHEDIR: ./singularity_container_images |
| 112 | + NXF_SINGULARITY_HOME_MOUNT: true |
| 113 | + run: nextflow run ./${{ needs.configure.outputs.REPOTITLE_LOWERCASE }}/$( sed 's/\W/_/g' <<< ${{ needs.configure.outputs.REPO_BRANCH }}) -profile test,singularity --outdir ./results |
| 114 | + |
| 115 | + - name: Count the downloaded number of container images |
| 116 | + id: count_afterwards |
| 117 | + run: | |
| 118 | + image_count=$(ls -1 ./singularity_container_images | wc -l | xargs) |
| 119 | + echo "Post-pipeline run container image count: $image_count" |
| 120 | + echo "IMAGE_COUNT_AFTER=$image_count" >> "$GITHUB_OUTPUT" |
| 121 | +
|
| 122 | + - name: Compare container image counts |
| 123 | + id: count_comparison |
| 124 | + run: | |
| 125 | + if [ "${{ steps.count_initial.outputs.IMAGE_COUNT_INITIAL }}" -ne "${{ steps.count_afterwards.outputs.IMAGE_COUNT_AFTER }}" ]; then |
| 126 | + initial_count=${{ steps.count_initial.outputs.IMAGE_COUNT_INITIAL }} |
| 127 | + final_count=${{ steps.count_afterwards.outputs.IMAGE_COUNT_AFTER }} |
| 128 | + difference=$((final_count - initial_count)) |
| 129 | + echo "$difference additional container images were \n downloaded at runtime . The pipeline has no support for offline runs!" |
| 130 | + tree ./singularity_container_images > ./container_afterwards |
| 131 | + diff ./container_initial ./container_afterwards |
| 132 | + exit 1 |
| 133 | + else |
| 134 | + echo "The pipeline can be downloaded successfully!" |
| 135 | + fi |
| 136 | +
|
| 137 | + - name: Upload Nextflow logfile for debugging purposes |
| 138 | + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 |
| 139 | + with: |
| 140 | + name: nextflow_logfile.txt |
| 141 | + path: .nextflow.log* |
| 142 | + include-hidden-files: true |
0 commit comments