From 8a8f91d99d88c13680720c763723024f0a961e7c Mon Sep 17 00:00:00 2001 From: DatTT127 Date: Thu, 16 Jul 2026 22:34:16 +0700 Subject: [PATCH] update the test_gitea --- .gitea/workflows/test_secret.yaml | 14 ++++---- .../deps/implementation/test_worker.py | 33 +++++++++++++++++++ 2 files changed, 39 insertions(+), 8 deletions(-) create mode 100644 workspace/sprint_1_2/CODEBASE/deps/implementation/test_worker.py diff --git a/.gitea/workflows/test_secret.yaml b/.gitea/workflows/test_secret.yaml index cbf465c..9caf93c 100644 --- a/.gitea/workflows/test_secret.yaml +++ b/.gitea/workflows/test_secret.yaml @@ -5,11 +5,9 @@ jobs: print-secret: runs-on: ubuntu-latest steps: - - name: Print Secret - env: - # Map the Gitea secret to an environment variable - MY_TEST_SECRET: ${{ secrets.MODAL_KEY }} - run: | - # Use 'echo' to print the variable - # Gitea will automatically mask the actual value if it matches a secret - echo "The secret value is: $MY_TEST_SECRET" \ No newline at end of file + - name: test modal worker pipeline + uses: actions/checkout@v4 + with: + sparse-checkout: | + cd workspace/sprint_1_2/CODEBASE/deps/implementation + modal deploy test_worker.py \ No newline at end of file diff --git a/workspace/sprint_1_2/CODEBASE/deps/implementation/test_worker.py b/workspace/sprint_1_2/CODEBASE/deps/implementation/test_worker.py new file mode 100644 index 0000000..a2d0842 --- /dev/null +++ b/workspace/sprint_1_2/CODEBASE/deps/implementation/test_worker.py @@ -0,0 +1,33 @@ +import modal +import subprocess + +# 1. Define the App +app = modal.App("hello-world-build-worker") + +# 2. Define a clean container image representing your worker environment +image = modal.Image.debian_slim().pip_install("requests") + +# 3. Define the worker function +@app.function( + image=image, + # This keeps the worker container alive for 5 minutes after finishing, + # so subsequent runs start instantly (avoiding cold starts). + scaledown_window=300 +) +def run_worker_job(): + print("--- WORKER CONTAINER STARTED ---") + + # Mimic fetching project files or setting up environment variables + test_env_var = "Lumina-Build-Sandbox" + print(f"Environment initialized. Target deployment: {test_env_var}") + + # Run a simple shell command inside the container to mimic building/testing + print("Running build script simulation...") + result = subprocess.run( + ["echo", "Hello World! Your Modal container is successfully building your Python app."], + capture_output=True, + text=True + ) + + print(f"Build output: {result.stdout.strip()}") + print("--- WORKER JOB COMPLETED SUCCESSFULLY ---") \ No newline at end of file