Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor and add test actions #93

Merged
merged 108 commits into from
May 24, 2024
Merged

Refactor and add test actions #93

merged 108 commits into from
May 24, 2024

Conversation

endast
Copy link
Collaborator

@endast endast commented May 17, 2024

This pr waits for this pr before merging to make sure all pipelines work:
#92

What

This PR makes sure we have pipeline tests for all pipelines in the repo (the annotation pipeline only has as smoke test).
It also adds reusable workflows for the pipeline and pytests workflows. This way we don't need to duplicate the code to run the tests. Also the pipelines run in parallel now so we speed up the time to run all the tests.

So now a new pipeline can be added like this (with both smoke and full tests:

  # Association Testing Pretrained Pipeline
  Smoke-Association-Testing-Pretrained:
    uses: ./.github/workflows/run-pipeline.yml
    with:
      pipeline_file: ./pipelines/association_testing_pretrained.snakefile
      environment_file: ./deeprvat_env_no_gpu.yml
      prerun_cmd: cd ./example && ln -s ../pretrained_models

  Pipeline-Tests-Training-Association-Testing:
    needs: Smoke-Association-Testing-Pretrained
    uses: ./.github/workflows/run-pipeline.yml
    with:
      pipeline_file: ./pipelines/association_testing_pretrained.snakefile
      environment_file: ./deeprvat_env_no_gpu.yml
      prerun_cmd: cd ./example && ln -s ../pretrained_models
      dry_run: false

Instead of this:

jobs:
  DeepRVAT-Pipeline-Smoke-Tests:
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository code
        uses: actions/checkout@v4
      - uses: mamba-org/setup-micromamba@v1.8.1
        with:
          environment-name: deeprvat-gh-action
          environment-file: ${{ github.workspace }}/deeprvat_env_no_gpu.yml
          cache-environment: true
          cache-downloads: true
      - name: Link pretrained models
        run: cd ${{ github.workspace }}/example && ln -s ../pretrained_models
        shell: bash -el {0}
      - name: Smoketest association_testing_pretrained pipeline
        run: |
          python -m snakemake -n -j 2 --directory ${{ github.workspace }}/example \
          --snakefile ${{ github.workspace }}/pipelines/association_testing_pretrained.snakefile --show-failed-logs
        shell: micromamba-shell {0}
      - name: Copy seed gene discovery snakemake config
        run: cd ${{ github.workspace }}/example && cp ../deeprvat/seed_gene_discovery/config.yaml .
        shell: bash -el {0}
      - name: Smoketest seed_gene_discovery pipeline
        run: |
          python -m snakemake -n -j 2 --directory ${{ github.workspace }}/example \
          --snakefile ${{ github.workspace }}/pipelines/seed_gene_discovery.snakefile --show-failed-logs
        shell: micromamba-shell {0}

  DeepRVAT-Pipeline-Tests:
    runs-on: ubuntu-latest
    needs: DeepRVAT-Pipeline-Smoke-Tests
    steps:
      - name: Check out repository code
        uses: actions/checkout@v4
      - uses: mamba-org/setup-micromamba@v1.8.1
        with:
          environment-name: deeprvat-gh-action
          environment-file: ${{ github.workspace }}/deeprvat_env_no_gpu.yml
          cache-environment: true
          cache-downloads: true
      - name: Install DeepRVAT
        run: pip install -e ${{ github.workspace }}
        shell: micromamba-shell {0}
      # There are no GPUs on the gh worker, so we disable it in the config
      - name: Update config to use no gpus
        run: "sed -i 's/gpus: 1/gpus: 0/' ${{ github.workspace }}/example/config.yaml"
        shell: bash -el {0}
      - name: Link pretrained models
        run: cd ${{ github.workspace }}/example && ln -s ../pretrained_models
        shell: bash -el {0}
      - name: Run association_testing_pretrained pipeline
        run: |
          python -m snakemake -j 2 --directory ${{ github.workspace }}/example \
          --snakefile ${{ github.workspace }}/pipelines/association_testing_pretrained.snakefile --show-failed-logs
        shell: micromamba-shell {0}

image

And new code tests (pytest) can now be added like this:

  DeepRVAT-Tests-Runner-Preprocessing:
    uses: ./.github/workflows/run-pytest.yml
    with:
      environment_file: ./deeprvat_preprocessing_env.yml
      test_path: ./tests/preprocessing

image

Testing

All the tests should run in github actions, so proof reading the yaml files should be enough if the pipelines pass in actions.

@endast endast added the wait Don't merge yet label May 17, 2024
@endast endast marked this pull request as ready for review May 23, 2024 14:49
@endast endast requested a review from Marcel-Mueck May 23, 2024 14:49
@endast endast added enhancement New feature or request and removed wait Don't merge yet labels May 23, 2024
@endast endast changed the title More pipeline smoketests Refactor and add pipeline tests May 23, 2024
@endast endast changed the title Refactor and add pipeline tests Refactor and add test actions May 23, 2024
Copy link
Collaborator

@Marcel-Mueck Marcel-Mueck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@endast endast merged commit b7f8e36 into main May 24, 2024
24 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants