|
| 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_FORK: galaxyproject |
| 10 | + GALAXY_BRANCH: release_22.05 |
| 11 | + MAX_CHUNKS: 40 |
| 12 | +jobs: |
| 13 | + setup: |
| 14 | + name: Setup cache and determine changed repositories |
| 15 | + if: ${{ github.repository_owner == 'peterjc' }} |
| 16 | + runs-on: ubuntu-latest |
| 17 | + outputs: |
| 18 | + galaxy-head-sha: ${{ steps.get-galaxy-sha.outputs.galaxy-head-sha }} |
| 19 | + fork: ${{ steps.get-fork-branch.outputs.fork }} |
| 20 | + branch: ${{ steps.get-fork-branch.outputs.branch }} |
| 21 | + repository-list: ${{ steps.discover.outputs.repository-list }} |
| 22 | + chunk-count: ${{ steps.discover.outputs.chunk-count }} |
| 23 | + chunk-list: ${{ steps.discover.outputs.chunk-list }} |
| 24 | + strategy: |
| 25 | + matrix: |
| 26 | + python-version: ['3.7'] |
| 27 | + steps: |
| 28 | + - name: Add reaction |
| 29 | + if: ${{ github.event.client_payload.slash_command.command == 'run-all-tool-tests' }} |
| 30 | + uses: peter-evans/create-or-update-comment@v2 |
| 31 | + with: |
| 32 | + token: ${{ secrets.PAT }} |
| 33 | + repository: ${{ github.event.client_payload.github.payload.repository.full_name }} |
| 34 | + comment-id: ${{ github.event.client_payload.github.payload.comment.id }} |
| 35 | + reaction-type: hooray |
| 36 | + - name: Set galaxy fork and branch |
| 37 | + id: get-fork-branch |
| 38 | + run: | |
| 39 | + TMP="${{ github.event.client_payload.slash_command.args.named.fork }}" |
| 40 | + echo "fork=${TMP:-$GALAXY_FORK}" >> $GITHUB_OUTPUT |
| 41 | + TMP="${{ github.event.client_payload.slash_command.args.named.branch }}" |
| 42 | + echo "branch=${TMP:-$GALAXY_BRANCH}" >> $GITHUB_OUTPUT |
| 43 | + - name: Determine latest commit in the Galaxy repo |
| 44 | + id: get-galaxy-sha |
| 45 | + run: echo "galaxy-head-sha=$(git ls-remote https://github.com/${{ steps.get-fork-branch.outputs.fork }}/galaxy refs/heads/${{ steps.get-fork-branch.outputs.branch }} | cut -f1)" >> $GITHUB_OUTPUT |
| 46 | + - uses: actions/setup-python@v4 |
| 47 | + with: |
| 48 | + python-version: ${{ matrix.python-version }} |
| 49 | + - name: Cache .cache/pip |
| 50 | + uses: actions/cache@v3 |
| 51 | + id: cache-pip |
| 52 | + with: |
| 53 | + path: ~/.cache/pip |
| 54 | + key: pip_cache_py_${{ matrix.python-version }}_gxy_${{ steps.get-galaxy-sha.outputs.galaxy-head-sha }} |
| 55 | + # Install the `wheel` package so that when installing other packages which |
| 56 | + # are not available as wheels, pip will build a wheel for them, which can be cached. |
| 57 | + - name: Install wheel |
| 58 | + run: pip install wheel |
| 59 | + - uses: actions/checkout@v3 |
| 60 | + with: |
| 61 | + fetch-depth: 1 |
| 62 | + - name: Fake a Planemo run to update cache and determine commit range, repositories, and chunks |
| 63 | + uses: galaxyproject/planemo-ci-action@v1 |
| 64 | + id: discover |
| 65 | + with: |
| 66 | + create-cache: ${{ steps.cache-pip.outputs.cache-hit != 'true' || steps.cache-planemo.outputs.cache-hit != 'true' }} |
| 67 | + galaxy-fork: ${{ steps.get-fork-branch.outputs.fork }} |
| 68 | + galaxy-branch: ${{ steps.get-fork-branch.outputs.branch }} |
| 69 | + max-chunks: ${{ env.MAX_CHUNKS }} |
| 70 | + python-version: ${{ matrix.python-version }} |
| 71 | + - name: Show repository list |
| 72 | + run: echo '${{ steps.discover.outputs.repository-list }}' |
| 73 | + - name: Show chunks |
| 74 | + run: | |
| 75 | + echo 'Using ${{ steps.discover.outputs.chunk-count }} chunks (${{ steps.discover.outputs.chunk-list }})' |
| 76 | +
|
| 77 | + test: |
| 78 | + name: Test tools |
| 79 | + # This job runs on Linux |
| 80 | + runs-on: ubuntu-latest |
| 81 | + needs: setup |
| 82 | + if: ${{ needs.setup.outputs.repository-list != '' }} |
| 83 | + strategy: |
| 84 | + fail-fast: false |
| 85 | + matrix: |
| 86 | + chunk: ${{ fromJson(needs.setup.outputs.chunk-list) }} |
| 87 | + python-version: ['3.7'] |
| 88 | + services: |
| 89 | + postgres: |
| 90 | + image: postgres:11 |
| 91 | + env: |
| 92 | + POSTGRES_USER: postgres |
| 93 | + POSTGRES_PASSWORD: postgres |
| 94 | + POSTGRES_DB: postgres |
| 95 | + ports: |
| 96 | + - 5432:5432 |
| 97 | + steps: |
| 98 | + # checkout the repository |
| 99 | + # and use it as the current working directory |
| 100 | + - uses: actions/checkout@v3 |
| 101 | + with: |
| 102 | + fetch-depth: 1 |
| 103 | + - uses: actions/setup-python@v4 |
| 104 | + with: |
| 105 | + python-version: ${{ matrix.python-version }} |
| 106 | + - name: Cache .cache/pip |
| 107 | + uses: actions/cache@v3 |
| 108 | + id: cache-pip |
| 109 | + with: |
| 110 | + path: ~/.cache/pip |
| 111 | + key: pip_cache_py_${{ matrix.python-version }}_gxy_${{ needs.setup.outputs.galaxy-head-sha }} |
| 112 | + - name: Get number of CPU cores |
| 113 | + uses: SimenB/github-actions-cpu-cores@v1 |
| 114 | + id: cpu-cores |
| 115 | + - name: Clean dotnet folder for space |
| 116 | + run: rm -Rf /usr/share/dotnet |
| 117 | + - name: Planemo test |
| 118 | + uses: galaxyproject/planemo-ci-action@v1 |
| 119 | + id: test |
| 120 | + with: |
| 121 | + mode: test |
| 122 | + repository-list: ${{ needs.setup.outputs.repository-list }} |
| 123 | + galaxy-fork: ${{ needs.setup.outputs.fork }} |
| 124 | + galaxy-branch: ${{ needs.setup.outputs.branch }} |
| 125 | + chunk: ${{ matrix.chunk }} |
| 126 | + chunk-count: ${{ needs.setup.outputs.chunk-count }} |
| 127 | + galaxy-slots: ${{ steps.cpu-cores.outputs.count }} |
| 128 | + # Limit each test to 15 minutes |
| 129 | + test_timeout: 900 |
| 130 | + - uses: actions/upload-artifact@v3 |
| 131 | + with: |
| 132 | + name: 'Tool test output ${{ matrix.chunk }}' |
| 133 | + path: upload |
| 134 | + |
| 135 | + # - combine the results of the test chunks (which will never fail due |
| 136 | + # to `|| true`) and create a global test report as json and html which |
| 137 | + # is provided as artifact |
| 138 | + # - check if any tool test actually failed (by lookup in the combined json) |
| 139 | + # and fail this step if this is the case |
| 140 | + combine_outputs: |
| 141 | + name: Combine chunked test results |
| 142 | + needs: [setup, test] |
| 143 | + strategy: |
| 144 | + matrix: |
| 145 | + python-version: ['3.7'] |
| 146 | + # This job runs on Linux |
| 147 | + runs-on: ubuntu-latest |
| 148 | + steps: |
| 149 | + - uses: actions/download-artifact@v3 |
| 150 | + with: |
| 151 | + path: artifacts |
| 152 | + - uses: actions/setup-python@v4 |
| 153 | + with: |
| 154 | + python-version: ${{ matrix.python-version }} |
| 155 | + - name: Cache .cache/pip |
| 156 | + uses: actions/cache@v3 |
| 157 | + id: cache-pip |
| 158 | + with: |
| 159 | + path: ~/.cache/pip |
| 160 | + key: pip_cache_py_${{ matrix.python-version }}_gxy_${{ needs.setup.outputs.galaxy-head-sha }} |
| 161 | + - name: Combine outputs |
| 162 | + uses: galaxyproject/planemo-ci-action@v1 |
| 163 | + id: combine |
| 164 | + with: |
| 165 | + mode: combine |
| 166 | + html-report: true |
| 167 | + - uses: actions/upload-artifact@v3 |
| 168 | + with: |
| 169 | + name: 'All tool test results' |
| 170 | + path: upload |
| 171 | + - name: Create URL to the run output |
| 172 | + if: ${{ github.event.client_payload.slash_command.command == 'run-all-tool-tests' }} |
| 173 | + id: vars |
| 174 | + run: echo "run-url=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_OUTPUT |
| 175 | + |
| 176 | + - name: Create comment |
| 177 | + if: ${{ github.event.client_payload.slash_command.command == 'run-all-tool-tests' }} |
| 178 | + uses: peter-evans/create-or-update-comment@v2 |
| 179 | + with: |
| 180 | + token: ${{ secrets.PAT }} |
| 181 | + repository: ${{ github.event.client_payload.github.payload.repository.full_name }} |
| 182 | + issue-number: ${{ github.event.client_payload.github.payload.issue.number }} |
| 183 | + body: | |
| 184 | + Summary: |
| 185 | +
|
| 186 | + ${{ steps.combine.outputs.statistics }} |
| 187 | +
|
| 188 | + [Find all tool test results here][1] |
| 189 | +
|
| 190 | + [1]: ${{ steps.vars.outputs.run-url }} |
| 191 | + - name: Check outputs |
| 192 | + uses: galaxyproject/planemo-ci-action@v1 |
| 193 | + id: check |
| 194 | + with: |
| 195 | + mode: check |
0 commit comments