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
31 changes: 30 additions & 1 deletion .github/workflows/port-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ jobs:
# The caller's tooling can document an older selected source revision.
# Record both checkouts before either native exporter produces files.
- name: Check out native documentation tooling
if: matrix.port == 'powershell' || matrix.port == 'julia'
if: matrix.port == 'powershell' || matrix.port == 'julia' || matrix.port == 'lua'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# A port caller's generator is its own tooling at the caller's commit.
Expand All @@ -213,6 +213,10 @@ jobs:
path: docs-generator
persist-credentials: false

- name: Record the Lua documentation tooling checkout
if: matrix.port == 'lua'
run: echo "LIBTMUX_DOCS_GENERATOR_CHECKOUT=$GITHUB_WORKSPACE/docs-generator" >> "$GITHUB_ENV"

- name: Read native documentation toolchain
if: matrix.port == 'powershell' || matrix.port == 'julia'
id: docs-runtime
Expand Down Expand Up @@ -685,6 +689,31 @@ jobs:
if: matrix.port == 'raku'
run: zef install --/test JSON::Fast

- name: Install the selected Lua tooling
if: matrix.port == 'lua'
uses: jdx/mise-action@3277a0f272901982804abc53abd93520db809be4 # v5.4.0
with:
version: 2026.9.9
working_directory: docs-generator
cache: false
- name: Bootstrap the pinned LuaLS exporter and its LuaJIT
if: matrix.port == 'lua'
working-directory: docs-generator
run: |
set -euo pipefail
lua scripts/bootstrap/bootstrap.lua runtimes luajit
lua scripts/bootstrap/bootstrap.lua rocks dev live --lua=.cache/toolchains/luajit-2.1/bin/luajit
lua scripts/bootstrap/bootstrap.lua luals
- name: Export Lua API from the selected source
if: matrix.port == 'lua'
working-directory: docs-generator
run: |
set -euo pipefail
.cache/toolchains/luajit-2.1/bin/luajit scripts/docs/docs.lua export \
--source "$GITHUB_WORKSPACE/port" \
--luals "$GITHUB_WORKSPACE/docs-generator/.cache/tools/luals-3.19.1/bin/lua-language-server" \
--output "$GITHUB_WORKSPACE/port/docs/_build"

- name: Install Common Lisp documentation toolchain
if: matrix.port == 'lisp'
uses: jdx/mise-action@3277a0f272901982804abc53abd93520db809be4 # v5.4.0
Expand Down
4 changes: 4 additions & 0 deletions docs/ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ record itself is excluded from the inventory; symlinks are rejected.
Ruby and Lua also record `nativeGenerator`: the native exporter's repository,
commit, and dirty state. Their custom callers keep the source, exporter, and
shared docs in separate checkouts and set `LIBTMUX_DOCS_GENERATOR_CHECKOUT`.
The reusable `port-docs.yml` Lua job uses the same layout. A Lua caller can
build an older revision with the exporter from its own workflow commit. To
build a release that used a shell launcher, select a Lua tooling revision
whose exporter accepts that release's manifest.
Local native builds default to the exporter in the selected source checkout.
The publisher requires a clean exporter from the port's owning repository.

Expand Down
45 changes: 45 additions & 0 deletions site/test/port-docs-runtime.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,51 @@ require('node:fs').appendFileSync(process.env.EXPORT_CALLS, JSON.stringify({ too
})
})

describe('Lua documentation producer', () => {
it('exports with the tooling checkout after the snapshot and before assembly', () => {
const step = (name: string) => workflow.split(/\n(?= - )/).find((value) => value.includes(`name: ${name}\n`))!
const at = (name: string) => workflow.indexOf(`name: ${name}\n`)
const snapshot = at('Snapshot source inputs before native generation')
const names = ['Install the selected Lua tooling', 'Bootstrap the pinned LuaLS exporter and its LuaJIT', 'Export Lua API from the selected source']
expect(at('Record the Lua documentation tooling checkout')).toBeLessThan(snapshot)
const order = [snapshot, ...names.map(at), at("Build this port's tree")]
expect(order).toEqual(order.toSorted((a, b) => a - b))
expect(order[0]).toBeGreaterThan(-1)
expect(step('Check out native documentation tooling')).toContain("matrix.port == 'lua'")
expect(step('Check out native documentation tooling')).toContain("ref: ${{ inputs.source-repository && needs.identity.outputs.source-ref || github.sha }}")
for (const name of names) expect(step(name)).toContain("if: matrix.port == 'lua'")
for (const name of names.slice(1)) expect(step(name)).toContain('working-directory: docs-generator')
expect(step(names[0])).toContain('working_directory: docs-generator')
expect(step('Record the Lua documentation tooling checkout')).toContain('LIBTMUX_DOCS_GENERATOR_CHECKOUT=$GITHUB_WORKSPACE/docs-generator')
expect(script('Export Lua API from the selected source')).toContain('scripts/docs/docs.lua export')
expect(script('Export Lua API from the selected source')).toContain('--output "$GITHUB_WORKSPACE/port/docs/_build"')
})

it.each([0, 23])('runs the Lua exporter with source and output paths intact and propagates exit %s', (exitCode) => {
const workspace = mkdtempSync(join(tmpdir(), 'libtmux Lua workflow '))
const generator = join(workspace, 'docs-generator')
const runtime = join(generator, '.cache/toolchains/luajit-2.1/bin')
try {
mkdirSync(runtime, { recursive: true })
writeFileSync(join(runtime, 'luajit'), `#!${process.execPath}
process.stdout.write(JSON.stringify(process.argv.slice(2)))
process.exitCode = ${exitCode}
`, { mode: 0o700 })
const result = spawnSync('bash', ['-e', '-c', script('Export Lua API from the selected source')], {
cwd: generator, encoding: 'utf8', timeout: 5000,
env: { ...process.env, GITHUB_WORKSPACE: workspace },
})
expect(result.status, result.stderr).toBe(exitCode)
expect(JSON.parse(result.stdout)).toEqual([
'scripts/docs/docs.lua', 'export',
'--source', join(workspace, 'port'),
'--luals', join(generator, '.cache/tools/luals-3.19.1/bin/lua-language-server'),
'--output', join(workspace, 'port/docs/_build'),
])
} finally { rmSync(workspace, { recursive: true, force: true }) }
})
})

describe('Erlang documentation producer', () => {
function toolchain(source?: string) {
const directory = mkdtempSync(join(tmpdir(), 'libtmux-erlang-toolchain-'))
Expand Down
Loading