Repository navigation
318 lines (302 loc) · 15.2 KB
/
Copy pathtests.yml
File metadata and controls
318 lines (302 loc) · 15.2 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
name: "Reusable Tests Workflow"
on:
workflow_call:
inputs:
julia-version:
description: "Julia version"
default: "1"
required: false
type: string
julia-arch:
description: "Architecture of Julia to be used"
required: false
type: string
project:
description: "The value is passed to Julia's `--project` flag"
default: '@.'
required: false
type: string
group:
description: "The 'GROUP' of tests that need to be run. This will requires an ENV `GROUP` to be (conditionally) defined within your package tests as well to selectively run groups of tests"
default: ""
required: false
type: string
num-threads:
description: "Value of JULIA_NUM_THREADS for the test run. Default 'auto' matches the runner's vCPU count (e.g. 4 on GitHub-hosted). On self-hosted runners 'auto' is overridden to 2 (those runners are large and shared, so matching the full core count would oversubscribe); pass an explicit integer to control it on self-hosted."
default: "auto"
required: false
type: string
linux-x86-pocl-workers:
description: "Maximum PoCL CPU workers for 32-bit Linux Julia. Zero uses the existing configuration."
default: 0
required: false
type: number
self-hosted:
description: "Run the job needs on a self hosted machine"
default: false
required: false
type: boolean
os:
description: "The machine configuration on which the job needs to be run"
default: "ubuntu-latest"
required: false
type: string
cache:
description: "Use the julia-actions/cache action for caching"
default: false
required: false
type: boolean
buildpkg:
description: "Use the julia-actions/buildpkg action to build the package first"
default: true
required: false
type: boolean
coverage:
description: "Collect and generate code coverage-related information"
default: true
required: false
type: boolean
coverage-directories:
description: "Comma-separated list of directories where the julia-processcoverage action will look for coverage information (e.g. `src,examples`)"
default: "src,ext"
required: false
type: string
julia-runtest-depwarn:
description: "Value of the --depwarn flag while running Julia"
default: "yes"
required: false
type: string
continue-on-error:
description: "Prevent the workflow run from failing if/when the job fails"
required: false
type: boolean
runner:
description: "JSON-encoded runs-on value (string or array of labels, e.g. '[\"self-hosted\",\"Linux\",\"X64\",\"gpu\"]'). When non-empty it overrides self-hosted/os."
default: ""
required: false
type: string
timeout-minutes:
description: "Job timeout in minutes"
default: 360
required: false
type: number
check-bounds:
description: "Value of julia-runtest's check_bounds (yes/no/auto)"
default: "yes"
required: false
type: string
allow-reresolve:
description: "Value of julia-runtest's allow_reresolve"
default: true
required: false
type: boolean
group-env-name:
description: "Name of the environment variable to set to `group` for the test run (e.g. GROUP or ODEDIFFEQ_TEST_GROUP)"
default: "GROUP"
required: false
type: string
apt-packages:
description: "Space-separated apt packages to install before building/testing (for packages with system dependencies, e.g. R / Python / FEniCS wrappers). Linux runners only."
default: ""
required: false
type: string
container:
description: "Docker container image to run the job in, e.g. for Python-stack packages (empty string = no container)"
default: ""
required: false
type: string
force-latest-compatible-version:
description: "Value of julia-runtest's force_latest_compatible_version"
default: false
required: false
type: boolean
auto-precompile:
description: "Value of JULIA_PKG_PRECOMPILE_AUTO for the whole job (true -> 1, false -> 0). Set false for packages whose dependency tree OOMs the runner during Pkg's eager parallel precompilation."
default: true
required: false
type: boolean
dotgithub-ref:
description: "Ref of SciML/.github to source the develop-sources helper script from"
default: "v1"
required: false
type: string
jobs:
tests:
name: "Tests${{ inputs.group != '' && format(' - {0}', inputs.group) || '' }} (Julia ${{ inputs.julia-version }})"
continue-on-error: ${{ inputs.continue-on-error || inputs.julia-version == 'nightly' }}
# Legs that provision system deps need passwordless sudo / docker, which the
# SciML self-hosted demeter*/arctic* pool lacks. Those runners squat only the
# `ubuntu-latest` label (not `ubuntu-24.04`), so when apt-packages or a
# container is requested, pin `ubuntu-24.04` to force a GitHub-hosted runner;
# otherwise keep the existing default (matrix `runner` / self-hosted / os),
# which stays self-hosted-capable for throughput. fromJSON('["ubuntu-24.04"]')
# returns a non-empty (truthy) array, so the ternary doesn't fall through.
runs-on: ${{ (inputs.apt-packages != '' || inputs.container != '') && fromJSON('["ubuntu-24.04"]') || (inputs.runner != '' && fromJson(inputs.runner) || (inputs.self-hosted && 'self-hosted' || inputs.os)) }}
container: ${{ inputs.container }}
timeout-minutes: ${{ inputs.timeout-minutes }}
env:
# Job-level so it covers buildpkg (instantiate/build) as well as the test
# run. A caller cannot set this at its own call site: a job that uses a
# reusable workflow may not carry an `env:` map, so it has to be an input.
JULIA_PKG_PRECOMPILE_AUTO: "${{ inputs.auto-precompile && '1' || '0' }}"
steps:
- uses: actions/checkout@v7
- name: "Configure PoCL workers for 32-bit Linux"
if: >-
${{ inputs.linux-x86-pocl-workers != 0 && runner.os == 'Linux' &&
contains(fromJSON('["x86", "i686"]'), inputs.julia-arch || runner.arch) }}
shell: bash
env:
POCL_WORKERS: ${{ inputs.linux-x86-pocl-workers }}
run: |
if [[ ! $POCL_WORKERS =~ ^[1-9][0-9]{0,9}$ ]] || (( POCL_WORKERS > 2147483647 )); then
echo "::error::linux-x86-pocl-workers must be a positive 32-bit integer or zero to opt out."
exit 1
fi
for setting in POCL_CPU_MAX_CU_COUNT POCL_MAX_PTHREAD_COUNT POCL_MAX_COMPUTE_UNITS JULIA_KA_CPU_THREADS; do
if printenv "$setting" >/dev/null; then
exit 0
fi
done
printf 'POCL_CPU_MAX_CU_COUNT=%s\n' "$POCL_WORKERS" >> "$GITHUB_ENV"
- name: "Install 32-bit runtime libraries (i386)"
# A 32-bit (i686) Julia cannot exec on the 64-bit Linux runners without
# the i386 dynamic loader and C/C++ runtime. setup-julia invokes julia
# during its own step, so these must be installed BEFORE it — otherwise
# the run fails with `spawn .../x86/bin/julia ENOENT` (missing loader).
# Skip inside job containers: many images lack passwordless sudo (e.g.
# FEniCS), and multiarch packages must be baked into the image instead.
if: "${{ (inputs.julia-arch == 'x86' || inputs.julia-arch == 'i686') && runner.os == 'Linux' && inputs.container == '' }}"
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libc6:i386 libstdc++6:i386 libgcc-s1:i386 libatomic1:i386
- name: "Setup Julia ${{ inputs.julia-version }}"
uses: julia-actions/setup-julia@v3
with:
version: "${{ inputs.julia-version }}"
arch: "${{ inputs.julia-arch || runner.arch }}"
- name: "Gate the pre lane to release candidates only"
# The `pre` channel installs the latest Julia prerelease. Early alphas/
# betas -- and the case where `pre` just resolves to the current stable
# release (no prerelease newer than it) -- are not worth blocking CI on;
# only a release candidate is close enough to a release to matter. So when
# `pre` is not an `-rc*`, skip build+test and report the lane as passing;
# RC prereleases run normally. Only affects the `pre` lane; every other
# julia-version runs unconditionally.
id: prerelease-gate
if: "${{ inputs.julia-version == 'pre' }}"
shell: bash
run: |
version=$(julia -e 'print(string(VERSION))')
tag=$(julia -e 'print(isempty(VERSION.prerelease) ? "" : String(VERSION.prerelease[1]))')
if [[ "$tag" == rc* ]]; then
echo "run=true" >> "$GITHUB_OUTPUT"
echo "::notice title=pre lane::Julia $version is a release candidate; running the pre lane normally."
else
echo "run=false" >> "$GITHUB_OUTPUT"
echo "::notice title=pre lane skipped::Julia $version is not a release candidate (prerelease='${tag:-none}'); skipping build+test and reporting the pre lane as passing."
fi
- uses: julia-actions/cache@v3
# Skip caching on self-hosted runners: demeter has a persistent, already
# warm depot (20-29GB), so the cache always MISSES and the post-job save
# tar-uploads 20-29GB at ~7MB/s (+30-62 min/job). Only useful on
# GitHub-hosted/ephemeral runners. `inputs.runner` is also populated for
# ordinary grouped-test legs, so it cannot identify the allocated runner.
if: "${{ inputs.cache && runner.environment == 'github-hosted' }}"
with:
token: "${{ secrets.GITHUB_TOKEN }}"
- name: "Checkout SciML/.github for the develop-sources helper"
if: "${{ inputs.buildpkg && inputs.project != '@.' && steps.prerelease-gate.outputs.run != 'false' }}"
uses: actions/checkout@v7
with:
repository: SciML/.github
ref: "${{ inputs.dotgithub-ref }}"
path: .sciml-dotgithub
- name: "Develop in-repo [sources] path deps of ${{ inputs.project }}"
# On Julia < 1.11 the [sources] section is not auto-resolved during
# build/test, so develop the in-repo path deps the sub-project declares
# -- transitively, but skipping a developed dependency's *test-only*
# [sources] so they don't become phantom direct deps
# (SciML/Optimization.jl#1228). No-op on >= 1.11. This covers both a
# lib/* sublibrary (project: lib/<name>) AND a monorepo *root* project
# (project: '.') whose [sources] pin in-repo siblings (e.g.
# OptimalUncertaintyQuantification's root deps on its lib/* packages):
# without developing them, `julia-buildpkg` on the LTS fails with
# "expected package <Sibling> ... to be registered". Only the default
# environment sentinel '@.' (an ordinary single package with no in-repo
# [sources]) is exempt. See scripts/develop_sources.jl for the rationale.
if: "${{ inputs.buildpkg && inputs.project != '@.' && steps.prerelease-gate.outputs.run != 'false' }}"
shell: julia --color=yes {0}
run: |
# `shell: julia {0}` writes this body to a temp file under RUNNER_TEMP and
# runs it from there, so a *relative* `include` resolves against RUNNER_TEMP,
# not the workspace where `.sciml-dotgithub` was checked out. Anchor at
# GITHUB_WORKSPACE so it resolves regardless of the script's location.
include(joinpath(ENV["GITHUB_WORKSPACE"], ".sciml-dotgithub", "scripts", "develop_sources.jl"))
develop_sources(raw"${{ inputs.project }}")
- name: "Install system packages"
if: "${{ inputs.apt-packages != '' && runner.os == 'Linux' && steps.prerelease-gate.outputs.run != 'false' }}"
run: |
sudo apt-get update
sudo apt-get install -y ${{ inputs.apt-packages }}
- uses: julia-actions/julia-buildpkg@v1
if: "${{ inputs.buildpkg && steps.prerelease-gate.outputs.run != 'false' }}"
with:
project: "${{ inputs.project }}"
- name: "Set test group env (${{ inputs.group-env-name }})"
# Set the group under a configurable env var name so sublibraries that
# read e.g. ODEDIFFEQ_TEST_GROUP work the same as the default GROUP. The
# name must be dynamic, which the env: map can't express, so write it to
# $GITHUB_ENV here.
if: "${{ steps.prerelease-gate.outputs.run != 'false' }}"
run: echo "${{ inputs.group-env-name }}=${{ inputs.group }}" >> "$GITHUB_ENV"
- name: "Run tests ${{ inputs.self-hosted && '' || format('on {0}', inputs.os) }} with Julia v${{ inputs.julia-version }}"
if: "${{ steps.prerelease-gate.outputs.run != 'false' }}"
uses: julia-actions/julia-runtest@v1
with:
project: "${{ inputs.project }}"
depwarn: "${{ inputs.julia-runtest-depwarn }}"
coverage: "${{ inputs.coverage }}"
check_bounds: "${{ inputs.check-bounds }}"
allow_reresolve: ${{ inputs.allow-reresolve }}
force_latest_compatible_version: ${{ inputs.force-latest-compatible-version }}
env:
# Match the runner's vCPUs (auto) on hosted runners; but on large,
# shared self-hosted runners fall back to 2 when left at 'auto' to
# avoid oversubscribing (an explicit integer is always honored).
JULIA_NUM_THREADS: "${{ (inputs.self-hosted && inputs.num-threads == 'auto') && '2' || inputs.num-threads }}"
- name: "Filter coverage directories to those that exist"
# julia-processcoverage hard-errors on directories that don't exist
# (e.g. lib/<name>/ext for sublibraries without extensions), so drop
# the missing entries here and skip coverage entirely if none remain.
id: coverage-dirs
if: "${{ inputs.coverage }}"
shell: bash
env:
COVERAGE_DIRECTORIES: "${{ inputs.coverage-directories }}"
run: |
existing=""
IFS=',' read -ra requested <<< "$COVERAGE_DIRECTORIES"
for dir in "${requested[@]}"; do
if [ -d "$dir" ]; then
existing="${existing:+$existing,}$dir"
else
echo "Skipping missing coverage directory: $dir"
fi
done
echo "directories=$existing" >> "$GITHUB_OUTPUT"
- uses: julia-actions/julia-processcoverage@v1
if: "${{ inputs.coverage && steps.coverage-dirs.outputs.directories != '' }}"
with:
directories: "${{ steps.coverage-dirs.outputs.directories }}"
- name: "Report Coverage with Codecov"
uses: codecov/codecov-action@v7
if: "${{ inputs.coverage && steps.coverage-dirs.outputs.directories != '' }}"
continue-on-error: true
with:
files: lcov.info
token: "${{ secrets.CODECOV_TOKEN }}"
disable_safe_directory: true
fail_ci_if_error: false