Commit e1524007 by Jonathan Thomas

Adding tests to GitLab CI, and adding new API_MODEL env variable for testing

parent 1239de66
Pipeline #12448 passed with stages
in 2 minutes 27 seconds
...@@ -9,6 +9,7 @@ cache: ...@@ -9,6 +9,7 @@ cache:
stages: stages:
- build - build
- test
- deploy - deploy
# Build JAR files for each Minecraft & Fabric version # Build JAR files for each Minecraft & Fabric version
...@@ -63,6 +64,27 @@ build_mod: ...@@ -63,6 +64,27 @@ build_mod:
tags: tags:
- minecraft - minecraft
# Optional test (gpt 3.5)
test_gpt_35:
stage: test
script:
- echo "Running tests with `gpt-3.5-turbo`"
- ./gradlew test
when: manual
tags:
- test
# Optional test (gpt 4o)
test_gpt_4o:
stage: test
script:
- echo "Running tests with `gpt-4o`"
- export API_MODEL="gpt-4o"
- ./gradlew test
when: manual
tags:
- test
# Deploy to Modrinth # Deploy to Modrinth
Modrinth: Modrinth:
stage: deploy stage: deploy
......
...@@ -35,6 +35,7 @@ public class BehaviorTests { ...@@ -35,6 +35,7 @@ public class BehaviorTests {
static String RESOURCE_PATH = "src/test/resources/data/creaturechat/"; static String RESOURCE_PATH = "src/test/resources/data/creaturechat/";
static String API_KEY = ""; static String API_KEY = "";
static String API_URL = ""; static String API_URL = "";
static String API_MODEL = "";
String NO_API_KEY = "No API_KEY environment variable has been set."; String NO_API_KEY = "No API_KEY environment variable has been set.";
ConfigurationHandler.Config config = null; ConfigurationHandler.Config config = null;
...@@ -72,6 +73,7 @@ public class BehaviorTests { ...@@ -72,6 +73,7 @@ public class BehaviorTests {
// Get API key from env var // Get API key from env var
API_KEY = System.getenv("API_KEY"); API_KEY = System.getenv("API_KEY");
API_URL = System.getenv("API_URL"); API_URL = System.getenv("API_URL");
API_MODEL = System.getenv("API_MODEL");
// Config // Config
config = new ConfigurationHandler.Config(); config = new ConfigurationHandler.Config();
...@@ -81,6 +83,9 @@ public class BehaviorTests { ...@@ -81,6 +83,9 @@ public class BehaviorTests {
if (API_URL != null && !API_URL.isEmpty()) { if (API_URL != null && !API_URL.isEmpty()) {
config.setUrl(API_URL); config.setUrl(API_URL);
} }
if (API_MODEL != null && !API_MODEL.isEmpty()) {
config.setModel(API_MODEL);
}
// Verify API key is set correctly // Verify API key is set correctly
assertNotNull(API_KEY, NO_API_KEY); assertNotNull(API_KEY, NO_API_KEY);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment