Skip to content

Commit

Permalink
Merge branch 'galaxyproject:main' into VGP
Browse files Browse the repository at this point in the history
  • Loading branch information
Delphine-L authored Apr 10, 2024
2 parents be4df36 + c334a0b commit b461f6b
Show file tree
Hide file tree
Showing 303 changed files with 71,563 additions and 5,131 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
types: [run-all-workflow-tests-command]
env:
GALAXY_FORK: galaxyproject
GALAXY_BRANCH: release_22.05
GALAXY_BRANCH: release_24.0
MAX_CHUNKS: 40
jobs:
setup:
Expand All @@ -23,7 +23,7 @@ jobs:
chunk-list: ${{ steps.discover.outputs.chunk-list }}
strategy:
matrix:
python-version: ['3.7']
python-version: ['3.11']
steps:
- name: Add reaction
if: ${{ github.event.client_payload.slash_command.command == 'run-all-workflow-tests' }}
Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7']
python-version: ['3.11']
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -116,7 +116,7 @@ jobs:
fail-fast: false
matrix:
chunk: ${{ fromJson(needs.setup.outputs.chunk-list) }}
python-version: ['3.7']
python-version: ['3.11']
services:
postgres:
image: postgres:11
Expand Down Expand Up @@ -168,7 +168,7 @@ jobs:
needs: [setup, test]
strategy:
matrix:
python-version: ['3.7']
python-version: ['3.11']
# This job runs on Linux
runs-on: ubuntu-latest
steps:
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/comment_on_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Comment on the pull request

# read-write repo token
# access to secrets
on:
workflow_run:
workflows: ["Galaxy Workflow Tests for push and PR"]
types:
- completed

jobs:
download_and_comment:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'failure'
steps:
- name: 'Download artifact'
uses: actions/github-script@v7
with:
script: |
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == 'All tool test results'
})[0];
var download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/upload.zip', Buffer.from(download.data));
- run: unzip upload.zip
- name: 'Comment on PR'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
var fs = require('fs');
var issue_number = Number(fs.readFileSync('./NR'));
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: fs.readFileSync('./tool_test_output.md', 'utf-8')
});
6 changes: 3 additions & 3 deletions .github/workflows/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ on:
inputs:
python-version-list:
description: 'stringified JSON array of Python versions'
default: "[\"3.7\"]"
default: "[\"3.11\"]"
required: false
type: string
galaxy-fork:
description: 'Galaxy fork to use'
default: ''
default: galaxyproject
required: false
type: string
galaxy-branch:
description: 'Galaxy branch to use'
default: ''
default: master
required: false
type: string
max-chunks:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test_workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:
type: string
python-version-list:
description: 'stringified JSON array of Python versions'
default: "[\"3.7\"]"
default: "[\"3.11\"]"
required: false
type: string
repository-list:
Expand All @@ -28,12 +28,12 @@ on:
type: string
galaxy-fork:
description: 'Galaxy fork to use'
default: ''
default: galaxyproject
required: false
type: string
galaxy-branch:
description: 'Galaxy branch to use'
default: ''
default: master
required: false
type: string
check-outputs:
Expand Down
45 changes: 37 additions & 8 deletions .github/workflows/workflow_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
name: Setup cache and determine changed repositories
uses: ./.github/workflows/setup.yml
with:
python-version-list: "[\"3.7\"]"
galaxy-fork: galaxyproject
galaxy-branch: release_22.05
python-version-list: "[\"3.11\"]"
max-chunks: 4
galaxy-fork: galaxyproject
galaxy-branch: release_24.0

# Planemo lint the changed repositories
lint:
Expand All @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7']
python-version: ['3.11']
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -54,10 +54,10 @@ jobs:
galaxy-head-sha: ${{ needs.setup.outputs.galaxy-head-sha }}
chunk-count: ${{ fromJSON(needs.setup.outputs.chunk-count) }}
chunk-list: ${{ needs.setup.outputs.chunk-list }}
python-version-list: "[\"3.7\"]"
python-version-list: "[\"3.11\"]"
repository-list: ${{ needs.setup.outputs.repository-list }}
galaxy-fork: galaxyproject
galaxy-branch: master
galaxy-branch: release_24.0
check-outputs: false

combine_outputs:
Expand All @@ -66,7 +66,7 @@ jobs:
needs: [setup, test]
strategy:
matrix:
python-version: ['3.7']
python-version: ['3.11']
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
Expand All @@ -87,6 +87,13 @@ jobs:
with:
mode: combine
html-report: true
markdown-report: true
- run: cat upload/tool_test_output.md >> $GITHUB_STEP_SUMMARY
- name: Save PR number
run: echo ${{ github.event.number }} > ./upload/NR
- name: Debug PR number
run: |
cat ./upload/NR
- uses: actions/upload-artifact@v3
with:
name: 'All tool test results'
Expand All @@ -103,7 +110,7 @@ jobs:
needs: [setup,test,combine_outputs]
strategy:
matrix:
python-version: ['3.7']
python-version: ['3.11']
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.repository_owner == 'galaxyproject'
steps:
Expand Down Expand Up @@ -139,3 +146,25 @@ jobs:
workflows: true
workflow-namespace: iwc-workflows
github-token: ${{ secrets.IWC_WORKFLOWS_BOT_TOKEN }}

deploy-report:
name: Report deploy status
needs: [deploy]
if: ${{ always() && needs.deploy.result != 'success' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' ) && github.repository_owner == 'galaxyproject' }}
runs-on: ubuntu-latest
steps:
# report to the PR if deployment failed
- name: Get PR object
uses: 8BitJonny/[email protected]
id: getpr
with:
sha: ${{ github.event.after }}
- name: Create comment
uses: peter-evans/create-or-update-comment@v3
with:
token: ${{ secrets.PAT }}
issue-number: ${{ steps.getpr.outputs.number }}
body: |
Attention: deployment ${{ needs.deploy.result }}!
https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
Binary file added static/update_workflow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 34 additions & 23 deletions workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,38 @@ The structure is as follows:

* top-level directories represent categories, e.g., `sars-cov-2-variant-calling`;
* directories right under the top level represent individual workflow repositories, e.g., `sars-cov-2-consensus-from-variation` which will be deployed to https://github.com/iwc-workflows/sars-cov-2-consensus-from-variation;
* please, only use lower case and `-` in directory names.
* workflow repository directories contain:

* the `.ga` workflow file, e.g., `consensus-from-variation.ga`;
* a [Planemo test file](https://planemo.readthedocs.io/en/latest/test_format.html), with the same name as the workflow file, but with a `-test.yml` extension, e.g., `consensus-from-variation-test.yml`;
* a `test-data` directory with the test data used by Planemo;
* a [Planemo test file](https://planemo.readthedocs.io/en/latest/test_format.html), with the same name as the workflow file, but with a `-tests.yml` extension, e.g., `consensus-from-variation-tests.yml`;
* a `test-data` directory with the test data used by Planemo (optional);
* a [Dockstore](https://dockstore.org) [metadata file](https://docs.dockstore.org/en/develop/getting-started/github-apps/github-apps.html#workflow-yml-file) named `.dockstore.yml`;
* a `README.md` and a `CHANGELOG.md` file.

## Adding workflows

Here are some guidelines to help new contributors to add their workflows.

Everything starts from a workflow that you need to download locally.

Currently the CI is using CVMFS for tools and for references, this is why all tests described below are against usegalaxy.org.
Everything starts from a workflow that you have on a galaxy instance.

### Optional: Updating tools

It is recommended to check and update tools with Planemo before import :
It is recommended to check and update tools with Planemo before import.

```bash
planemo autoupdate <workflow.ga>
```
- You can do it from the galaxy instance using "Workflow Options" "Upgrade Workflow":

![Update galaxy workflow in galaxy](../static/update_workflow.png)

- Or by downloading the ga file and running planemo:

Then, it is recommended to upload this updated workflow to the usegalaxy.org server as some updates may break connections (and some tools may not yet be installed on usegalaxy.org).
```bash
planemo autoupdate <workflow.ga>
```

### Ensure workflows follow best-practices

Start by opening your workflow in the workflow editor, click on "Workflow Options", select "Best Practices" and apply the suggested improvements. In particular, in order to make the workflow usable, **make sure you specify a license**. Another important field is "Creator", which allows to give proper credit to the author(s). The "Identifier" field of a Creator added as a _person_ should be filled with a fully qualified URI, e.g., https://orcid.org/0000-0002-1825-0097.
The best way is to check it into a galaxy instance: click on "Workflow Options", select "Best Practices" and apply the suggested improvements. In particular, in order to make the workflow usable, **make sure you specify a license**. Another important field is "Creator", which allows to give proper credit to the author(s). The "Identifier" field of a Creator added as a _person_ should be filled with a fully qualified URI, e.g., https://orcid.org/0000-0002-1825-0097.
![Add Creator GIF](../static/add-creator.gif)
Expand All @@ -45,16 +48,17 @@ If you add an _organization_ as Creator, you should include a "URL" field pointi
### Generate tests
You can either write test cases by hand, or use a workflow invocation to generate a test case:
This is usually the most difficult part and we encourage all new contributors to IWC to propose their workflows even if they did not managed to generate tests. However, the publication of these workflow will be speed up if tests are already present.
To generate tests, you can either write test cases by hand, or use a workflow invocation to generate a test case (see below).
#### Find input datasets
If your analysis is covered by the GTN, using GTN dataset material is a good start!
If your analysis is covered by the GTN, using GTN dataset material is a good start! If it is not, try to generate a toy dataset for example following [this](https://training.galaxyproject.org/training-material/topics/contributing/tutorials/create-new-tutorial/tutorial.html#get-a-toy-dataset) and then publish it to zenodo to have a permanent URL.
#### Generate test from a workflow invocation
Create a new directory under one of the directories that represent categories. If no category is suitable you can create a new category directory.
Name the directory that contains your workflow(s) appropriately, as it will become the name of the repository deployed to [iwc-workflows github organization](https://github.com/iwc-workflows).
Name the directory that contains your workflow(s) appropriately, as it will become the name of the repository deployed to [iwc-workflows github organization](https://github.com/iwc-workflows). Only use lower-case and `-` in names of categories and repositories.
Execute the workflow on your Galaxy server using the smallest input data you can generate.
Go to the workflow invocations page (User > Workflow Invocations), open the most recent item and find the invocation id:
Expand All @@ -64,26 +68,27 @@ Go to the workflow invocations page (User > Workflow Invocations), open the most
You will also need your Galaxy API key. To copy it, or generate it if you don't have one yet, go to User > Preferences > Manage API Key. Then run:
```
planemo workflow_test_init --from_invocation <your_invocation_id> --galaxy_url https://usegalaxy.org/ --galaxy_user_key <your_api_key>
planemo workflow_test_init --from_invocation <your_invocation_id> --galaxy_url <your_prefered_galaxy_instance_url> --galaxy_user_key <your_api_key>
```
This will place the workflow and workflow test files in your current working directory.
You may still want to remove test files and edit the test comparisons so that tests
will pass reliably. For example, you could consider using assertions to test the
outputs, rather than comparing the entire output file with test data.
Also, if some outputs are large, it is better to use assertions than storing the whole output file to the iwc repository.
#### Manually write test for workflow
Download the workflow and place it in a new directory under one of the directories that represent categories. If no category is suitable you can create a new category directory.
Name the directory that contains your workflow(s) appropriately, as it will become the name of the repository deployed to [iwc-workflows github organization](https://github.com/iwc-workflows).
You can then generate a template planemo test file. Here we generate a test file for the workflow parallel-accession-download.ga.
Name the directory that contains your workflow(s) appropriately, as it will become the name of the repository deployed to [iwc-workflows github organization](https://github.com/iwc-workflows). Only use lower-case and `-` in names of categories and repositories.
You can then generate a template planemo test file with planemo:
```bash
planemo workflow_test_init parallel-accession-download.ga
planemo workflow_test_init <your_workflow_file.ga>
```
This generates the file parallel-accession-download-tests.yml:
If you run it on `parallel-accession-download.ga`, this generates the file parallel-accession-download-tests.yml:
```yaml
- doc: Test outline for parallel-accession-download.ga
Expand All @@ -98,7 +103,7 @@ This generates the file parallel-accession-download-tests.yml:
class: ''
```
We now need to provide inputs and outputs. You can find details about the test format in the [planemo documentation](https://planemo.readthedocs.io/en/latest/test_format.html).
We now need to provide inputs and outputs. You can find details about the test format in the [planemo documentation](https://planemo.readthedocs.io/en/latest/test_format.html). You can also check other test files into this repository to get examples.
For this example workflow the final parallel-accession-download-tests.yml might look like this:
```yaml
Expand Down Expand Up @@ -127,14 +132,20 @@ Applying linter tests... CHECK
.. CHECK: Tests appear structurally correct for parallel-accession-download.ga
```
#### Test your workflow against usegalaxy.org
#### Test your workflow against an instance which have all tools installed.
Before running the CI, it might be interesting to run your tests against usegalaxy.org using planemo:
Before running the CI, it might be interesting to run your tests against a galaxy instance using planemo so you can easily see what is failing and what are the differences between your expectations and the output you get:
```bash
planemo test --galaxy_url https://usegalaxy.org/ --galaxy_user_key <your_api_key> <workflow.ga>
planemo test --galaxy_url <your_prefered_galaxy_server> --galaxy_user_key <your_api_key> <workflow.ga>
```
If your tests are not passing because you made an error into your test file you can modify your test file and use planemo to check that the test is valid against the same invocation.
planemo workflow_test_on_invocation --galaxy_url <your_prefered_galaxy_server --galaxy_user_key <your_api_key> <workflow-tests.yml> <invocation_id>
Note: If your workflow is using build-in indexes, note that the CI will use CVMFS. You can browse the available indexes at http://datacache.galaxyproject.org/.
#### Add required metadata
We now need to generate a `.dockstore.yml` file that contains metadata needed for [Dockstore](https://dockstore.org/organizations/iwc).
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 1.2
workflows:
- name: main
subclass: Galaxy
publish: true
primaryDescriptorPath: /Assembly-Hifi-HiC-phasing-VGP4.ga
testParameterFiles:
- /Assembly-Hifi-HiC-phasing-VGP4-tests.yml
authors:
- name: Galaxy
- name: VGP
url: https://vertebrategenomeproject.org
- name: Delphine Lariviere
orcid: 0000-0001-6421-3484
Loading

0 comments on commit b461f6b

Please sign in to comment.