Skip to content

Commit f34cd1e

Browse files
Merge current master into the Windows workflow fix
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Codex <noreply@openai.com> Agent-Harness: Codex desktop 0.171.0-alpha.13.2 Agent-Model: unknown (GPT-6 family) Agent-Session: local session 01a22257-20a4-7960-91bd-006b2ea596b6 (no session URL)
2 parents d3e0edc + 4ececcd commit f34cd1e

7 files changed

Lines changed: 100 additions & 10 deletions

File tree

‎.github/workflows/dependabot-automerge.yml‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,16 @@ name: "Reusable Dependabot Auto-merge Workflow"
66
#
77
# Why not a bare `gh pr merge --auto`: native auto-merge only waits on the
88
# checks that branch protection marks *required*, and merges immediately if
9-
# none are required (or if the required set is stale / mis-named). That lets a
9+
# none are required (or if the required set is stale / misnamed). That lets a
1010
# red or still-running PR fast-track when a repo's required-status-checks config
1111
# is missing or out of date. This workflow instead gates on ALL checks that
1212
# actually ran on the head commit, so the gate holds regardless of branch
1313
# protection config. If any check fails, no checks are present, or the wait
1414
# times out, the PR is left for a human with an explanatory comment (the job
1515
# still succeeds — holding is a valid outcome).
1616
#
17-
# The caller triggers on pull_request and must grant contents + pull-requests
18-
# write. `checks: read` + `statuses: read` are used to inspect CI; reads work
19-
# without an explicit grant on public repos, but private repos should also
20-
# grant those two scopes on the caller job.
17+
# The pull_request caller must grant contents and pull-requests write access
18+
# plus checks and statuses read access in both public and private repositories.
2119

2220
on:
2321
workflow_call:

‎.github/workflows/grouped-tests.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ name: "Reusable Grouped Tests Workflow (test_groups.toml)"
2929
on:
3030
workflow_call:
3131
inputs:
32+
linux-x86-pocl-workers:
33+
description: "Maximum PoCL CPU workers for 32-bit Linux Julia. Zero uses the existing configuration."
34+
default: 0
35+
required: false
36+
type: number
3237
group-env-name:
3338
description: "Environment variable name the package's runtests.jl reads its group from (default GROUP)"
3439
default: "GROUP"
@@ -120,6 +125,7 @@ jobs:
120125
runner: ${{ toJson(matrix.runner) }}
121126
timeout-minutes: ${{ matrix.timeout }}
122127
num-threads: "${{ matrix.num_threads }}"
128+
linux-x86-pocl-workers: ${{ inputs.linux-x86-pocl-workers }}
123129
continue-on-error: ${{ matrix.continue_on_error }}
124130
check-bounds: "${{ inputs.check-bounds }}"
125131
allow-reresolve: ${{ inputs.allow-reresolve }}

‎.github/workflows/spellcheck.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ jobs:
1212
uses: actions/checkout@v7
1313

1414
- name: "Check spelling"
15-
uses: crate-ci/typos@v1.50.2
15+
uses: crate-ci/typos@v1.51.1

‎.github/workflows/tests.yml‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ on:
2727
default: "auto"
2828
required: false
2929
type: string
30+
linux-x86-pocl-workers:
31+
description: "Maximum PoCL CPU workers for 32-bit Linux Julia. Zero uses the existing configuration."
32+
default: 0
33+
required: false
34+
type: number
3035
self-hosted:
3136
description: "Run the job needs on a self hosted machine"
3237
default: false
@@ -139,6 +144,25 @@ jobs:
139144
steps:
140145
- uses: actions/checkout@v7
141146

147+
- name: "Configure PoCL workers for 32-bit Linux"
148+
if: >-
149+
${{ inputs.linux-x86-pocl-workers != 0 && runner.os == 'Linux' &&
150+
contains(fromJSON('["x86", "i686"]'), inputs.julia-arch || runner.arch) }}
151+
shell: bash
152+
env:
153+
POCL_WORKERS: ${{ inputs.linux-x86-pocl-workers }}
154+
run: |
155+
if [[ ! $POCL_WORKERS =~ ^[1-9][0-9]{0,9}$ ]] || (( POCL_WORKERS > 2147483647 )); then
156+
echo "::error::linux-x86-pocl-workers must be a positive 32-bit integer or zero to opt out."
157+
exit 1
158+
fi
159+
for setting in POCL_CPU_MAX_CU_COUNT POCL_MAX_PTHREAD_COUNT POCL_MAX_COMPUTE_UNITS JULIA_KA_CPU_THREADS; do
160+
if printenv "$setting" >/dev/null; then
161+
exit 0
162+
fi
163+
done
164+
printf 'POCL_CPU_MAX_CU_COUNT=%s\n' "$POCL_WORKERS" >> "$GITHUB_ENV"
165+
142166
- name: "Install 32-bit runtime libraries (i386)"
143167
# A 32-bit (i686) Julia cannot exec on the 64-bit Linux runners without
144168
# the i386 dynamic loader and C/C++ runtime. setup-julia invokes julia

‎Monorepo.md‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,8 +503,12 @@ group from `test_groups.toml` and schedules it on the GPU runner.
503503
Every workflow in `.github/workflows/` is a **thin caller** that delegates to a
504504
reusable workflow in `SciML/.github` at `@v1`, with `secrets: "inherit"`. Do not
505505
inline build/test steps, permissions, or matrices that a reusable workflow
506-
already owns. The target set (the whole fleet, including OrdinaryDiffEq, is being
507-
converted to these thin-caller forms):
506+
already owns. The exception is `permissions:` — a reusable job cannot elevate
507+
its caller's token, and an explicitly enumerated map downgrades every omitted
508+
scope to `none`, so a caller that writes a map must still list every scope the
509+
reusable job requests (see the TagBot and DependabotAutoMerge callers below).
510+
The target set (the whole fleet, including OrdinaryDiffEq, is being converted
511+
to these thin-caller forms):
508512

509513
### `SublibraryCI.yml` → `sublibrary-project-tests.yml@v1`
510514

@@ -687,7 +691,19 @@ is unnecessary when there is only one package to scan. See the
687691

688692
### `DependabotAutoMerge.yml` → `dependabot-automerge.yml@v1`
689693

694+
Keep the caller permissions shown below — the same elevation rule as TagBot
695+
applies, and omitting `checks: read` or `statuses: read` rejects the workflow
696+
before any job is created.
697+
690698
```yaml
699+
# .github/workflows/DependabotAutoMerge.yml
700+
name: Dependabot Auto-merge
701+
on: pull_request
702+
permissions:
703+
contents: write
704+
pull-requests: write
705+
checks: read
706+
statuses: read
691707
jobs:
692708
automerge:
693709
uses: "SciML/.github/.github/workflows/dependabot-automerge.yml@v1"

‎README.md‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ tested via `project: lib/X` without a hand-written develop step.
148148
| `group` | string | `""` | Test group; exposed to tests via an env var (see `group-env-name`). |
149149
| `group-env-name` | string | `"GROUP"` | Name of the env var the group is set under (e.g. `ODEDIFFEQ_TEST_GROUP`). |
150150
| `num-threads` | string | `"auto"` | `JULIA_NUM_THREADS`. `auto` matches the runner's vCPUs on hosted runners; on self-hosted it falls back to `2` (avoid oversubscribing a large shared box). An explicit integer is always honored. |
151+
| `linux-x86-pocl-workers` | number | `0` | Maximum worker count for the PoCL CPU driver on 32-bit Linux Julia. A positive count sets `POCL_CPU_MAX_CU_COUNT` before Julia starts when the runner has no explicit PoCL worker limit or `JULIA_KA_CPU_THREADS` setting. Zero uses the existing configuration. |
151152
| `self-hosted` | boolean | `false` | Run on a self-hosted runner. |
152153
| `os` | string | `"ubuntu-latest"` | Runner OS (ignored when self-hosted). |
153154
| `runner` | string | `""` | JSON-encoded `runs-on` (string or label array, e.g. `'["self-hosted","Linux","X64","gpu"]'`). When non-empty, overrides `self-hosted`/`os`. |
@@ -467,6 +468,13 @@ out, the PR is left for a human with an explanatory comment (the job still
467468
succeeds — holding is a valid outcome, not a failure). No repo-level "auto-merge
468469
enabled" setting is required.
469470

471+
In both public and private repositories, grant the calling job all four
472+
permissions shown below. GitHub validates the reusable job's permissions before
473+
evaluating its Dependabot actor condition. Omitting either `checks: read` or
474+
`statuses: read` from an explicit permissions map causes a startup failure on
475+
every pull request; a caller with no `permissions:` map inherits the
476+
repository's default token scopes instead.
477+
470478
| Input | Type | Default | Description |
471479
|---|---|---|---|
472480
| `update-types` | string | `"version-update:semver-patch,version-update:semver-minor"` | Dependabot update types to auto-merge. |
@@ -481,8 +489,8 @@ on: pull_request
481489
permissions:
482490
contents: write
483491
pull-requests: write
484-
checks: read # only needed on private repos
485-
statuses: read # only needed on private repos
492+
checks: read
493+
statuses: read
486494
jobs:
487495
automerge:
488496
uses: "SciML/.github/.github/workflows/dependabot-automerge.yml@v1"
@@ -705,6 +713,7 @@ a near-zero-line `CI.yml`, and can split into groups later.
705713
| Input | Type | Default | Description |
706714
|---|---|---|---|
707715
| `group-env-name` | string | `"GROUP"` | Env var the package's `runtests.jl` reads its group from (OrdinaryDiffEq uses `ODEDIFFEQ_TEST_GROUP`). |
716+
| `linux-x86-pocl-workers` | number | `0` | PoCL CPU worker limit forwarded to `tests.yml` for 32-bit Linux Julia. |
708717
| `check-bounds` | string | `"yes"` | `julia-runtest` `check_bounds` per group. |
709718
| `allow-reresolve` | boolean | `true` | `julia-runtest` `allow_reresolve`. |
710719
| `coverage` | boolean | `true` | Collect & upload coverage. |

‎test/runtests.jl‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,43 @@ end
527527
@test i386_at !== nothing && setup_at !== nothing && first(i386_at) < first(setup_at)
528528
end
529529

530+
@testset "Linux x86 PoCL worker limit" begin
531+
workflows = joinpath(@__DIR__, "..", ".github", "workflows")
532+
tests = read(joinpath(workflows, "tests.yml"), String)
533+
grouped = read(joinpath(workflows, "grouped-tests.yml"), String)
534+
input = r"(?m)^ linux-x86-pocl-workers:\n(?: [^\n]*\n)*? default: 0\n"
535+
@test occursin(input, tests)
536+
@test occursin(input, grouped)
537+
@test occursin("linux-x86-pocl-workers: \${{ inputs.linux-x86-pocl-workers }}", grouped)
538+
539+
step = match(r"(?ms)^ - name: \"Configure PoCL workers for 32-bit Linux\"\n(.*?)^ - ", tests)
540+
@test step !== nothing
541+
if step !== nothing
542+
@test step.offset < first(findfirst("uses: julia-actions/setup-julia", tests))
543+
@test occursin("inputs.linux-x86-pocl-workers != 0 && runner.os == 'Linux'", step.match)
544+
@test occursin("""contains(fromJSON('["x86", "i686"]'), inputs.julia-arch || runner.arch)""", step.match)
545+
shell = last(split(step.captures[1], " run: |\n"; limit = 2))
546+
settings = ("POCL_CPU_MAX_CU_COUNT", "POCL_MAX_PTHREAD_COUNT", "POCL_MAX_COMPUTE_UNITS", "JULIA_KA_CPU_THREADS")
547+
function configure(limit, overrides...)
548+
return mktemp() do file, io
549+
close(io)
550+
env = Dict(k => v for (k, v) in ENV if k ∉ settings)
551+
merge!(env, Dict("GITHUB_ENV" => file, "POCL_WORKERS" => limit), Dict(overrides...))
552+
cmd = setenv(`bash -eu -c $shell`, env)
553+
ok = success(pipeline(cmd; stdout = devnull, stderr = devnull))
554+
return ok, read(file, String)
555+
end
556+
end
557+
@test configure("2") == (true, "POCL_CPU_MAX_CU_COUNT=2\n")
558+
for setting in settings
559+
@test configure("2", setting => "5") == (true, "")
560+
end
561+
for invalid in ("-1", "1.5", "2147483648")
562+
@test configure(invalid) == (false, "")
563+
end
564+
end
565+
end
566+
530567
# develop_sources.jl: the [sources] develop helper used by tests.yml on Julia
531568
# <1.11. The pure path-collection (collect_source_paths) is tested here without
532569
# mutating any environment.

0 commit comments

Comments
 (0)