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:
stages:
- build
- test
- deploy
# Build JAR files for each Minecraft & Fabric version
......@@ -63,6 +64,27 @@ build_mod:
tags:
- 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
Modrinth:
stage: deploy
......
......@@ -35,6 +35,7 @@ public class BehaviorTests {
static String RESOURCE_PATH = "src/test/resources/data/creaturechat/";
static String API_KEY = "";
static String API_URL = "";
static String API_MODEL = "";
String NO_API_KEY = "No API_KEY environment variable has been set.";
ConfigurationHandler.Config config = null;
......@@ -72,6 +73,7 @@ public class BehaviorTests {
// Get API key from env var
API_KEY = System.getenv("API_KEY");
API_URL = System.getenv("API_URL");
API_MODEL = System.getenv("API_MODEL");
// Config
config = new ConfigurationHandler.Config();
......@@ -81,6 +83,9 @@ public class BehaviorTests {
if (API_URL != null && !API_URL.isEmpty()) {
config.setUrl(API_URL);
}
if (API_MODEL != null && !API_MODEL.isEmpty()) {
config.setModel(API_MODEL);
}
// Verify API key is set correctly
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