From 8127df2a566b60313532f73a613439729a71578c Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Mon, 11 Dec 2023 18:44:05 -0600 Subject: [PATCH] Splits unit tests into MULTIPLE concurrent jobs (#2487) ## About The Pull Request See title. ## Why It's Good For The Game It's a pain to have to wait that long to merge a PR. Like come on. ## Changelog :cl: /:cl: --- .github/workflows/ci_suite.yml | 12 +++++++++ .github/workflows/run_integration_tests.yml | 6 ++++- code/_compile_options.dm | 9 +++++++ code/modules/unit_tests/_unit_tests.dm | 27 +++++++++++++++++---- 4 files changed, 48 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci_suite.yml b/.github/workflows/ci_suite.yml index 54384fb14e95..591415f67705 100644 --- a/.github/workflows/ci_suite.yml +++ b/.github/workflows/ci_suite.yml @@ -94,7 +94,19 @@ jobs: run_all_tests: if: "!contains(github.event.head_commit.message, '[ci skip]')" name: Integration Tests + strategy: + fail-fast: true + matrix: + arg: [ + "BASIC_TESTS", + "CREATE_AND_DESTROY_TEST", + "PLANET_GEN_TEST", + "RUIN_PLACEMENT_TEST", + "SHIP_PLACEMENT_TEST" + ] uses: ./.github/workflows/run_integration_tests.yml + with: + arg: ${{ matrix.arg }} # run_alternate_tests: # if: "!contains(github.event.head_commit.message, '[ci skip]')" diff --git a/.github/workflows/run_integration_tests.yml b/.github/workflows/run_integration_tests.yml index 53f5df377591..a361ecedc588 100644 --- a/.github/workflows/run_integration_tests.yml +++ b/.github/workflows/run_integration_tests.yml @@ -10,6 +10,10 @@ on: minor: required: false type: string + arg: + required: false + default: ALL_TESTS + type: string jobs: run_integration_tests: runs-on: ubuntu-latest @@ -54,7 +58,7 @@ jobs: run: | bash tools/ci/install_byond.sh source $HOME/BYOND/byond/bin/byondsetup - tools/build/build --ci dm -DCIBUILDING -DANSICOLORS + tools/build/build --ci dm -DCIBUILDING -DANSICOLORS -D${{ inputs.arg }} - name: Run Tests run: | source $HOME/BYOND/byond/bin/byondsetup diff --git a/code/_compile_options.dm b/code/_compile_options.dm index 4f96217abd2c..419abcd6be70 100644 --- a/code/_compile_options.dm +++ b/code/_compile_options.dm @@ -42,6 +42,7 @@ #endif // REFERENCE_DOING_IT_LIVE //#define UNIT_TESTS //Enables unit tests via TEST_RUN_PARAMETER +//#define ALL_TESTS //Enables all tests, including the ones that take a long time to run #ifndef PRELOAD_RSC //set to: #define PRELOAD_RSC 2 // 0 to allow using external resources or on-demand behaviour; @@ -78,6 +79,14 @@ #define GC_FAILURE_HARD_LOOKUP #endif +#ifdef ALL_TESTS +#define BASIC_TESTS +#define CREATE_AND_DESTROY_TEST +#define PLANET_GEN_TEST +#define RUIN_PLACEMENT_TEST +#define SHIP_PLACEMENT_TEST +#endif + // A reasonable number of maximum overlays an object needs // If you think you need more, rethink it #define MAX_ATOM_OVERLAYS 100 diff --git a/code/modules/unit_tests/_unit_tests.dm b/code/modules/unit_tests/_unit_tests.dm index cc12fe0c638f..d4bfa21201be 100644 --- a/code/modules/unit_tests/_unit_tests.dm +++ b/code/modules/unit_tests/_unit_tests.dm @@ -62,6 +62,8 @@ #define TEST_OUTPUT_GREEN(text) (text) #endif +#ifdef BASIC_TESTS + #include "anchored_mobs.dm" #include "autowiki.dm" #include "bespoke_id.dm" @@ -69,7 +71,6 @@ #include "combat.dm" #include "component_tests.dm" #include "connect_loc.dm" -#include "create_and_destroy.dm" #include "biome_lists.dm" #include "emoting.dm" #include "keybinding_init.dm" @@ -78,7 +79,6 @@ #include "outfit_sanity.dm" #include "overmap.dm" #include "pills.dm" -#include "planet_gen.dm" #include "plantgrowth_tests.dm" #include "projectiles.dm" #include "quick_swap_sanity.dm" @@ -90,10 +90,8 @@ #include "reagent_names.dm" #include "reagent_recipe_collisions.dm" #include "resist.dm" -#include "ruin_placement.dm" #include "say.dm" #include "serving_tray.dm" -#include "ship_outpost_placement.dm" #include "spawn_humans.dm" #include "species_unique_id.dm" #include "species_whitelists.dm" @@ -103,12 +101,31 @@ #include "supply_pack.dm" #include "teleporters.dm" #include "timer_sanity.dm" -#include "unit_test.dm" #ifdef REFERENCE_TRACKING_DEBUG //Don't try and parse this file if ref tracking isn't turned on. IE: don't parse ref tracking please mr linter #include "find_reference_sanity.dm" #endif +#endif //BASIC_TESTS + +#ifdef CREATE_AND_DESTROY_TEST +#include "create_and_destroy.dm" +#endif //CREATE_AND_DESTROY_TEST + +#ifdef PLANET_GEN_TEST +#include "planet_gen.dm" +#endif //PLANET_GEN + +#ifdef RUIN_PLACEMENT_TEST +#include "ruin_placement.dm" +#endif //RUIN_PLACEMENT_TEST + +#ifdef SHIP_PLACEMENT_TEST +#include "ship_outpost_placement.dm" +#endif //SHIP_PLACEMENT_TEST + +#include "unit_test.dm" + #undef TEST_ASSERT #undef TEST_ASSERT_EQUAL #undef TEST_ASSERT_NOTEQUAL