|
| 1 | +name: Weekly global Tool Linting and Tests |
| 2 | +on: |
| 3 | + schedule: |
| 4 | + # Run at midnight every monday |
| 5 | + - cron: '0 0 * * 1' |
| 6 | + repository_dispatch: |
| 7 | + types: [run-all-tool-tests-command] |
| 8 | +env: |
| 9 | + GALAXY_RELEASE: release_20.09 |
| 10 | +jobs: |
| 11 | + setup: |
| 12 | + name: Setup cache |
| 13 | + if: github.repository_owner == 'computational-metabolomics' |
| 14 | + runs-on: ubuntu-latest |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + python-version: [3.7] |
| 18 | + steps: |
| 19 | + - name: Add reaction |
| 20 | + if: ${{ github.event.client_payload.slash_command.command == 'run-all-tool-tests' }} |
| 21 | + uses: peter-evans/create-or-update-comment@v1 |
| 22 | + with: |
| 23 | + token: ${{ secrets.PAT }} |
| 24 | + repository: ${{ github.event.client_payload.github.payload.repository.full_name }} |
| 25 | + comment-id: ${{ github.event.client_payload.github.payload.comment.id }} |
| 26 | + reaction-type: hooray |
| 27 | + - uses: actions/setup-python@v1 |
| 28 | + with: |
| 29 | + python-version: ${{ matrix.python-version }} |
| 30 | + - name: Cache .cache/pip |
| 31 | + uses: actions/cache@v2 |
| 32 | + id: cache-pip |
| 33 | + with: |
| 34 | + path: ~/.cache/pip |
| 35 | + key: pip_cache_${{ matrix.python-version }}_${{ env.GALAXY_RELEASE }} |
| 36 | + # Install the `wheel` package so that when installing other packages which |
| 37 | + # are not available as wheels, pip will build a wheel for them, which can be cached. |
| 38 | + - name: Install wheel |
| 39 | + run: pip install wheel |
| 40 | + - name: Install Planemo |
| 41 | + run: pip install planemo |
| 42 | + - name: Fake a planemo run to update cache |
| 43 | + run: | |
| 44 | + touch tool.xml |
| 45 | + PIP_QUIET=1 planemo test --galaxy_python_version ${{ matrix.python-version }} --no_conda_auto_init --galaxy_branch $GALAXY_RELEASE |
| 46 | + test: |
| 47 | + name: Test tools |
| 48 | + # This job runs on Linux |
| 49 | + runs-on: ubuntu-latest |
| 50 | + needs: setup |
| 51 | + strategy: |
| 52 | + fail-fast: false |
| 53 | + matrix: |
| 54 | + chunk: [0,1,2,3] |
| 55 | + python-version: [3.7] |
| 56 | + services: |
| 57 | + postgres: |
| 58 | + image: postgres:11 |
| 59 | + env: |
| 60 | + POSTGRES_USER: postgres |
| 61 | + POSTGRES_PASSWORD: postgres |
| 62 | + POSTGRES_DB: postgres |
| 63 | + ports: |
| 64 | + - 5432:5432 |
| 65 | + steps: |
| 66 | + # checkout the repository |
| 67 | + # and use it as the current working directory |
| 68 | + - uses: actions/checkout@v2 |
| 69 | + with: |
| 70 | + fetch-depth: 1 |
| 71 | + - uses: actions/setup-python@v1 |
| 72 | + with: |
| 73 | + python-version: ${{ matrix.python-version }} |
| 74 | + - name: Cache .cache/pip |
| 75 | + uses: actions/cache@v2 |
| 76 | + id: cache-pip |
| 77 | + with: |
| 78 | + path: ~/.cache/pip |
| 79 | + key: pip_cache_${{ matrix.python-version }}_${{ env.GALAXY_RELEASE }} |
| 80 | + - name: Install Planemo |
| 81 | + run: pip install planemo |
| 82 | + - name: Planemo ci_find_tools |
| 83 | + run: planemo ci_find_tools --chunk_count 4 --chunk ${{ matrix.chunk }} --exclude test_repositories --exclude packages --exclude deprecated --exclude_from .tt_skip --exclude_from .tt_biocontainer_skip --group_tools --output tool.list |
| 84 | + - name: Show repo list |
| 85 | + run: cat tool.list |
| 86 | + - name: Planemo test tools |
| 87 | + run: | |
| 88 | + mkdir json_output/ |
| 89 | + while read -r TOOLS; do |
| 90 | + if grep -qf .tt_biocontainer_skip <(echo $TOOLS); then |
| 91 | + PLANEMO_OPTIONS="" |
| 92 | + else |
| 93 | + PLANEMO_OPTIONS="--biocontainers --no_dependency_resolution --no_conda_auto_init" |
| 94 | + fi |
| 95 | + json=$(mktemp -u -p json_output --suff .json) |
| 96 | + PIP_QUIET=1 planemo test --database_connection postgresql://postgres:postgres@localhost:5432/galaxy $PLANEMO_OPTIONS --galaxy_branch $GALAXY_RELEASE --galaxy_python_version ${{ matrix.python-version }} --test_output_json $json $TOOLS || true |
| 97 | + docker system prune --all --force --volumes || true |
| 98 | + done < tool.list |
| 99 | + - name: Merge tool_test_output.json files |
| 100 | + run: planemo merge_test_reports json_output/*.json tool_test_output.json |
| 101 | + - name: Create tool_test_output.html |
| 102 | + run: planemo test_reports tool_test_output.json --test_output tool_test_output.html |
| 103 | + - name: Copy artifacts into place |
| 104 | + run: | |
| 105 | + mkdir upload |
| 106 | + mv tool_test_output.json tool_test_output.html upload/ |
| 107 | + |
| 108 | + with: |
| 109 | + name: 'Tool test output ${{ matrix.chunk }}' |
| 110 | + path: upload |
| 111 | + |
| 112 | + combine_outputs: |
| 113 | + name: Combine chunked test results |
| 114 | + needs: test |
| 115 | + strategy: |
| 116 | + matrix: |
| 117 | + python-version: [3.7] |
| 118 | + # This job runs on Linux |
| 119 | + runs-on: ubuntu-latest |
| 120 | + steps: |
| 121 | + - uses: actions/download-artifact@v2 |
| 122 | + with: |
| 123 | + path: artifacts |
| 124 | + - uses: actions/setup-python@v1 |
| 125 | + with: |
| 126 | + python-version: ${{ matrix.python-version }} |
| 127 | + - name: Install Planemo |
| 128 | + run: pip install planemo |
| 129 | + - name: Install jq |
| 130 | + run: sudo apt-get install jq |
| 131 | + - name: Combine outputs |
| 132 | + run: find artifacts -name tool_test_output.json -exec sh -c 'planemo merge_test_reports "$@" tool_test_output.json' sh {} + |
| 133 | + - name: Create tool_test_output.html |
| 134 | + run: planemo test_reports tool_test_output.json --test_output tool_test_output.html |
| 135 | + - name: Copy artifacts into place |
| 136 | + run: | |
| 137 | + mkdir upload |
| 138 | + mv tool_test_output.json tool_test_output.html upload/ |
| 139 | + |
| 140 | + with: |
| 141 | + name: 'All tool test results' |
| 142 | + path: upload |
| 143 | + |
| 144 | + - name: Create URL to the run output |
| 145 | + if: ${{ github.event.client_payload.slash_command.command == 'run-all-tool-tests' }} |
| 146 | + id: vars |
| 147 | + run: echo ::set-output name=run-url::https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID |
| 148 | + |
| 149 | + - name: Create comment |
| 150 | + if: ${{ github.event.client_payload.slash_command.command == 'run-all-tool-tests' }} |
| 151 | + uses: peter-evans/create-or-update-comment@v1 |
| 152 | + with: |
| 153 | + token: ${{ secrets.PAT }} |
| 154 | + repository: ${{ github.event.client_payload.github.payload.repository.full_name }} |
| 155 | + issue-number: ${{ github.event.client_payload.github.payload.issue.number }} |
| 156 | + body: | |
| 157 | + [Find all tool test results here][1] |
| 158 | +
|
| 159 | + [1]: ${{ steps.vars.outputs.run-url }} |
| 160 | + - name: Check status of combined outputs |
| 161 | + run: | |
| 162 | + if jq '.["tests"][]["data"]["status"]' upload/tool_test_output.json | grep -v "success"; then |
| 163 | + echo "Unsuccessful tests found, inspect the 'All tool test results' artifact for details." |
| 164 | + exit 1 |
| 165 | + fi |
0 commit comments