aboutsummaryrefslogtreecommitdiffstats
path: root/Jenkinsfile
blob: f7f66c7c6c5c7b8a420a83ae8908b7f173e68057 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
pipeline {
    agent any

    stages {
        stage('Build Application Image') {
            steps {
                script {
                    echo 'Building the Lush application Docker image...'
                    // Build the image from the new Dockerfile and tag it
                    sh 'docker build -t lush-app:latest .'
                }
            }
        }
        stage('Compile Project in Container') {
            steps {
                script {
                    echo 'Compiling the Lush project inside the container...'
                    // Run the container to generate Makefiles and compile
                    // We mount the current directory to get the compiled artifacts back out
                    sh 'docker run --rm -v "$(pwd)":/app lush-app:latest'
                    sh 'docker run --rm -v "$(pwd)":/app lush-app:latest make'
                }
            }
        }
        stage('Run Lua 5.2 Compatibility Test') {
            steps {
                script {
                    echo 'Running the Lua 5.2 compatibility test script...'
                    // Create the test script file
                    sh '''
                    cat <<'EOF' > test_52.lua
                    -- Lua 5.2-specific features
                    print("--- Running Lua 5.2 Compatibility Test ---")
                    local _ENV = { print = print, x = 123 } -- lexical environments
                    function show_x()
                        print("x =", x)
                    end
                    show_x()
                    -- Bitwise ops (added in 5.2)
                    local a, b = 0x5, 0x3
                    print("Bitwise AND:", a & b)
                    -- load() replaces loadstring() (binary and text)
                    local f = load("return 10 + 20")
                    print("Loaded result:", f())
                    -- table.pack / table.unpack
                    local t = table.pack(1, 2, 3, nil, 5)
                    print("Packed length:", t.n)
                    print("Unpacked values:", table.unpack(t, 1, t.n))
                    print("--- Test Complete ---")
                    EOF
                    '''
                    // Run the container and execute the test script with the compiled binary
                    sh 'docker run --rm -v "$(pwd)":/app lush-app:latest ./bin/Debug/lush/lush test_52.lua'
                }
            }
        }
    }
    post {
        always {
            echo 'Pipeline finished.'
            // Clean up the created docker image to save space
            sh 'docker rmi lush-app:latest || true'
        }
    }
}