From b0aee42414f4ae9cafca3c2025d8eca73c8bf5c1 Mon Sep 17 00:00:00 2001
From: afnanramadhan <13521011@std.stei.itb.ac.id>
Date: Tue, 7 Jan 2025 16:52:12 +0700
Subject: [PATCH] feat: add test file and gitlab-ci

---
 .gitlab-ci.yml   | 14 ++++++++++++++
 requirements.txt |  1 +
 test.py          | 15 +++++++++++++++
 3 files changed, 30 insertions(+)
 create mode 100644 .gitlab-ci.yml
 create mode 100644 requirements.txt
 create mode 100644 test.py

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..56f235f
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,14 @@
+before_script:
+  - if [ ! -d "venv" ]; then python3 -m venv .venv; fi
+  - source .venv/bin/activate
+  - pip install -r requirements.txt
+
+test_job:
+  stage: test
+  tags:
+    - macos
+  only:
+    - main
+  script:
+    - echo "Running tests"
+    - .venv/bin/python test.py
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..e214769
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1 @@
+pyspark
diff --git a/test.py b/test.py
new file mode 100644
index 0000000..7879e99
--- /dev/null
+++ b/test.py
@@ -0,0 +1,15 @@
+from pyspark.sql import SparkSession
+
+spark = SparkSession.builder.appName("demo").getOrCreate()
+
+df = spark.createDataFrame(
+    [
+        ("sue", 32),
+        ("li", 3),
+        ("bob", 75),
+        ("heo", 13),
+    ],
+    ["first_name", "age"],
+)
+
+df.show()
\ No newline at end of file
-- 
GitLab