-
Notifications
You must be signed in to change notification settings - Fork 3.8k
371 lines (325 loc) · 12.9 KB
/
PR.yml
File metadata and controls
371 lines (325 loc) · 12.9 KB
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
name: PR Check
on:
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: build-${{ github.event.pull_request.number || github.head_ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-22.04
strategy:
fail-fast: true
max-parallel: 13
steps:
- uses: actions/checkout@v4
- name: Fetch commits through the merge base
uses: fulcrumgenomics/fetch-through-merge-base@v1
with:
base-ref: ${{ env.GITHUB_BASE_REF }}
head-ref: ${{ github.sha }}
fallback-base-ref: master
fallback-fetch-all: true
- name: set path
run: echo "/opt/mambaforge/bin" >> $GITHUB_PATH
- name: Fetch conda install script
run: |
wget https://raw.githubusercontent.com/bioconda/bioconda-common/master/{install-and-set-up-conda,configure-conda,common}.sh
- name: Restore cache
id: cache
uses: actions/cache@v4
with:
path: /opt/mambaforge
key: ${{ runner.os }}--master--${{ hashFiles('install-and-set-up-conda.sh', 'common.sh', 'configure-conda.sh') }}
- name: Set up bioconda-utils
if: steps.cache.outputs.cache-hit != 'true'
run: bash install-and-set-up-conda.sh
# This script can be used to reconfigure conda to use the right channel setup.
# This has to be done after the cache is restored, because
# the channel setup is not cached as it resides in the home directory.
# We could use a system-wide (and therefore cached) channel setup,
# but mamba does not support that at the time of implementation
# (it ignores settings made with --system).
- name: Configure conda
run: bash configure-conda.sh
- name: Perform lint
env:
# Mimic circleci
OSTYPE: "linux-gnu"
CI: "true"
run: |
set -e
eval "$(conda shell.bash hook)"
conda activate bioconda
source common.sh
echo '============'
conda info --all
conda config --show-sources
python -c 'import bioconda_utils.utils as u ; import pathlib as p ; print(*(f"{f}:\n{p.Path(f).read_text()}" for f in u.load_conda_build_config().exclusive_config_files), sep="\n")'
echo '============'
bioconda-utils lint --loglevel debug --full-report --git-range origin/"$GITHUB_BASE_REF" HEAD
conda clean -y --all
build-linux:
name: Linux Tests
runs-on: ubuntu-22.04
strategy:
fail-fast: true
max-parallel: 13
needs: lint
steps:
- name: Free space
# HACK fixes 'No space left on device'
# see:
# - https://github.com/orgs/community/discussions/25678#discussioncomment-5242449
# - https://github.com/galaxyproteomics/tools-galaxyp/blob/master/.github/workflows/pr.yaml#L293
# NOTE we don't use those, bioconda-utils run everything inside conda environment, anyway
run: |
sudo rm -rf \
/opt/hostedtoolcache \
/opt/google/chrome \
/opt/microsoft/msedge \
/opt/microsoft/powershell \
/opt/pipx \
/usr/local/julia* \
/usr/local/lib/android \
/usr/local/lib/node_modules \
/usr/local/share/chromium \
/usr/local/share/powershell \
/usr/share/dotnet \
/usr/share/swift
- uses: actions/checkout@v4
- name: Fetch commits through the merge base
uses: fulcrumgenomics/fetch-through-merge-base@v1
with:
base-ref: ${{ env.GITHUB_BASE_REF }}
head-ref: ${{ github.sha }}
fallback-base-ref: master
fallback-fetch-all: true
- name: set path
run: echo "/opt/mambaforge/bin" >> $GITHUB_PATH
- name: Fetch conda install script
run: |
wget https://raw.githubusercontent.com/bioconda/bioconda-common/master/{install-and-set-up-conda,configure-conda,common}.sh
- name: Restore cache
id: cache
uses: actions/cache@v4
with:
path: /opt/mambaforge
key: ${{ runner.os }}--master--${{ hashFiles('install-and-set-up-conda.sh', 'common.sh', 'configure-conda.sh') }}
- name: Set up bioconda-utils
if: steps.cache.outputs.cache-hit != 'true'
run: bash install-and-set-up-conda.sh
# This script can be used to reconfigure conda to use the right channel setup.
# This has to be done after the cache is restored, because
# the channel setup is not cached as it resides in the home directory.
# We could use a system-wide (and therefore cached) channel setup,
# but mamba does not support that at the time of implementation
# (it ignores settings made with --system).
- name: Configure conda
run: bash configure-conda.sh
- name: Build and test
env:
# Mimic circleci
OSTYPE: "linux-gnu"
CI: "true"
run: |
set -e
# Clean up lingering build artifacts
for n in linux-64 osx-64 noarch; do
rm -f /opt/mambaforge/envs/bioconda/conda-bld/$n/*.tar.bz2
rm -f /opt/mambaforge/envs/bioconda/conda-bld/$n/*.conda
done
eval "$(conda shell.bash hook)"
conda activate bioconda
source common.sh
bioconda-utils build recipes config.yml \
--docker --mulled-test \
--git-range origin/"$GITHUB_BASE_REF" HEAD
- name: Prepare artifacts
run: |
(
rm -rf /tmp/artifacts
mkdir -p /tmp/artifacts/packages
cd /opt/mambaforge/envs/bioconda/conda-bld || exit 0
find -name .cache | xargs rm -rf || true
for n in index.html channeldata.json linux-64 osx-64 noarch; do
cp -rv $n /tmp/artifacts/packages || true
done
if command -V docker >/dev/null; then
mkdir -p /tmp/artifacts/images
cd /tmp/artifacts/images
docker image ls --format='{{.Repository}}:{{.Tag}}' | \
{ grep biocontainers || true ; } | \
xargs -n1 -P4 bash -c '
test -n "${1+x}" || exit 0
echo "Start compressing docker image ${1} ..."
docker save "${1}" | pigz -1 -c > "${1##*/}.tar.gz"
echo "Finished compressing docker image ${1} ."
' --
# There's no : allowed in artifact names, replace it with ---
for f in /tmp/artifacts/images/*:* ; do mv -- "$f" "${f//:/---}"; done
fi
) || true
- name: Archive packages
uses: actions/upload-artifact@v6
with:
name: linux-packages
path: |
/tmp/artifacts
compression-level: 0
build-osx-64:
name: OSX-64 Tests
runs-on: macos-15-intel
strategy:
fail-fast: true
max-parallel: 4
# Limited concurrency for osx, so first make sure linux can pass
needs: build-linux
steps:
- uses: actions/checkout@v4
- name: Fetch commits through the merge base
uses: fulcrumgenomics/fetch-through-merge-base@v1
continue-on-error: true
with:
base-ref: ${{ env.GITHUB_BASE_REF }}
head-ref: ${{ github.sha }}
fallback-base-ref: master
fallback-fetch-all: true
- name: set path
run: echo "/opt/mambaforge/bin" >> $GITHUB_PATH
- name: Fetch conda install script
run: |
wget https://raw.githubusercontent.com/bioconda/bioconda-common/master/{install-and-set-up-conda,configure-conda,common}.sh
# This is required so actions/cache below will restore properly
# See: https://github.com/actions/cache/issues/629#issuecomment-1189184648
- name: Make gtar SUDO
run: |
echo -e '#!/bin/sh\nexec sudo /usr/local/bin/gtar.orig "$@"\n' > gtar;
cat gtar;
sudo mv -v /usr/local/bin/gtar /usr/local/bin/gtar.orig;
sudo cp -v gtar /usr/local/bin/gtar;
sudo chmod +x /usr/local/bin/gtar;
- name: Restore cache
id: cache
uses: actions/cache@v4
with:
path: /opt/mambaforge
key: ${{ runner.os }}--master--${{ hashFiles('install-and-set-up-conda.sh', 'common.sh', 'configure-conda.sh') }}
- name: Set up bioconda-utils
if: steps.cache.outputs.cache-hit != 'true'
run: bash install-and-set-up-conda.sh
# This script can be used to reconfigure conda to use the right channel setup.
# This has to be done after the cache is restored, because
# the channel setup is not cached as it resides in the home directory.
# We could use a system-wide (and therefore cached) channel setup,
# but mamba does not support that at the time of implementation
# (it ignores settings made with --system).
- name: Configure conda
run: bash configure-conda.sh
- name: Build and Test
env:
# Mimic circleci
OSTYPE: "darwin"
CI: "true"
run: |
set -e
eval "$(conda shell.bash hook)"
conda activate bioconda
source common.sh
# Sets up OSX SDK
run_conda_forge_build_setup
# Clean up lingering build artifacts
for n in linux-64 osx-64 noarch; do
rm -f /opt/mambaforge/envs/bioconda/conda-bld/$n/*.tar.bz2
done
bioconda-utils build recipes config.yml \
--git-range origin/"$GITHUB_BASE_REF" HEAD
- name: Prepare artifacts
run: |
(
rm -rf /tmp/artifacts
mkdir -p /tmp/artifacts/packages
cd /opt/mambaforge/envs/bioconda/conda-bld || exit 0
find . -name .cache | xargs rm -rf || true
for n in index.html channeldata.json linux-64 osx-64 noarch; do
cp -rv $n /tmp/artifacts/packages || true
done
) || true
- name: Archive packages
uses: actions/upload-artifact@v6
with:
name: osx-packages
path: |
/tmp/artifacts
compression-level: 0
# Disabled due to concurrency limits on GHA for OSX. osx-arm64 builds are on CircleCI.
# build_and_test-osx-arm64:
# name: OSX-ARM64 Tests
# runs-on: macOS-14 # M1
# strategy:
# fail-fast: true
# max-parallel: 4
# needs: build-linux
# steps:
# - uses: actions/checkout@v4
# # bail if there's no osx-arm64 recipes
# - name: Check for Additional Platforms
# id: additional_platforms
# run: |
# result=$(./scripts/check-for-additional-platforms.sh "origin/master...HEAD" "build_and_test" "${GITHUB_JOB}")
# if [[ ${result} != "build" ]]
# then
# echo "No recipes using this platform, skipping rest of job."
# echo "skip_build=true" >> $GITHUB_OUTPUT
# fi
# - name: set path
# run: echo "/opt/mambaforge/bin" >> $GITHUB_PATH
# - name: Fetch conda install script
# if: steps.additional_platforms.outputs.skip_build != 'true'
# run: |
# wget https://raw.githubusercontent.com/bioconda/bioconda-common/master/{install-and-set-up-conda,configure-conda,common}.sh
# - name: Set up bioconda-utils
# if: steps.additional_platforms.outputs.skip_build != 'true'
# run: bash install-and-set-up-conda.sh
# - name: Configure conda
# if: steps.additional_platforms.outputs.skip_build != 'true'
# run: bash configure-conda.sh
# - name: Build and Test
# if: steps.additional_platforms.outputs.skip_build != 'true'
# env:
# # Mimic circleci
# OSTYPE: "darwin"
# CI: "true"
# run: |
# set -xe
# eval "$(conda shell.bash hook)"
# conda activate bioconda
# source common.sh
# # Sets up OSX SDK
# run_conda_forge_build_setup
# if [ -z "$GITHUB_BASE_REF" ] ; then
# export GITHUB_BASE_REF="master"
# fi
# git fetch origin "$GITHUB_BASE_REF"
# bioconda-utils build recipes config.yml \
# --lint --git-range origin/"$GITHUB_BASE_REF" HEAD
# - name: Prepare artifacts
# if: steps.additional_platforms.outputs.skip_build != 'true'
# run: |
# (
# rm -rf /tmp/artifacts
# mkdir -p /tmp/artifacts/packages
# cd /opt/mambaforge/envs/bioconda/conda-bld || exit 0
# find -name .cache | xargs rm -rf || true
# for n in index.html channeldata.json osx-arm64 noarch; do
# cp -rv $n /tmp/artifacts/packages || true
# done
# ) || true
# - name: Archive packages
# if: steps.additional_platforms.outputs.skip_build != 'true'
# uses: actions/upload-artifact@v6
# with:
# name: osx-arm64-packages
# path: |
# /tmp/artifacts