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
38 changes: 16 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [ "main" ]

jobs:
ci-test:
lune-zune-test:
runs-on: ubuntu-latest

steps:
Expand All @@ -21,25 +21,19 @@ jobs:
chmod +x lune
sudo mv lune /usr/local/bin/lune
rm lune.zip

- name: Install Pesde
- name: Install Zune
run: |
curl -f -L "https://github.com/pesde-pkg/pesde/releases/download/v0.7.2+registry.0.2.3/pesde-0.7.2-linux-x86_64.zip" -o pesde.zip
unzip -j pesde.zip
chmod +x pesde
sudo mv pesde /usr/local/bin/pesde
rm pesde.zip

- name: Install CI Dependencies
working-directory: ./ci
run: pesde install
env:
PESDE_CONFIG_USER_TOKEN_STORE: file

- name: Debug - Check lune_packages
working-directory: ./ci
run: ls -la && ls -la lune_packages/ || echo "lune_packages not found"

- name: Run CI Tests
working-directory: ./ci
run: lune run test
curl -f -L "https://github.com/Scythe-Technology/zune/releases/download/v0.5.5/zune-0.5.5-linux-x86_64.zip" -o zune.zip
unzip -j zune.zip
chmod +x zune
sudo mv zune /usr/local/bin/zune
rm zune.zip

- name: Run Lune CI
working-directory: .
run: lune run test

- name: Run Zune CI
working-directory: .
run: zune run test
17 changes: 10 additions & 7 deletions .luaurc
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"languageMode": "strict",
"aliases": {
"c": "",
"lune": "~/.lune/.typedefs/0.10.4/",
"pesde": "lune_packages/"
}
}
"aliases": {
"c": "",
"lune": "~/.lune/.typedefs/0.10.4/",
"pesde": "lune_packages/"
},
"globals": [
"warn"
],
"languageMode": "strict"
}
2 changes: 1 addition & 1 deletion .lune/test.luau
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local process = require("@lune/process")

local running = process.exec("lune", { "run", "tests/index" }, { stdio = "inherit", cwd = "ci" })
local running = process.exec("lune", { "run", "tests/lune" }, { stdio = "inherit", cwd = "ci" })

if not running.ok then
print(running.stderr)
Expand Down
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"luau-lsp.types.definitionFiles": [
"/home/wiz/.zune/typedefs/global/zune.d.luau"
],
"luau-lsp.types.documentationFiles": [
"/home/wiz/.zune/typedefs/global/zune.d.json"
]
}
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## `v0.4.0` - April 14, 2026

### Added

- **Runtime Abstraction Layer**: Introduced an adapter pattern for core libraries (`fs`, `net`, `process`, `serde`, and `task`), decoupling the framework from specific runtime implementations.
- **Zune Runtime Support**: Added full support for the Zune runtime.

### Changed

- **Runtime-Agnostic Utilities**: Refactored internal utility functions to utilize the new abstraction layer, removing direct dependencies on `@lune` built-ins.
- **Enhanced CI Pipeline**: Updated GitHub Actions to install Zune and execute the test suite across both Lune and Zune runtimes to ensure cross-runtime compatibility.

## `v0.3.5` - March 29, 2026

### Changed

* Refactor middleware and remove unnecessary optimizations

## `v0.3.4` - March 25, 2026

### Added
Expand Down
17 changes: 10 additions & 7 deletions ci/.luaurc
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"languageMode": "strict",
"aliases": {
"c": "",
"lune": "~/.lune/.typedefs/0.10.4/",
"pesde": "lune_packages/"
}
}
"aliases": {
"c": "/home/wiz/projects/nova/ci/",
"lune": "~/.lune/.typedefs/0.10.4/",
"pesde": "lune_packages/"
},
"globals": [
"warn"
],
"languageMode": "strict"
}
2 changes: 1 addition & 1 deletion ci/.lune/test.luau
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local process = require("@lune/process")

local running = process.exec("lune", { "run", "tests/index" }, { stdio = "inherit" })
local running = process.exec("lune", { "run", "tests/lune" }, { stdio = "inherit" })

if not running.ok then
print(running.stderr)
Expand Down
105 changes: 105 additions & 0 deletions ci/aura/src/index.luau
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
--!optimize 2
--!native

local net = require("../../../src/libs/net")
local serde = require("../../../src/libs/serde")
local Types = require("./types")
-- HTTP Method Enums
local METHODS = {
POST = "POST",
GET = "GET",
PUT = "PUT",
PATCH = "PATCH",
DELETE = "DELETE"
}

local Aura = {}

function Aura.get(config: Types.AuraRequest): Types.AuraResponse
assert(config.url, "Url not found")
assert(typeof(config.url) == "string", "Url must be string")

local displayUrl = config.url

if config.headers and config.headers["Content-Type"] and not (typeof(config.headers["Content-Type"]) == "string") then
error("Content-Type of Headers has to be string", 2)
end

local finalConfig = {
url = string.gsub(config.url, "://localhost", "://127.0.0.1"),
method = config.method or METHODS.GET,
headers = config.headers or { ["Content-Type"] = "application/json" },
body = if config.body and typeof(config.body) == "table" then serde.encode("json", config.body) else config.body or "",
query = config.query,
options = config.options
} :: Types.AuraRequest

local startTime = os.clock()
local response = net.request(finalConfig :: net.FetchParams)
local endTime = os.clock()

local duration = endTime - startTime

local success, decodedBody = pcall(function()
return serde.decode("json", response.body :: string)
end)

local finalResponse: Types.AuraResponse = {
ok = response.ok,
status = response.statusCode,
statusMessage = response.statusMessage,
headers = response.headers :: { [string]: string },
body = if success then decodedBody else response.body,
responseTime = duration
}

if not finalResponse.ok then
local color = if finalResponse.status >= 400 then "\27[31m" elseif finalResponse.status >= 300 then "\27[34m" else "\27[32m"
local reset = "\27[0m"

local beautyError = string.format(
"%s" ..
" Aura Request got an issue:\n" ..
"\n" ..
" Status : %d (%s)\n" ..
" Method : %s\n" ..
" URL : %s\n" ..
" Time : %.4f seconds\n" ..
"\n" ..
"%s" :: any,
color,
finalResponse.status,
finalResponse.statusMessage or "Unknown",
finalConfig.method or "GET",
displayUrl,
duration,
reset
)

print(beautyError)
end

return finalResponse
end

function Aura.post(config: Types.AuraRequest): Types.AuraResponse
config.method = METHODS.POST
return Aura.get(config)
end

function Aura.put(config: Types.AuraRequest): Types.AuraResponse
config.method = METHODS.PUT
return Aura.get(config)
end

function Aura.patch(config: Types.AuraRequest): Types.AuraResponse
config.method = METHODS.PATCH
return Aura.get(config)
end

function Aura.delete(config: Types.AuraRequest): Types.AuraResponse
config.method = METHODS.DELETE
return Aura.get(config)
end

return Aura
27 changes: 27 additions & 0 deletions ci/aura/src/types.luau
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export type Headers = {
["Content-Type"]: "application/json" | "application/x-www-form-urlencoded" | "text/plain" | string,
}

export type AuraRequest = {
url: string?,
method: string?,
body: any?,
headers: Headers?,
query: { [string]: string }?,
options: { [string]: any }?
}

export type AuraResponse = {
ok: boolean,
status: number,
statusMessage: string,
headers: { [string]: string },
body: any,
responseTime: number
}

export type Aura = {
get: (config: AuraRequest) -> AuraResponse --((url: string) -> AuraResponse) &
}

return {}
4 changes: 2 additions & 2 deletions ci/src/app/[file]/route.luau
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local Nova = require("../../../../src/index")
local fs = require("@lune/fs")
local process = require("@lune/process")
local fs = require("../../../../src/libs/fs")
local process = require("../../../../src/libs/process")

local SimpleWeb = {}

Expand Down
2 changes: 1 addition & 1 deletion ci/src/app/route.luau
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ local Home = {}

function Home.Get(req: Nova.Request)

return Nova.response.json({ msg = "Hello World", body = req.body })
return Nova.response.send("Hello, World")
end

return Home
2 changes: 1 addition & 1 deletion ci/tests/delete.luau
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local Aura = require("@pesde/aura")
local Aura = require("../aura/src/index")
local Tester = require("../utils/tester")

Tester.describe("POST Method", function()
Expand Down
2 changes: 1 addition & 1 deletion ci/tests/get.luau
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local Aura = require("@pesde/aura")
local Aura = require("../aura/src/index")
local Tester = require("../utils/tester")

Tester.describe("POST Method", function()
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion ci/tests/post.luau
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local Aura = require("@pesde/aura")
local Aura = require("../aura/src/index")
local Tester = require("../utils/tester")

Tester.describe("POST Method", function()
Expand Down
2 changes: 1 addition & 1 deletion ci/tests/put.luau
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local Aura = require("@pesde/aura")
local Aura = require("../aura/src/index")
local Tester = require("../utils/tester")

Tester.describe("POST Method", function()
Expand Down
32 changes: 32 additions & 0 deletions ci/tests/zune.luau
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
local process = zune.process

local TEST_FILES = { "post", "get", "put", "delete" }
local failed = false

print("\27[36mStarting Nova Test Suite...\27[0m")

for _, name in TEST_FILES do
print(`Running {name}... `)

local result = process.run("zune", { "run", `tests/{name}` }, {
stdin = "inherit",
stdout = "inherit",
stderr = "inherit",
})

if result.ok then
print("\27[32mPASSED\27[0m")
else
print("\27[31mFAILED\27[0m")
print(`\27[33m{result.stderr}\27[0m`)
failed = true
end
end

if failed then
print("\nTest Suite Failed")
process.exit(1)
else
print("\nTest Suite Successful")
process.exit(0)
end
18 changes: 11 additions & 7 deletions ci/utils/tester.luau
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
local Aura = require("@pesde/aura")
local process = require("@lune/process")
local task = require("@lune/task")
local net = require("../../src/libs/net")
local process = require("../../src/libs/process")
local task = require("../../src/libs/task")

local Tester = {}

function Tester.describe(name, callback)
local server = process.create("lune", { "run", "src/index" }, { env = process.env })

local server = process.create("lune", { "run", "src/index" }, {
env = process.env :: any
})

local ready = false
for i = 1, 10 do
local success = pcall(function()
return Aura.get({ url = "http://localhost:8080", timeout = 500 })
net.request("http://localhost:8080")
end)
if success then ready = true; break end
task.wait(0.5)
end

if not ready then
local out = server.stdout and server.stdout:read() or "no stdout"
local err = server.stderr and server.stderr:read() or "no stderr"
server:kill()
error(`[{name}] Server failed to respond.`)
error(`[{name}] Server failed to respond.\nstdout: {out}\nstderr: {err}`)
end

print(`--- Running: {name} ---`)
Expand Down
Loading
Loading