Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ $ mise exec -- lua scripts/bootstrap/bootstrap.lua rocks \
--lua=.cache/toolchains/lua-5.4.9/bin/lua
```

Install LuaLS 3.19.1 into the ignored local cache:
Install LuaLS 3.19.1 into the ignored local cache on Linux x86_64, Linux ARM64
or macOS ARM64.

```console
$ mise exec -- lua scripts/bootstrap/bootstrap.lua luals
Expand All @@ -81,16 +82,22 @@ scripts keep LuaJIT and PUC Lua 5.1 rocks in separate cache trees, even though
both report the Lua 5.1 ABI. LuaJIT uses the same absolute prefix during build
and installation, following its [installation guide](https://luajit.org/install.html).

Install the accepted Neovim hosts into separate local cache directories:
Install the accepted Neovim hosts into separate local cache directories. Use
all four pinned versions on Linux x86_64.

```console
$ luajit scripts/bootstrap/bootstrap.lua hosts \
0.10.0 0.10.4 0.11.7 0.12.5
```

The host bootstrap supports Linux x86_64. It verifies pinned official archive
hashes, each executable and its embedded runtime. Existing installations stay
unchanged. `--check` verifies the cached hosts without network access.
On Linux ARM64, use the pinned Neovim 0.12.5 archive.

```console
$ luajit scripts/bootstrap/bootstrap.lua hosts 0.12.5
```

The bootstrap verifies each official archive's pinned hash, the executable
and its embedded runtime. `--check` verifies cached hosts offline.

## Validation

Expand Down
50 changes: 32 additions & 18 deletions scripts/bootstrap/hosts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,35 @@ local shell = require("support.shell")

local M = {}

-- v0.10.x checksum assets and v0.11+ release asset digests, all for Linux x86_64.
-- v0.10.x checksum assets and v0.11+ release asset digests.
M.RELEASES = {
["0.10.0"] = {
"nvim-linux64",
"be1f0988d0de71c375982b87b86cd28d2bab35ece8285abe3b0aac57604dfc5a",
["Linux x86_64"] = {
"nvim-linux64",
"be1f0988d0de71c375982b87b86cd28d2bab35ece8285abe3b0aac57604dfc5a",
},
},
["0.10.4"] = {
"nvim-linux-x86_64",
"95aaa8e89473f5421114f2787c13ae0ec6e11ebbd1a13a1bd6fcf63420f8073f",
["Linux x86_64"] = {
"nvim-linux-x86_64",
"95aaa8e89473f5421114f2787c13ae0ec6e11ebbd1a13a1bd6fcf63420f8073f",
},
},
["0.11.7"] = {
"nvim-linux-x86_64",
"38a7c6317f94503841096c00e8fde05ef04b9472fc9d7d62b6e033cecd6f7991",
["Linux x86_64"] = {
"nvim-linux-x86_64",
"38a7c6317f94503841096c00e8fde05ef04b9472fc9d7d62b6e033cecd6f7991",
},
},
["0.12.5"] = {
"nvim-linux-x86_64",
"bce0f56eda1f1b1db6eee8f4133d7a38813ea07933837dd1777411ca384c6875",
["Linux x86_64"] = {
"nvim-linux-x86_64",
"bce0f56eda1f1b1db6eee8f4133d7a38813ea07933837dd1777411ca384c6875",
},
["Linux aarch64"] = {
"nvim-linux-arm64",
"1aa5ca085249580ae0f91eb14f27ec0919773ff2d99a163d03f3d6c21ac29725",
},
},
}

Expand Down Expand Up @@ -97,8 +109,13 @@ end

---@param version string
---@param check_only boolean
function M.bootstrap(version, check_only)
local flavor, checksum = M.RELEASES[version][1], M.RELEASES[version][2]
---@param host string
function M.bootstrap(version, check_only, host)
local artifact = M.RELEASES[version][host]
if not artifact then
error(("No pinned Neovim %s bootstrap artifact for %s"):format(version, host), 0)
end
local flavor, checksum = artifact[1], artifact[2]
local asset = flavor .. ".tar.gz"
local url = ("https://github.com/neovim/neovim/releases/download/v%s/%s"):format(version, asset)
local source = repo.root .. "/.cache/source/nvim-" .. version
Expand All @@ -124,7 +141,7 @@ function M.bootstrap(version, check_only)
end
local expected = {
version = version,
platform = "Linux-x86_64",
platform = host:gsub(" ", "-"),
artifact_url = url,
artifact_sha256 = checksum,
}
Expand Down Expand Up @@ -158,7 +175,7 @@ function M.bootstrap(version, check_only)
error("Neovim " .. version .. " executable changed since installation", 0)
end
end
local host = M.probe(executable, version)
local report = M.probe(executable, version)
local result = json.object({
"version",
"platform",
Expand All @@ -172,7 +189,7 @@ function M.bootstrap(version, check_only)
artifact_url = url,
artifact_sha256 = checksum,
executable_sha256 = executable_hash,
host = host,
host = report,
})
if installed then
files.write(receipt, json.encode(result, 2) .. "\n")
Expand Down Expand Up @@ -202,13 +219,10 @@ function M.main(versions, check_only)
end
end
local host = shell.check({ "uname", "-sm" }):match("^(.-)%s*$")
if host ~= "Linux x86_64" then
error("No pinned Neovim bootstrap artifact for this host; matrix cell remains untested", 0)
end
local failures, started = 0, os.time()
for _, version in ipairs(versions) do
local cell_started = os.time()
local ok, report = pcall(M.bootstrap, version, check_only)
local ok, report = pcall(M.bootstrap, version, check_only, host)
if ok then
report.executable = repo.root .. "/.cache/toolchains/nvim-" .. version .. "/bin/nvim"
report.status = "READY"
Expand Down
4 changes: 4 additions & 0 deletions scripts/bootstrap/luals.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ M.ARTIFACTS = {
"linux-x64",
"e9235d2d72ef55bc41cf8c99cda2ed64777682024b4bb81f5dea425060c5cbb8",
},
["Linux aarch64"] = {
"linux-arm64",
"abd2572e8fc929dc838a81ffb8473c5bce0bf39bfe8edb4b120b3b623176ce83",
},
["Darwin arm64"] = {
"darwin-arm64",
"0bc077f4447f076b4c92c14e9fd303f5b569eda2ec74b4dca2b55f75fae2e90c",
Expand Down
17 changes: 15 additions & 2 deletions scripts/bootstrap/tests/test_bootstrap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ function M.test_every_pin_is_a_full_digest_or_revision()
test.assertEquals(#digest, 64, version)
end
test.assertEquals(#runtimes.LUAJIT_REVISION, 40)
for version, pin in pairs(hosts.RELEASES) do
test.assertEquals(#pin[2], 64, version)
for _, artifacts in pairs(hosts.RELEASES) do
for _, pin in pairs(artifacts) do
test.assertStrMatches(pin[2], "%x+")
test.assertEquals(#pin[2], 64)
end
end
for host, pin in pairs(luals.ARTIFACTS) do
test.assertEquals(#pin[2], 64, host)
Expand Down Expand Up @@ -130,6 +133,16 @@ function M.test_an_unknown_request_is_refused_before_anything_runs()
test.assertErrorMsgContains("Unknown Neovim version", hosts.main, { "0.0.1" }, true)
end

function M.test_a_known_neovim_release_requires_an_artifact_for_the_requested_host()
test.assertErrorMsgContains(
"No pinned Neovim 0.10.0 bootstrap artifact for Linux aarch64",
hosts.bootstrap,
"0.10.0",
true,
"Linux aarch64"
)
end

function M.test_the_job_lua_is_mises_for_the_provided_version_and_a_built_one_otherwise()
test.assertEquals(
select_lua.built_path("5.4.9", "/work"),
Expand Down
Loading