From 8e69247666fffb7db4b4b0a610a2461d635b0065 Mon Sep 17 00:00:00 2001 From: Andrew D. France Date: Tue, 22 Jul 2025 21:20:42 -0500 Subject: This file defines the environment for the lush application: Attempt4 --- Dockerfile | 26 ++++++++++++++++++++++++++ Jenkinsfile | 35 ++++++++++++++++++----------------- 2 files changed, 44 insertions(+), 17 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d281f46 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +# Use a base image with build tools +FROM ubuntu:22.04 + +# Avoid interactive prompts during package installation +ENV DEBIAN_FRONTEND=noninteractive + +# Install necessary build tools for your C project +RUN apt-get update && apt-get install -y \ + build-essential \ + wget \ + unzip \ + && rm -rf /var/lib/apt/lists/* + +# Download and install Premake5 +RUN wget https://github.com/premake/premake-core/releases/download/v5.0.0-beta2/premake-5.0.0-beta2-linux.tar.gz -O premake.tar.gz && \ + tar -xvf premake.tar.gz && \ + mv premake5 /usr/local/bin/ + +# Set the working directory inside the container +WORKDIR /app + +# Copy your project's source code into the container +COPY . . + +# Generate the makefiles. This will be the default action if no other command is given. +CMD ["premake5", "gmake2"] diff --git a/Jenkinsfile b/Jenkinsfile index 83be0ac..f7f66c7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,35 +2,35 @@ pipeline { agent any stages { - stage('Build Docker Image') { + stage('Build Application Image') { steps { script { - echo 'Building the Docker image...' - // Build the Docker image from the Dockerfile.jenkins in the current directory - // and tag it as 'lush-arch-test' - sh 'docker build -f Dockerfile.jenkins -t lush-arch-test .' + 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('Run Tests in Container') { + stage('Compile Project in Container') { steps { script { - echo 'Running tests inside the Docker container...' - // Run the container with the 'lush-arch-test' image. - // The CMD in the Dockerfile will be executed. - // --rm automatically removes the container when it exits. - sh 'docker run --rm lush-arch-test' + 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 Owner-Provided Test Script') { + stage('Run Lua 5.2 Compatibility Test') { steps { script { echo 'Running the Lua 5.2 compatibility test script...' - // First, create the test script file + // 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) @@ -45,11 +45,12 @@ pipeline { -- table.pack / table.unpack local t = table.pack(1, 2, 3, nil, 5) print("Packed length:", t.n) - print("Unpacked values:", table.unpack(t)) + print("Unpacked values:", table.unpack(t, 1, t.n)) + print("--- Test Complete ---") EOF ''' - // Run the container and execute the owner's test script - sh 'docker run --rm -v $(pwd)/test_52.lua:/app/test_52.lua lush-arch-test ./bin/Debug/lush/lush test_52.lua' + // 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' } } } @@ -58,7 +59,7 @@ pipeline { always { echo 'Pipeline finished.' // Clean up the created docker image to save space - sh 'docker rmi lush-arch-test || true' + sh 'docker rmi lush-app:latest || true' } } } -- cgit v1.2.3-59-g8ed1b