From 767cc78162a5c20d8c7bfe60ed8c9c08c4de2510 Mon Sep 17 00:00:00 2001 From: Chris Rackauckas Date: Tue, 4 Aug 2026 16:48:48 -0400 Subject: [PATCH] feat: add auto-precompile input to the reusable test workflows A job that calls a reusable workflow with `uses:` may not carry an `env:` map, so a consumer cannot set JULIA_PKG_PRECOMPILE_AUTO at its call site -- adding one there makes the workflow file invalid and GitHub refuses to create any jobs for it at all. Expose it as an input instead: tests.yml sets it job-level (covering buildpkg's instantiate/build as well as the test run), and grouped-tests.yml / sublibrary-project-tests.yml forward it so both the root matrix and every sublibrary shard can opt out of Pkg's eager parallel precompilation. Co-Authored-By: Chris Rackauckas --- .github/workflows/grouped-tests.yml | 6 +++++ .../workflows/sublibrary-project-tests.yml | 9 +++++++ .github/workflows/tests.yml | 10 +++++++ test/runtests.jl | 27 +++++++++++++++++++ 4 files changed, 52 insertions(+) diff --git a/.github/workflows/grouped-tests.yml b/.github/workflows/grouped-tests.yml index 2eb53e1..b32d772 100644 --- a/.github/workflows/grouped-tests.yml +++ b/.github/workflows/grouped-tests.yml @@ -74,6 +74,11 @@ on: default: false required: false type: boolean + auto-precompile: + description: "Value of JULIA_PKG_PRECOMPILE_AUTO for each test 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 jobs: detect: @@ -123,4 +128,5 @@ jobs: apt-packages: "${{ inputs.apt-packages }}" container: "${{ inputs.container }}" cache: ${{ inputs.cache }} + auto-precompile: ${{ inputs.auto-precompile }} secrets: "inherit" diff --git a/.github/workflows/sublibrary-project-tests.yml b/.github/workflows/sublibrary-project-tests.yml index f5a9847..052fdf8 100644 --- a/.github/workflows/sublibrary-project-tests.yml +++ b/.github/workflows/sublibrary-project-tests.yml @@ -66,6 +66,11 @@ on: default: false required: false type: boolean + auto-precompile: + description: "Value of JULIA_PKG_PRECOMPILE_AUTO for each sublibrary test job (true -> 1, false -> 0). Set false for sublibraries whose dependency tree OOMs the runner during Pkg's eager parallel precompilation." + default: true + required: false + type: boolean jobs: detect: @@ -163,6 +168,7 @@ jobs: coverage: ${{ inputs.coverage }} coverage-directories: "${{ matrix.project }}/src,${{ matrix.project }}/ext" cache: ${{ inputs.cache }} + auto-precompile: ${{ inputs.auto-precompile }} secrets: "inherit" test-2: @@ -187,6 +193,7 @@ jobs: coverage: ${{ inputs.coverage }} coverage-directories: "${{ matrix.project }}/src,${{ matrix.project }}/ext" cache: ${{ inputs.cache }} + auto-precompile: ${{ inputs.auto-precompile }} secrets: "inherit" test-3: @@ -211,6 +218,7 @@ jobs: coverage: ${{ inputs.coverage }} coverage-directories: "${{ matrix.project }}/src,${{ matrix.project }}/ext" cache: ${{ inputs.cache }} + auto-precompile: ${{ inputs.auto-precompile }} secrets: "inherit" test-4: @@ -235,4 +243,5 @@ jobs: coverage: ${{ inputs.coverage }} coverage-directories: "${{ matrix.project }}/src,${{ matrix.project }}/ext" cache: ${{ inputs.cache }} + auto-precompile: ${{ inputs.auto-precompile }} secrets: "inherit" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6ab159c..18187ec 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -106,6 +106,11 @@ on: 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" @@ -126,6 +131,11 @@ jobs: 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 diff --git a/test/runtests.jl b/test/runtests.jl index 5900b18..050317d 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -600,3 +600,30 @@ end root = make_sources_fixture() @test isempty(collect_source_paths(joinpath(root, "Leaf"))) end + +@testset "auto-precompile input is plumbed to JULIA_PKG_PRECOMPILE_AUTO" begin + wf(p) = read(joinpath(@__DIR__, "..", ".github", "workflows", p), String) + + tests = wf("tests.yml") + # Declared as a boolean input, defaulting to Pkg's normal eager behavior. + @test occursin("auto-precompile:", tests) + # Job-level (not step-level) so buildpkg's instantiate/build is covered too. + precompile_at = findfirst("JULIA_PKG_PRECOMPILE_AUTO", tests) + steps_at = findfirst("\n steps:", tests) + @test precompile_at !== nothing && steps_at !== nothing + @test first(precompile_at) < first(steps_at) + @test occursin("JULIA_PKG_PRECOMPILE_AUTO: \"\${{ inputs.auto-precompile && '1' || '0' }}\"", tests) + + # Both fan-out workflows expose the input and forward it, or a caller has no + # way to set it: a job that `uses:` a reusable workflow may not carry `env:`. + for p in ("grouped-tests.yml", "sublibrary-project-tests.yml") + txt = wf(p) + @test occursin("auto-precompile:", txt) + @test occursin("auto-precompile: \${{ inputs.auto-precompile }}", txt) + end + + # sublibrary-project-tests fans out over four shards; every one must forward + # it, otherwise the setting silently applies to only part of the matrix. + subs = wf("sublibrary-project-tests.yml") + @test count("auto-precompile: \${{ inputs.auto-precompile }}", subs) == 4 +end