|
| 1 | +name: "nf-test Action" |
| 2 | +description: "Runs nf-test with common setup steps" |
| 3 | +inputs: |
| 4 | + profile: |
| 5 | + description: "Profile to use" |
| 6 | + required: true |
| 7 | + shard: |
| 8 | + description: "Shard number for this CI job" |
| 9 | + required: true |
| 10 | + total_shards: |
| 11 | + description: "Total number of test shards(NOT the total number of matrix jobs)" |
| 12 | + required: true |
| 13 | + filters: |
| 14 | + description: "Filter test cases by specified types (e.g., module, pipeline, workflow or function)" |
| 15 | + required: true |
| 16 | + tags: |
| 17 | + description: "Tags to pass as argument for nf-test --tag parameter" |
| 18 | + required: true |
| 19 | + |
| 20 | +runs: |
| 21 | + using: "composite" |
| 22 | + steps: |
| 23 | + - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4 |
| 24 | + with: |
| 25 | + distribution: "temurin" |
| 26 | + java-version: "17" |
| 27 | + |
| 28 | + - name: Setup Nextflow |
| 29 | + uses: nf-core/setup-nextflow@v2 |
| 30 | + with: |
| 31 | + version: "${{ env.NXF_VER }}" |
| 32 | + |
| 33 | + - name: Set up Python |
| 34 | + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5 |
| 35 | + with: |
| 36 | + python-version: "3.11" |
| 37 | + |
| 38 | + - name: Install nf-test |
| 39 | + uses: nf-core/setup-nf-test@v1 |
| 40 | + with: |
| 41 | + version: "${{ env.NFT_VER }}" |
| 42 | + install-pdiff: true |
| 43 | + |
| 44 | + - name: Setup apptainer |
| 45 | + if: contains(inputs.profile, 'singularity') |
| 46 | + uses: eWaterCycle/setup-apptainer@main |
| 47 | + |
| 48 | + - name: Set up Singularity |
| 49 | + if: contains(inputs.profile, 'singularity') |
| 50 | + shell: bash |
| 51 | + run: | |
| 52 | + mkdir -p $NXF_SINGULARITY_CACHEDIR |
| 53 | + mkdir -p $NXF_SINGULARITY_LIBRARYDIR |
| 54 | +
|
| 55 | + - name: Conda setup |
| 56 | + if: ${{inputs.profile == 'conda'}} |
| 57 | + uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3 |
| 58 | + with: |
| 59 | + auto-update-conda: true |
| 60 | + conda-solver: libmamba |
| 61 | + conda-remove-defaults: true |
| 62 | + |
| 63 | + - name: Run nf-test |
| 64 | + shell: bash |
| 65 | + run: | |
| 66 | + NFT_WORKDIR=~ \ |
| 67 | + nf-test test \ |
| 68 | + --ci \ |
| 69 | + --shard ${{ inputs.shard }}/${{ inputs.total_shards }} \ |
| 70 | + --changed-since HEAD^ \ |
| 71 | + --profile=${{ inputs.profile }} \ |
| 72 | + --filter ${{ inputs.filters }} \ |
| 73 | + --tap=test.tap \ |
| 74 | + --verbose \ |
| 75 | + --tag ${{ inputs.tags }} |
| 76 | +
|
| 77 | + # TODO If no test.tap, then make one to spoof? |
| 78 | + - uses: pcolby/tap-summary@0959cbe1d4422e62afc65778cdaea6716c41d936 # v1 |
| 79 | + if: ${{ inputs.path != '' }} |
| 80 | + with: |
| 81 | + path: >- |
| 82 | + test.tap |
| 83 | +
|
| 84 | + - name: Clean up |
| 85 | + if: always() |
| 86 | + shell: bash |
| 87 | + run: | |
| 88 | + sudo rm -rf /home/ubuntu/tests/* |
0 commit comments