Skip to content

Commit

Permalink
troubleshooting
Browse files Browse the repository at this point in the history
  • Loading branch information
anwarMZ committed Nov 27, 2024
1 parent e78df42 commit f65776c
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 85 deletions.
174 changes: 90 additions & 84 deletions .github/actions/nf-test-action/action.yml
Original file line number Diff line number Diff line change
@@ -1,100 +1,106 @@
name: "nf-test Action"
description: "Runs nf-test with common setup steps"
inputs:
profile:
description: "Profile to use"
required: true
component_path:
description: "Path to the component to test"
required: true
tags:
description: "Tags to test (`<tags>[,<tags>...]`)"
required: false
profile:
description: "Profile to use"
required: true
component_path:
description: "Path to the component to test"
required: true
tags:
description: "Tags to test (`<tags>[,<tags>...]`)"
required: false

runs:
using: "composite"
steps:
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4
with:
distribution: "temurin"
java-version: "17"
using: "composite"
steps:
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4
with:
distribution: "temurin"
java-version: "17"

- name: Setup Nextflow
uses: nf-core/setup-nextflow@v2
with:
version: "${{ env.NXF_VERSION }}"
- name: Setup Nextflow
uses: nf-core/setup-nextflow@v2
with:
version: "${{ env.NXF_VERSION }}"

- name: Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5
with:
python-version: "3.11"
- 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: "${{ env.NFT_VER }}"
install-pdiff: true
- name: Install nf-test
uses: nf-core/setup-nf-test@v1
with:
version: "${{ env.NFT_VER }}"
install-pdiff: true

- name: Setup apptainer
if: contains(inputs.profile, 'singularity')
uses: eWaterCycle/setup-apptainer@main
- name: Setup apptainer
if: contains(inputs.profile, 'singularity')
uses: eWaterCycle/setup-apptainer@main

- name: Set up Singularity
if: contains(inputs.profile, 'singularity')
shell: bash
run: |
mkdir -p $NXF_SINGULARITY_CACHEDIR
mkdir -p $NXF_SINGULARITY_LIBRARYDIR
- name: Set up Singularity
if: contains(inputs.profile, 'singularity')
shell: bash
run: |
mkdir -p $NXF_SINGULARITY_CACHEDIR
mkdir -p $NXF_SINGULARITY_LIBRARYDIR
- name: Conda setup
if: ${{inputs.profile == 'conda'}}
uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3
with:
auto-update-conda: true
conda-solver: libmamba
conda-remove-defaults: true
- name: Conda setup
if: ${{inputs.profile == 'conda'}}
uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3
with:
auto-update-conda: true
conda-solver: libmamba
conda-remove-defaults: true

- name: Set up nextflow secrets
if: env.SENTIEON_ENCRYPTION_KEY != '' && env.SENTIEON_LICENSE_MESSAGE != ''
shell: bash
run: |
python -m pip install cryptography
nextflow secrets set SENTIEON_AUTH_DATA $(python3 tests/modules/nf-core/sentieon/license_message.py encrypt --key "$SENTIEON_ENCRYPTION_KEY" --message "$SENTIEON_LICENSE_MESSAGE")
- name: Set up nextflow secrets
if: env.SENTIEON_ENCRYPTION_KEY != '' && env.SENTIEON_LICENSE_MESSAGE != ''
shell: bash
run: |
python -m pip install cryptography
nextflow secrets set SENTIEON_AUTH_DATA $(python3 tests/modules/nf-core/sentieon/license_message.py encrypt --key "$SENTIEON_ENCRYPTION_KEY" --message "$SENTIEON_LICENSE_MESSAGE")
- name: Run nf-test
shell: bash
env:
SENTIEON_LICSRVR_IP: ${{ env.SENTIEON_LICSRVR_IP }}
SENTIEON_AUTH_MECH: "GitHub Actions - token"
TAGS: ${{ inputs.tags && format('--tag {0}', inputs.tags) || '' }}
NFT_WORKDIR: "~"
run: |
cd ${{ inputs.component_path }}
if [ ! -f "tests/main.nf.test" ]; then
echo "No tests found in ${{ inputs.component_path }}/tests/"
echo "No tests executed" > test.tap
else
nf-test test \
--profile=${{ inputs.profile }} \
--tap=test.tap \
--verbose \
--ci \
--filter process,workflow \
--follow-dependencies \
${{ env.TAGS }} || true
fi
- name: Run nf-test
shell: bash
env:
SENTIEON_LICSRVR_IP: ${{ env.SENTIEON_LICSRVR_IP }}
SENTIEON_AUTH_MECH: "GitHub Actions - token"
TAGS: ${{ inputs.tags && format('--tag {0}', inputs.tags) || '' }}
NFT_WORKDIR: "~"
run: |
cd ${{ inputs.component_path }}
echo "Current directory: $(pwd)"
echo "Contents of current directory:"
ls -la
echo "Contents of tests directory (if exists):"
ls -la tests || echo "No tests directory found"
# Display test.tap content for debugging
echo "Contents of test.tap:"
cat test.tap
if [ -d "tests" ] && [ "$(ls -A tests)" ]; then
echo "Running nf-test..."
nf-test test \
--profile=${{ inputs.profile }} \
--tap=test.tap \
--verbose \
--ci \
--filter process,workflow \
--follow-dependencies \
${{ env.TAGS }} || true
else
echo "No tests found in ${{ inputs.component_path }}/tests/"
echo "No tests executed" > test.tap
fi
- uses: pcolby/tap-summary@0959cbe1d4422e62afc65778cdaea6716c41d936 # v1
if: always()
with:
path: ${{ inputs.component_path }}/test.tap
echo "Contents of test.tap:"
cat test.tap || echo "test.tap file not found"
- name: Clean up
if: always()
shell: bash
run: |
sudo rm -rf /home/ubuntu/tests/
- uses: pcolby/tap-summary@0959cbe1d4422e62afc65778cdaea6716c41d936 # v1
if: always()
with:
path: ${{ inputs.component_path }}/test.tap

- name: Clean up
if: always()
shell: bash
run: |
sudo rm -rf /home/ubuntu/tests/
10 changes: 9 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
id: get-components
run: |
components=$(find modules/nf-core subworkflows/nf-core -type d -maxdepth 2 -mindepth 1 | while read component; do
if [ -d "$component/tests" ]; then
if [ -d "$component/tests" ] && [ "$(ls -A $component/tests)" ]; then
echo "$component"
fi
done | jq -R -s -c 'split("\n") | map(select(length > 0))')
Expand Down Expand Up @@ -84,3 +84,11 @@ jobs:
with:
profile: ${{ matrix.profile }}
component_path: ${{ matrix.component }}

- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
with:
name: nf-test-results-${{ matrix.component }}-${{ matrix.profile }}
path: ${{ matrix.component }}/test.tap
retention-days: 1

0 comments on commit f65776c

Please sign in to comment.