From 3557ae9514d65a711e5c4d5ac1da861dbac4fb96 Mon Sep 17 00:00:00 2001 From: Benjamin Wingfield Date: Thu, 20 Jul 2023 10:21:19 +0100 Subject: [PATCH] run pytest workflow --- .github/workflows/ci.yml | 37 ++++++++++++++++++ .github/workflows/module.yml | 73 ++++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 .github/workflows/module.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 40d09781..6ff2b930 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,3 +33,40 @@ jobs: cache-key: ${{ needs.preload_singularity.outputs.cache-key }} singularity: true + pytest_workflow_docker: + needs: preload_docker + uses: ./.github/workflows/module.yml + strategy: + matrix: + tags: + - "test input check subworkflow" + - "test input check subworkflow with PGS catalog API" + - "test input check subworkflow with PGS catalog API and whitespace" + - "test make compatible subworkflow with bfile" + - "test make compatible subworkflow with vcf" + - "test make compatible subworkflow with pfile" + - "test input check subworkflow with liftover 38to37" + - "test input check subworkflow with liftover 37to38" + - "test apply score subworkflow" + - "test perfect apply score" + - "test combine scorefiles module" + - "test match module" + - "test match combine module" + - "plink2 testrelabelpvar" + - "plink2 testscore" + - "plink2 testsmallscore" + - "plink2 testmultiscore" + - "plink2 testsmallmultiscore" + - "plink2 testmultiscorefail" + - "plink2 vcf" + - "plink2 testrelabelbim" + - "pgscatalog test --pgs_id" + - "pgscatalog test --efo_trait --pgp_id and --pgs_id" + - "pgscatalog test bad accession" + - "pgscatalog test good and bad accessions GRCh38" + with: + cache-key: ${{ needs.preload_docker.outputs.cache-key }} + docker: true + tag: ${{ matrix.tags }} + + diff --git a/.github/workflows/module.yml b/.github/workflows/module.yml new file mode 100644 index 00000000..cb10ae2d --- /dev/null +++ b/.github/workflows/module.yml @@ -0,0 +1,73 @@ +name: Run pytest-workflow + +on: + workflow_call: + inputs: + cache-key: + type: string + required: true + docker: + type: boolean + singularity: + type: boolean + tag: + type: string + required: true + +env: + NXF_SINGULARITY_CACHEDIR: ${{ github.workspace }}/singularity + SINGULARITY_VERSION: 3.8.3 + +jobs: + docker: + if: ${{ inputs.docker }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + + steps: + - name: Check out pipeline code + uses: actions/checkout@v3 + + - uses: nf-core/setup-nextflow@v1 + with: + version: ${{ matrix.nxf_ver }} + + - name: Restore docker images + if: matrix.profile == 'docker' + id: restore-docker + uses: actions/cache/restore@v3 + with: + path: ${{ runner.temp }}/docker + key: ${{ inputs.cache-key }} + + - name: Load docker images from cache + if: steps.restore-docker.outputs.cache-hit == 'true' + run: | + find $HOME -name '*.tar' + find ${{ runner.temp }}/docker/ -name '*.tar' -exec sh -c 'docker load < {}' \; + + - name: Set up test requirements + uses: actions/setup-python@v3 + with: + python-version: '3.10' + cache: 'pip' + - run: pip install -r ${{ github.workspace }}/tests/requirements.txt + + - name: Run unit tests + run: TMPDIR=~ PROFILE=docker pytest --kwdof --symlink --git-aware --wt 2 --tag "${{ inputs.tag }}" --ignore tests/bin + + - name: Upload logs on failure + if: failure() + uses: actions/upload-artifact@v2 + with: + name: logs-docker-${{ inputs.tag }} + path: | + /home/runner/pytest_workflow_*/*/.nextflow.log + /home/runner/pytest_workflow_*/*/log.out + /home/runner/pytest_workflow_*/*/log.err + /home/runner/pytest_workflow_*/*/work + !/home/runner/pytest_workflow_*/*/work/conda + !/home/runner/pytest_workflow_*/*/work/singularity + +