Skip to content

Commit d74d4d2

Browse files
Nicellvrn-sn
andauthored
Run tests in CI (#290)
Co-authored-by: Varun Saini <61795485+vrn-sn@users.noreply.github.com>
1 parent aee8ec3 commit d74d4d2

File tree

6 files changed

+39
-20
lines changed

6 files changed

+39
-20
lines changed

.github/actions/setup-and-build/action.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
name: "Setup and Build Lute"
2-
description: "Install dependencies, configure and build Lute"
1+
name: "Setup and Build"
2+
description: "Install dependencies, configure and build target"
33

44
inputs:
5+
target:
6+
description: "Which target to build"
7+
required: true
58
config:
69
description: "Build configuration (debug or release)"
710
required: false
@@ -57,23 +60,23 @@ runs:
5760
path: extern
5861
key: extern-${{ hashFiles('extern/*.tune') }}
5962

60-
- name: Fetch Lute
63+
- name: Fetch ${{ inputs.target }}
6164
if: steps.cache-extern.outputs.cache-hit != 'true'
6265
shell: bash
63-
run: lute ./tools/luthier.luau fetch lute
66+
run: lute ./tools/luthier.luau fetch ${{ inputs.target }}
6467

65-
- name: Configure Lute
68+
- name: Configure ${{ inputs.target }}
6669
shell: bash
67-
run: lute ./tools/luthier.luau configure lute --config ${{ inputs.config }} ${{ inputs.options }}
70+
run: lute ./tools/luthier.luau configure ${{ inputs.target }} --config ${{ inputs.config }} ${{ inputs.options }}
6871

69-
- name: Build Lute
72+
- name: Build ${{ inputs.target }}
7073
shell: bash
71-
run: lute ./tools/luthier.luau build lute --config ${{ inputs.config }} ${{ inputs.options }}
74+
run: lute ./tools/luthier.luau build ${{ inputs.target }} --config ${{ inputs.config }} ${{ inputs.options }}
7275

7376
- name: Get Artifact Path
7477
id: artifact_path
7578
shell: bash
7679
run: |
77-
exe_path=$(lute ./tools/luthier.luau build lute --config ${{ inputs.config }} --which)
80+
exe_path=$(lute ./tools/luthier.luau build ${{ inputs.target }} --config ${{ inputs.config }} --which)
7881
echo "Executable path: $exe_path" # Debug print
7982
echo "exe_path=$exe_path" >> "$GITHUB_OUTPUT"

.github/workflows/ci.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,30 @@ jobs:
2828
- name: Setup and Build Lute
2929
uses: ./.github/actions/setup-and-build
3030
with:
31+
target: Lute.CLI
3132
config: debug
3233
options: ${{ matrix.options }}
3334
token: ${{ secrets.GITHUB_TOKEN }}
3435

36+
test:
37+
runs-on: ubuntu-latest
38+
39+
steps:
40+
- name: Checkout code
41+
uses: actions/checkout@v4
42+
43+
- name: Setup and Build Tests
44+
id: build_tests
45+
uses: ./.github/actions/setup-and-build
46+
with:
47+
target: Lute.Test
48+
config: debug
49+
options: --c-compiler clang --cxx-compiler clang++
50+
token: ${{ secrets.GITHUB_TOKEN }}
51+
52+
- name: Run Tests
53+
run: ${{ steps.build_tests.outputs.exe_path }}
54+
3555
check-format:
3656
runs-on: ubuntu-latest
3757

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ jobs:
8080
id: build_lute
8181
uses: ./.github/actions/setup-and-build
8282
with:
83+
target: Lute.CLI
8384
config: release
8485
options: ${{ matrix.options }}
8586
token: ${{ secrets.GITHUB_TOKEN }}

tests/src/require.test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include "Luau/Require.h"
77
#include "lualib.h"
88

9+
#include <memory>
10+
911
class LuaStateFixture
1012
{
1113
public:

tools/luthier.luau

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -271,18 +271,14 @@ local function call(cmd: { string }, passedCwd: string?): number
271271
end
272272

273273
local function build()
274-
local targetName = args:get("target")
274+
local exeName = getExeName(args:get("target"))
275275
local projectPath = getProjectPath()
276276

277-
if isWindows then
278-
targetName ..= ".exe"
279-
end
280-
281277
if args:has("clean") then
282278
call({ "ninja", "-C", projectPath, "clean" })
283279
end
284280

285-
local cmd = { "ninja", "-C", projectPath, targetName }
281+
local cmd = { "ninja", "-C", projectPath, exeName }
286282

287283
return call(cmd)
288284
end

tools/luthier.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -313,20 +313,17 @@ def call(*args):
313313
return sp.call(*args, env=env)
314314

315315
def build(args):
316-
targetName = args.target
316+
exeName = getExeName(args.target)
317317
projectPath = getProjectPath(args)
318318

319-
if isWindows:
320-
targetName = targetName + '.exe'
321-
322319
if args.clean:
323320
call(['ninja', '-C', projectPath, 'clean'])
324321

325322
cmd = [
326323
'ninja',
327324
'-C',
328325
projectPath,
329-
targetName
326+
exeName
330327
]
331328

332329
return call(cmd)

0 commit comments

Comments
 (0)