Skip to content

add mafft/align module to msa_alignment class #195

add mafft/align module to msa_alignment class

add mafft/align module to msa_alignment class #195

Workflow file for this run

name: Run Tests
on:
pull_request:
branches: [main]
workflow_dispatch:
# Cancel if a newer run is started
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
nf-test-changes:
name: nf-test-changes
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.zip.outputs.matrix }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
- name: List nf-test files
id: list
uses: adamrtalbot/detect-nf-test-changes@de3c3c8e113031b4f15a3c1104b5f135e8346997 # v0.0.6
with:
head: ${{ github.sha }}
base: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha }}
n_parents: 0
- name: Select subworkflows
id: outputs
run: |
echo subworkflows=$(echo '${{ steps.list.outputs.components }}' | jq '. | map(select(contains("subworkflows"))) | map(gsub("subworkflows/mirpedrol/"; "")) | map(gsub("/tests/main.nf.test"; ""))') >> $GITHUB_OUTPUT
- name: debug
run: |
echo ${{ steps.outputs.outputs.subworkflows }}
- name: Zip paths and subworkflows
id: zip
run: |
paths=$(echo '${{ steps.list.outputs.components }}' | jq '.')
subworkflows=$(echo '${{ steps.outputs.outputs.subworkflows }}' | jq '.')
profiles='["conda", "docker", "singularity"]'
profiles=$(echo $profiles | jq '.')
echo matrix=$(
jq -n --argjson paths "$paths" --argjson subworkflows "$subworkflows" --argjson profiles "$profiles" '
[range(0; ($paths|length)) as $i
| $profiles[] as $profile
| {
path: $paths[$i],
subworkflow: $subworkflows[$i],
profile: $profile
}
]
| map(select(.profile != "conda" or .subworkflow != "msa_alignment"))
| map(select(.profile != "conda" or .subworkflow != "msa_guidetree"))
'
) >> $GITHUB_OUTPUT
# Filter out conda failing testes with a map
nf-test:
runs-on: ubuntu-latest
name: nf-test
needs: nf-test-changes
if: ( needs.nf-test-changes.outputs.matrix != '[]' )
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.nf-test-changes.outputs.matrix) }}
env:
NXF_ANSI_LOG: false
NFTEST_VER: "0.8.4"
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4
with:
distribution: "temurin"
java-version: "17"
- name: Install nf-core tools development version
run: python -m pip install --upgrade --force-reinstall git+https://github.com/nf-core/tools.git@dev
- name: Setup Nextflow
uses: nf-core/setup-nextflow@v2
- name: Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5
with:
python-version: "3.11"
- name: Install nf-test
uses: nf-core/setup-nf-test@v1
with:
version: "0.9.2"
install-pdiff: true
- name: Setup apptainer
if: matrix.profile == 'singularity'
uses: eWaterCycle/setup-apptainer@main
- name: Set up Singularity
if: matrix.profile == 'singularity'
shell: bash
run: |
mkdir -p ${{ github.workspace }}/.singularity
mkdir -p ${{ github.workspace }}/.singularity
- name: Conda setup
if: matrix.profile == 'conda'
uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3
with:
auto-update-conda: true
conda-solver: libmamba
conda-remove-defaults: true
- name: Install Python dependencies
run: python -m pip install --upgrade pip cryptography
# Install the subworkflow to a pipeline
- name: create a pipeline
run: |
mkdir create-test-wf
cd create-test-wf
nf-core --log-file log.txt pipelines create -n testpipeline -d "This pipeline is for testing subworkflows" -a "Me"
- name: update resource limits
run: |
cd create-test-wf
cat <<EOF >> nf-core-testpipeline/tests/nextflow.config
process {
withName: '.*'{
cpus = 2
memory = 15.GB
time = 2.h
}
}
EOF
- name: Install subworkflow ${{ matrix.subworkflow }}
run: |
cd create-test-wf/nf-core-testpipeline
nf-core subworkflows --git-remote https://github.com/mirpedrol/class-modules --branch ${{ github.head_ref }} install ${{ matrix.subworkflow }}
# This will only work for branches comming from the same repo, not from a fork
# TODO: possibly change the git-remote if the PR comes from a fork
- name: Check if snapshot exists
run: |
if [ ! -f "${{ github.workspace }}/create-test-wf/nf-core-testpipeline/${{ matrix.path }}.snap" ]; then
echo "Error: Snapshot file not found at ${{ github.workspace }}/create-test-wf/nf-core-testpipeline/${{ matrix.path }}.snap please download the snapshot artifact and add it to the subworkflow test/ directory."
exit 1
fi
echo "Snapshot file found successfully"
# Test the component
- name: Run nf-test
shell: bash
if: always()
env:
NFT_DIFF: "pdiff"
NFT_DIFF_ARGS: "--line-numbers --width 120 --expand-tabs=2"
run: |
cd create-test-wf/nf-core-testpipeline
PROFILE=${{ matrix.profile }}
NFT_WORKDIR=~
nf-test test \
--profile=${{ matrix.profile }} \
--verbose \
${{ matrix.path }}
- name: Upload nf-test snapshot
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: nf-test-output-${{ matrix.profile }}-${{ matrix.subworkflow }}
path: ${{ github.workspace }}/create-test-wf/nf-core-testpipeline/${{ matrix.path }}.snap
- name: Clean up
if: always()
run: |
sudo rm -rf /home/ubuntu/tests/
confirm-pass:
runs-on: ubuntu-latest
needs: [nf-test-changes, nf-test]
if: always()
steps:
- name: All tests ok
if: ${{ success() || !contains(needs.*.result, 'failure') }}
run: exit 0
- name: One or more tests failed
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1
- name: debug-print
if: always()
run: |
echo "toJSON(needs) = ${{ toJSON(needs) }}"
echo "toJSON(needs.*.result) = ${{ toJSON(needs.*.result) }}"