forked from galaxyproject/iwc
-
Notifications
You must be signed in to change notification settings - Fork 8
222 lines (215 loc) · 7.82 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
name: Weekly global Workflow Linting and Tests
on:
schedule:
# Run at midnight every monday
- cron: '0 0 * * 1'
repository_dispatch:
types: [run-all-workflow-tests-command]
env:
GALAXY_FORK: galaxyproject
GALAXY_BRANCH: release_24.0
MAX_CHUNKS: 40
jobs:
setup:
name: Setup cache and determine changed repositories
if: github.repository_owner == 'galaxyproject'
runs-on: ubuntu-latest
outputs:
galaxy-head-sha: ${{ steps.get-galaxy-sha.outputs.galaxy-head-sha }}
fork: ${{ steps.get-fork-branch.outputs.fork }}
branch: ${{ steps.get-fork-branch.outputs.branch }}
repository-list: ${{ steps.discover.outputs.repository-list }}
chunk-count: ${{ steps.discover.outputs.chunk-count }}
chunk-list: ${{ steps.discover.outputs.chunk-list }}
strategy:
matrix:
python-version: ['3.11']
steps:
- name: Add reaction
if: ${{ github.event.client_payload.slash_command.command == 'run-all-workflow-tests' }}
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
reaction-type: hooray
- name: Set galaxy fork and branch
id: get-fork-branch
run: |
TMP="${{ github.event.client_payload.slash_command.args.named.fork }}"
echo "fork=${TMP:-$GALAXY_FORK}" >> $GITHUB_OUTPUT
TMP="${{ github.event.client_payload.slash_command.args.named.branch }}"
echo "branch=${TMP:-$GALAXY_BRANCH}" >> $GITHUB_OUTPUT
- name: Determine latest commit in the Galaxy repo
id: get-galaxy-sha
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
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache .cache/pip
uses: actions/cache@v4
id: cache-pip
with:
path: ~/.cache/pip
key: pip_cache_py_${{ matrix.python-version }}_gxy_${{ steps.get-galaxy-sha.outputs.galaxy-head-sha }}
# Install the `wheel` package so that when installing other packages which
# are not available as wheels, pip will build a wheel for them, which can be cached.
- name: Install wheel
run: pip install wheel
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Fake a Planemo run to update cache and determine commit range, repositories, and chunks
uses: galaxyproject/planemo-ci-action@v1
id: discover
with:
workflows: true
create-cache: ${{ steps.cache-pip.outputs.cache-hit != 'true' || steps.cache-planemo.outputs.cache-hit != 'true' }}
galaxy-fork: ${{ steps.get-fork-branch.outputs.fork }}
galaxy-branch: ${{ steps.get-fork-branch.outputs.branch }}
max-chunks: ${{ env.MAX_CHUNKS }}
python-version: ${{ matrix.python-version }}
- name: Show repository list
run: echo '${{ steps.discover.outputs.repository-list }}'
- name: Show chunks
run: |
echo 'Using ${{ steps.discover.outputs.chunk-count }} chunks (${{ steps.discover.outputs.chunk-list }})'
# Planemo lint the workflows
lint:
name: Lint workflows
needs: setup
if: needs.setup.outputs.repository-list != ''
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.11']
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache .cache/pip
uses: actions/cache@v4
id: cache-pip
with:
path: ~/.cache/pip
key: pip_cache_py_${{ matrix.python-version }}_gxy_${{ needs.setup.outputs.galaxy-head-sha }}
- name: Install wheel
run: pip install wheel
- name: Planemo lint workflows
uses: galaxyproject/planemo-ci-action@v1
with:
mode: lint
workflows: true
repository-list: "${{ needs.setup.outputs.repository-list }}"
additional-planemo-options: --iwc
test:
name: Test workflows
# This job runs on Linux
runs-on: ubuntu-latest
needs: setup
if: ${{ needs.setup.outputs.repository-list != '' }}
strategy:
fail-fast: false
matrix:
chunk: ${{ fromJson(needs.setup.outputs.chunk-list) }}
python-version: ['3.11']
services:
postgres:
image: postgres:11
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
steps:
# checkout the repository
# and use it as the current working directory
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache .cache/pip
uses: actions/cache@v4
id: cache-pip
with:
path: ~/.cache/pip
key: pip_cache_py_${{ matrix.python-version }}_gxy_${{ needs.setup.outputs.galaxy-head-sha }}
- name: Planemo test workflows
uses: galaxyproject/planemo-ci-action@v1
id: test-workflows
with:
mode: test
workflows: true
setup-cvmfs: true
repository-list: ${{ needs.setup.outputs.repository-list }}
galaxy-fork: ${{ needs.setup.outputs.fork }}
galaxy-branch: ${{ needs.setup.outputs.branch }}
chunk: ${{ matrix.chunk }}
chunk-count: ${{ needs.setup.outputs.chunk-count }}
- uses: actions/upload-artifact@v4
with:
name: 'Workflow test output ${{ matrix.chunk }}'
path: upload
# - combine the results of the test chunks (which will never fail due
# to `|| true`) and create a global test report as json and html which
# is provided as artifact
# - check if any test actually failed (by lookup in the combined json)
# and fail this step if this is the case
combine_outputs:
name: Combine chunked test results
needs: [setup, test]
strategy:
matrix:
python-version: ['3.11']
# This job runs on Linux
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: artifacts
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache .cache/pip
uses: actions/cache@v4
id: cache-pip
with:
path: ~/.cache/pip
key: pip_cache_py_${{ matrix.python-version }}_gxy_${{ needs.setup.outputs.galaxy-head-sha }}
- name: Combine outputs
uses: galaxyproject/planemo-ci-action@v1
id: combine
with:
mode: combine
html-report: true
- uses: actions/upload-artifact@v4
with:
name: 'All workflow test results'
path: upload
- name: Create URL to the run output
if: ${{ github.event.client_payload.slash_command.command == 'run-all-workflow-tests' }}
id: vars
run: echo "run-url=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_OUTPUT
- name: Create comment
if: ${{ github.event.client_payload.slash_command.command == 'run-all-workflow-tests' }}
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
issue-number: ${{ github.event.client_payload.github.payload.issue.number }}
body: |
Summary:
${{ steps.combine.outputs.statistics }}
[Find all workflow test results here][1]
[1]: ${{ steps.vars.outputs.run-url }}
- name: Check outputs
uses: galaxyproject/planemo-ci-action@v1
id: check
with:
mode: check