This commit is contained in:
Ernisto 2025-04-29 10:49:13 +05:30 committed by GitHub
commit df2df77a8e
Signed by: DevComp
GPG key ID: B5690EEEBB952194
24 changed files with 493 additions and 221 deletions

45
.github/workflows/update-tools.yml vendored Normal file
View file

@ -0,0 +1,45 @@
name: Daily Update Manifests
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
jobs:
update-manifests:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup pesde
uses: lumin-org/setup-pesde@v0.4.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
cache: true
- name: Install packages
run: pesde install
timeout-minutes: 1 # sometimes the install just hangs infinitely, so you won't want spent 12 hours of ci credit for nothing :sob:
- name: Set up Git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Apply updates
run: lune run .lune/update_tools -- --yes
- name: Publish updates
run: pesde publish
- name: Commit and push changes
run: |
if [[ -n "$(git status --porcelain)" ]]; then
git add .
git commit -m "chore: daily manifest update [skip ci]"
git push
else
echo "No changes to commit."
fi

2
.gitignore vendored
View file

@ -1,2 +1,4 @@
**/*_packages/ **/*_packages/
toolchainlib/pesde.lock toolchainlib/pesde.lock
**/tests/output/**

View file

@ -79,6 +79,7 @@ local BINS_SRC_DIR = pathfs.getAbsolutePathOf(pathfs.Path.from("bins"))
for _, binSrc in pathfs.readDir(BINS_SRC_DIR) do for _, binSrc in pathfs.readDir(BINS_SRC_DIR) do
local absPath = BINS_SRC_DIR:join(binSrc) local absPath = BINS_SRC_DIR:join(binSrc)
local testsPath = absPath:join("tests/run.luau")
local binEntrypoint = absPath:join("init.luau") local binEntrypoint = absPath:join("init.luau")
local manifestPath = absPath:join("pesde.toml") local manifestPath = absPath:join("pesde.toml")
local readmePath = absPath:join("README.md") local readmePath = absPath:join("README.md")
@ -135,6 +136,21 @@ for _, binSrc in pathfs.readDir(BINS_SRC_DIR) do
)}{newVersion}{stdio.style("reset")}` )}{newVersion}{stdio.style("reset")}`
) )
-- Check if the tool has any tests, and run them if they do
if pathfs.isFile(testsPath) then
local success, result = pcall(require, testsPath:toString())
if not success then
continue
end
success, result = pcall(result, newVersion)
if not success then
continue
end
else
warn(`Unit tests not found for {binSrc}, assuming that they pass`)
end
-- HACK: To prevent messing with our existing toml ordering and formatting -- HACK: To prevent messing with our existing toml ordering and formatting
-- we just replace the old version field string with the new version field -- we just replace the old version field string with the new version field
-- string -- string
@ -146,13 +162,16 @@ for _, binSrc in pathfs.readDir(BINS_SRC_DIR) do
-- New version field string: -- New version field string:
local newField = string.gsub(serde.encode("toml", { version = stripLeadingVersion(newVersion) }), "%s+$", "") local newField = string.gsub(serde.encode("toml", { version = stripLeadingVersion(newVersion) }), "%s+$", "")
local updatedManifest = string.gsub( local updatedManifest, replaces = string.gsub(
manifestContents, manifestContents,
oldField, string.gsub(oldField, "[%.%+%-]", "%%%0"),
newField, newField,
-- Only replace the first occurrence to be safe -- Only replace the first occurrence to be safe
1 1
) )
if replaces == 0 then
error("failed to replace version field in manifest")
end
local toWrite = table.find(process.args, "--yes") local toWrite = table.find(process.args, "--yes")
or table.find(process.args, "-y") or table.find(process.args, "-y")

View file

@ -0,0 +1,6 @@
{
"name": "good-input",
"tree": {
"$path": "../"
}
}

12
bins/argon/tests/run.luau Normal file
View file

@ -0,0 +1,12 @@
local toolchainlib = require("../lune_packages/core")
local process = require("@lune/process")
local fs = require("@lune/fs")
return function(version)
-- not working, needing support
-- process.args = { "sourcemap", "bins/argon/tests/input.project.json", "--output bins/argon/tests/output/sourcemap.json" }
local success, err = pcall(require, "bins/argon/init.luau")
assert(success, `failed to execute argon: {err}`)
assert(fs.isFile("bins/argon/tests/output/sourcemap.luau"), `output not found`)
end

View file

@ -0,0 +1,10 @@
[inputs.assets]
path = "input/**"
output_path = "output"
[creator]
type = "user"
id = 0
[codegen]
output_name = "init.luau"

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

View file

@ -0,0 +1,13 @@
local toolchainlib = require("../lune_packages/core")
local process = require("@lune/process")
local fs = require("@lune/fs")
return function(version)
-- not working, needing support
-- process.cwd = "bins/asphalt" -- bcuz asphalt.toml must to be in the same directory
-- process.args = { "sync", "--target debug" }
local success, err = pcall(require, "bins/asphalt/init.luau")
assert(success, `failed to execute asphalt: {err}`)
assert(fs.isFile("bins/asphalt/tests/output/water_normal_map.png"), "uploaded asset not found")
end

View file

@ -0,0 +1,9 @@
option ClientOutput = "test/output/client.luau"
option ServerOutput = "test/output/server.luau"
event MyFirstEvent {
from: Server,
type: Reliable,
call: SingleSync,
data: string
}

16
bins/blink/tests/run.luau Normal file
View file

@ -0,0 +1,16 @@
local toolchainlib = require("../lune_packages/core")
local process = require("@lune/process")
local fs = require("@lune/fs")
return function(version)
-- not working, needing support
-- process.args = { "bins/blink/tests/input.blink" }
local success, err = pcall(require, "bins/blink/init.luau")
assert(success, `failed to execute blink: {err}`)
local client_signature = `\n-- File generated by Blink v{version}`
assert(fs.readFile("bins/blink/tests/output/client.luau"):match(client_signature), `invalid output`)
local server_signature = `\n-- File generated by Blink v{version}`
assert(fs.readFile("bins/blink/tests/output/server.luau"):match(server_signature), `invalid output`)
end

View file

@ -0,0 +1,8 @@
opt server_output = "tests/output/server.luau"
opt client_output = "tests/output/client.luau"
funct Test = {
call: Async,
args: (Foo: u8, Bar: string),
rets: enum { Success, Fail }
}

View file

@ -0,0 +1,16 @@
local toolchainlib = require("../lune_packages/core")
local process = require("@lune/process")
local fs = require("@lune/fs")
return function(version)
-- not working, needing support
-- process.args = { "bins/zap/tests/input.zap" }
local success, err = pcall(require, "bins/blink/init.luau")
assert(success, `failed to execute blink: {err}`)
local client_signature = `\n-- Client generated by Zap v{version} (https://github.com/red-blox/zap)`
assert(fs.readFile("tests/output/client.luau"):match(client_signature), `invalid output`)
local server_signature = `\n-- Server generated by Zap v{version} (https://github.com/red-blox/zap)`
assert(fs.readFile("tests/output/server.luau"):match(server_signature), `invalid output`)
end

View file

@ -0,0 +1 @@
local a: string = 1

View file

@ -0,0 +1,15 @@
local toolchainlib = require("../lune_packages/core")
local process = require("@lune/process")
local fs = require("@lune/fs")
return function(version)
-- not working, needing support
-- process.args = { "process bins/darklua/tests/input.luau bins/darklua/tests/output.luau" --format dense }
local success, result = pcall(require, "bins/darklua/init.luau")
assert(success, `failed to execute darklua: {result}`)
assert(
fs.readFile("bins/darklua/tests/output.luau") ~= fs.readFile("bins/darklua/tests/input.luau"),
`any expected error was found: {result}`
)
end

View file

@ -0,0 +1,6 @@
{
"name": "good-input",
"tree": {
"$path": "../"
}
}

12
bins/rojo/tests/run.luau Normal file
View file

@ -0,0 +1,12 @@
local toolchainlib = require("../lune_packages/core")
local process = require("@lune/process")
local fs = require("@lune/fs")
return function(version)
-- not working, needing support
-- process.args = { "sourcemap", "bins/rojo/tests/input.project.json", "--output bins/rojo/tests/output/sourcemap.json" }
local success, err = pcall(require, "bins/rojo/init.luau")
assert(success, `failed to execute rojo: {err}`)
assert(fs.isFile("bins/rojo/tests/output/sourcemap.luau"), `output not found`)
end

View file

@ -0,0 +1,3 @@
if {} == {} then
error("impossible")
end

View file

@ -0,0 +1,3 @@
if 1 == 1 then
print("always true")
end

View file

@ -0,0 +1,28 @@
local toolchainlib = require("../lune_packages/core")
local process = require("@lune/process")
return function(version)
do
-- not working, needing support
-- process.args = { "bins/selene/tests/bad_input.luau" }
local success, result = pcall(require, "bins/selene/init.luau")
assert(success, `failed to execute selene: {result}`)
assert(
string.find(result, "%d warnings") or string.find(result, "%d errors"),
`any expected error was found: {result}`
)
end
do
-- not working, needing support
-- process.args = { "bins/selene/tests/good_input.luau" }
local success, result = pcall(require, "bins/selene/init.luau")
assert(success, `failed to execute selene: {result}`)
assert(
string.find(result, "0 warnings") or string.find(result, "0 errors"),
`a unexpected error was found: {result}`
)
end
end

View file

@ -0,0 +1 @@
local a = 5

View file

@ -0,0 +1 @@
local a = 5

View file

@ -0,0 +1,22 @@
local toolchainlib = require("../lune_packages/core")
local process = require("@lune/process")
return function(version)
do
-- not working, needing support
-- process.args = { "--check bins/stylua/tests/bad_input.luau", "--output-format summary" }
local success, result = pcall(require, "bins/stylua/init.luau")
assert(success, `failed to execute stylua: {result}`)
assert(string.find(result, "Code style issues found"), `any expected error was found: {result}`)
end
do
-- not working, needing support
-- process.args = { "--check bins/stylua/tests/good_input.luau", "--output-format summary" }
local success, result = pcall(require, "bins/stylua/init.luau")
assert(success, `failed to execute stylua: {result}`)
assert(string.find(result, "All files are correctly formatted."), `a unexpected error was found: {result}`)
end
end

8
bins/zap/tests/input.zap Normal file
View file

@ -0,0 +1,8 @@
opt server_output = "tests/output/server.luau"
opt client_output = "tests/output/client.luau"
funct Test = {
call: Async,
args: (Foo: u8, Bar: string),
rets: enum { Success, Fail }
}

16
bins/zap/tests/run.luau Normal file
View file

@ -0,0 +1,16 @@
local toolchainlib = require("../lune_packages/core")
local process = require("@lune/process")
local fs = require("@lune/fs")
return function(version)
-- not working, needing support
-- process.args = { "bins/zap/tests/input.zap" }
local success, err = pcall(require, "bins/zap/init.luau")
assert(success, `failed to execute zap: {err}`)
local client_signature = `\n-- Client generated by Zap v{version} (https://github.com/red-blox/zap)`
assert(fs.readFile("bins/zap/tests/output/client.luau"):match(client_signature), `invalid output`)
local server_signature = `\n-- Server generated by Zap v{version} (https://github.com/red-blox/zap)`
assert(fs.readFile("bins/zap/tests/output/server.luau"):match(server_signature), `invalid output`)
end