diff --git a/.github/workflows/julia_auto_update.yml b/.github/workflows/julia_auto_update.yml index 9ef118710..0594f0a38 100644 --- a/.github/workflows/julia_auto_update.yml +++ b/.github/workflows/julia_auto_update.yml @@ -19,11 +19,13 @@ jobs: run: | pixi run install-julia pixi run update-manifest-julia + env: + JULIA_PKG_PRECOMPILE_AUTO: "0" - uses: peter-evans/create-pull-request@v7 with: token: ${{ secrets.CI_PR_PAT }} branch: update/julia-manifest title: Update Julia manifest commit-message: "Update Julia manifest" - body: Update Julia dependencies to the latest version. + body-path: .pixi/update-manifest-julia.md author: "GitHub " diff --git a/pixi.toml b/pixi.toml index 315fcbff8..137b50c61 100644 --- a/pixi.toml +++ b/pixi.toml @@ -31,7 +31,7 @@ install = { depends-on = [ # Julia # Clear SSL_CERT_DIR to avoid Julia warnings, see https://github.com/JuliaLang/Downloads.jl/issues/244 update-registry-julia = { cmd = "julia --eval='using Pkg; Registry.update()'", env = { SSL_CERT_DIR = "" } } -update-manifest-julia = { cmd = "julia --project --eval='using Pkg; Pkg.update()'", env = { SSL_CERT_DIR = "" } } +update-manifest-julia = { cmd = "julia --project utils/update-manifest.jl", env = { SSL_CERT_DIR = "", JULIA_SSL_CA_ROOTS_PATH = "" } } instantiate-julia = { cmd = "julia --project --eval='using Pkg; Pkg.instantiate()'", env = { SSL_CERT_DIR = "", JULIA_SSL_CA_ROOTS_PATH = "" } } initialize-julia = { depends-on = [ "update-registry-julia", diff --git a/utils/update-manifest.jl b/utils/update-manifest.jl new file mode 100644 index 000000000..c4fb5d8f9 --- /dev/null +++ b/utils/update-manifest.jl @@ -0,0 +1,47 @@ +import Pkg + +const IS_INSTALLED = r"\s*Installed (.+)" +const DETAILS_BEGIN = """ +
+ +All package versions + + +``` +""" + +""" +Update the Julia Manifest.toml and show the changes as well as outdated packages. +The output is written to a file that can be used as the body of a pull request. +""" +function (@main)(_) + path = normpath(@__DIR__, "../.pixi/update-manifest-julia.md") + redirect_stdio(; stdout = path, stderr = path) do + println("Update the Julia Manifest.toml to get the latest dependencies.\n") + println("__Changed packages__\n```") + Pkg.update() + println("```\n\n__Packages still outdated after update__\n```") + Pkg.status(; outdated = true) + println("```") + end + + # The Pkg.update output first prints all installed package versions. + # This is a lot, strip it out, sort it, and put it in a details tag at the end. + installed_lines = String[] + lines = readlines(path) + open(path, "w") do io + for line in lines + m = match(IS_INSTALLED, line) + if m === nothing + println(io, line) + else + push!(installed_lines, only(m.captures)) + end + end + + println(io, DETAILS_BEGIN) + sort!(installed_lines) + foreach(line -> println(io, line), installed_lines) + println("```\n\n
") + end +end