|
| 1 | +name: Run GPU nf-tests |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - dev |
| 6 | + - master |
| 7 | + - main |
| 8 | + paths-ignore: |
| 9 | + - "docs/**" |
| 10 | + - "**/meta.yml" |
| 11 | + - "**/*.md" |
| 12 | + - "**/*.png" |
| 13 | + - "**/*.svg" |
| 14 | + pull_request: |
| 15 | + paths-ignore: |
| 16 | + - "docs/**" |
| 17 | + - "**/meta.yml" |
| 18 | + - "**/*.md" |
| 19 | + - "**/*.png" |
| 20 | + - "**/*.svg" |
| 21 | + workflow_dispatch: |
| 22 | + |
| 23 | +# Cancel if a newer run is started |
| 24 | +concurrency: |
| 25 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 26 | + cancel-in-progress: true |
| 27 | + |
| 28 | +env: |
| 29 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 30 | + NFT_VER: "0.9.3" |
| 31 | + NFT_WORKDIR: "~" |
| 32 | + NXF_ANSI_LOG: false |
| 33 | + NXF_SINGULARITY_CACHEDIR: ${{ github.workspace }}/.singularity |
| 34 | + NXF_SINGULARITY_LIBRARYDIR: ${{ github.workspace }}/.singularity |
| 35 | + NXF_VER: "25.10.0" |
| 36 | + |
| 37 | +jobs: |
| 38 | + nf-test-changes: |
| 39 | + name: nf-test-changes |
| 40 | + runs-on: # use self-hosted runners; use a GPU-capable runner for nf-test-gpu job |
| 41 | + - runs-on=${{ github.run_id }}-nf-test-changes-gpu |
| 42 | + - runner=4cpu-linux-x64 |
| 43 | + outputs: |
| 44 | + paths: ${{ steps.list.outputs.components }} |
| 45 | + shard: ${{ steps.shard-outputs.outputs.shard }} |
| 46 | + total_shards: ${{ steps.shard-outputs.outputs.total_shards }} |
| 47 | + steps: |
| 48 | + - name: Clean Workspace |
| 49 | + run: | |
| 50 | + ls -la ./ |
| 51 | + rm -rf ./* || true |
| 52 | + rm -rf ./.??* || true |
| 53 | + ls -la ./ |
| 54 | + - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 |
| 55 | + with: |
| 56 | + fetch-depth: 0 |
| 57 | + |
| 58 | + - name: List nf-test files (GPU only) |
| 59 | + id: list |
| 60 | + uses: adamrtalbot/detect-nf-test-changes@de3c3c8e113031b4f15a3c1104b5f135e8346997 # v0.0.6 |
| 61 | + with: |
| 62 | + head: ${{ github.sha }} |
| 63 | + base: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || 'origin/main' }} |
| 64 | + n_parents: 0 |
| 65 | + tags: "gpu" |
| 66 | + |
| 67 | + - name: get number of shards |
| 68 | + id: set-shards |
| 69 | + if: ${{ steps.list.outputs.components != '[]' }} |
| 70 | + uses: ./.github/actions/get-shards |
| 71 | + env: |
| 72 | + NFT_VER: ${{ env.NFT_VER }} |
| 73 | + with: |
| 74 | + max_shards: 2 |
| 75 | + paths: "${{ join(fromJson(steps.list.outputs.components), ' ') }}" |
| 76 | + |
| 77 | + - name: Set shard outputs |
| 78 | + id: shard-outputs |
| 79 | + run: | |
| 80 | + if [ '${{ steps.list.outputs.components }}' = '[]' ]; then |
| 81 | + echo "shard=[]" >> $GITHUB_OUTPUT |
| 82 | + echo "total_shards=0" >> $GITHUB_OUTPUT |
| 83 | + else |
| 84 | + echo "shard=${{ steps.set-shards.outputs.shard }}" >> $GITHUB_OUTPUT |
| 85 | + echo "total_shards=${{ steps.set-shards.outputs.total_shards }}" >> $GITHUB_OUTPUT |
| 86 | + fi |
| 87 | +
|
| 88 | + - name: debug |
| 89 | + run: | |
| 90 | + echo ${{ steps.list.outputs.components }} |
| 91 | + echo ${{ steps.shard-outputs.outputs.shard }} |
| 92 | + echo ${{ steps.shard-outputs.outputs.total_shards }} |
| 93 | +
|
| 94 | + nf-test-gpu: |
| 95 | + name: "GPU | ${{ matrix.profile }} | ${{ matrix.shard }}/${{ needs.nf-test-changes.outputs.total_shards }}" |
| 96 | + needs: [nf-test-changes] |
| 97 | + if: ${{ needs.nf-test-changes.outputs.total_shards != '0' }} |
| 98 | + runs-on: # use a GPU-capable runner (e.g. self-hosted with GPU or cloud GPU instance) |
| 99 | + - runs-on=${{ github.run_id }}-nf-test-gpu |
| 100 | + - runner=4cpu-linux-x64 |
| 101 | + - gpu |
| 102 | + strategy: |
| 103 | + fail-fast: false |
| 104 | + matrix: |
| 105 | + shard: ${{ fromJson(needs.nf-test-changes.outputs.shard) }} |
| 106 | + profile: [docker, singularity] |
| 107 | + env: |
| 108 | + NXF_ANSI_LOG: false |
| 109 | + TOTAL_SHARDS: ${{ needs.nf-test-changes.outputs.total_shards }} |
| 110 | + NXF_VERSION: ${{ env.NXF_VER }} |
| 111 | + |
| 112 | + steps: |
| 113 | + - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 |
| 114 | + with: |
| 115 | + fetch-depth: 0 |
| 116 | + |
| 117 | + - name: Verify GPU |
| 118 | + run: | |
| 119 | + nvidia-smi -L || true |
| 120 | +
|
| 121 | + - name: Run nf-test |
| 122 | + id: run_nf_test |
| 123 | + uses: ./.github/actions/nf-test |
| 124 | + env: |
| 125 | + NFT_WORKDIR: ${{ env.NFT_WORKDIR }} |
| 126 | + NXF_VERSION: ${{ env.NXF_VER }} |
| 127 | + with: |
| 128 | + profile: ${{ matrix.profile }},gpu |
| 129 | + shard: ${{ matrix.shard }} |
| 130 | + total_shards: ${{ env.TOTAL_SHARDS }} |
| 131 | + paths: "${{ join(fromJson(needs.nf-test-changes.outputs.paths), ' ') }}" |
| 132 | + |
| 133 | + confirm-pass-gpu: |
| 134 | + needs: [nf-test-gpu] |
| 135 | + if: always() |
| 136 | + runs-on: |
| 137 | + - runs-on=${{ github.run_id }}-confirm-pass-gpu |
| 138 | + - runner=2cpu-linux-x64 |
| 139 | + steps: |
| 140 | + - name: One or more tests failed |
| 141 | + if: ${{ contains(needs.*.result, 'failure') }} |
| 142 | + run: exit 1 |
| 143 | + |
| 144 | + - name: One or more tests cancelled |
| 145 | + if: ${{ contains(needs.*.result, 'cancelled') }} |
| 146 | + run: exit 1 |
| 147 | + |
| 148 | + - name: All tests ok |
| 149 | + if: ${{ contains(needs.*.result, 'success') }} |
| 150 | + run: exit 0 |
| 151 | + |
| 152 | + - name: debug-print |
| 153 | + if: always() |
| 154 | + run: | |
| 155 | + echo "toJSON(needs) = ${{ toJSON(needs) }}" |
| 156 | + echo "toJSON(needs.*.result) = ${{ toJSON(needs.*.result) }}" |
0 commit comments