From f5e471ce1ecae44becc86d14047c848225058eb4 Mon Sep 17 00:00:00 2001
From: mrmanlikesbt <99309552+mrmanlikesbt@users.noreply.github.com>
Date: Sun, 21 Jun 2026 21:13:45 -0500
Subject: [PATCH] Adds exclude_from_ci support to unit tests, again (#96545)
## About The Pull Request
When I was working on #96368 I was unaware of the following:
So I'm fixing it.
## Why It's Good For The Game
Sorry downstreams
## Changelog
No user facing changes
---
.github/workflows/ci_suite.yml | 1 +
.github/workflows/collect_data.yml | 17 +++++++++-
.../perform_regular_version_tests.yml | 4 +++
.github/workflows/run_integration_tests.yml | 5 ++-
code/modules/unit_tests/create_and_destroy.dm | 9 +++---
code/modules/unit_tests/unit_test.dm | 7 ++--
config/maps.txt | 2 --
tools/ci/ci_config_maps.txt | 32 -------------------
tools/ci/run_server.sh | 5 ++-
9 files changed, 38 insertions(+), 44 deletions(-)
delete mode 100644 tools/ci/ci_config_maps.txt
diff --git a/.github/workflows/ci_suite.yml b/.github/workflows/ci_suite.yml
index e4201249185..fd311b9de79 100644
--- a/.github/workflows/ci_suite.yml
+++ b/.github/workflows/ci_suite.yml
@@ -52,6 +52,7 @@ jobs:
uses: ./.github/workflows/perform_regular_version_tests.yml
with:
maps: ${{ needs.collect_data.outputs.maps }}
+ map_config: ${{ needs.collect_data.outputs.map_config }}
max_required_byond_client: ${{ needs.collect_data.outputs.max_required_byond_client }}
run_alternate_tests:
diff --git a/.github/workflows/collect_data.yml b/.github/workflows/collect_data.yml
index 2222f519bb2..a1a5fe0657b 100644
--- a/.github/workflows/collect_data.yml
+++ b/.github/workflows/collect_data.yml
@@ -6,6 +6,9 @@ on:
maps:
description: "The maps that were found"
value: ${{ jobs.collect_data.outputs.maps }}
+ map_config:
+ description: "The map config file to use"
+ value: ${{ jobs.collect_data.outputs.map_config }}
alternate_tests:
description: "The alternate tests that were found"
value: ${{ jobs.collect_data.outputs.alternate_tests }}
@@ -22,6 +25,7 @@ jobs:
timeout-minutes: 5
outputs:
maps: ${{ steps.map_finder.outputs.maps }}
+ map_config: ${{ steps.map_finder.outputs.map_config }}
alternate_tests: ${{ steps.alternate_test_finder.outputs.alternate_tests }}
max_required_byond_client: ${{ steps.max_required_byond_client.outputs.max_required_byond_client }}
required_build_versions: ${{ steps.setup_required_build_versions.outputs.required_build_versions }}
@@ -32,16 +36,27 @@ jobs:
id: map_finder
run: |
> maps_output.txt
+ > map_configs.txt
+
for file in _maps/*.json; do
if ! jq -e '.exclude_from_ci == true' "$file" >/dev/null 2>&1; then
- echo "\"$(basename "$file" .json)\"" >> maps_output.txt
+ map_name=$(basename "$file" .json)
+
+ echo "\"$map_name\"" >> maps_output.txt
+ echo "map $map_name" >> map_configs.txt
+ echo "endmap" >> map_configs.txt
else
echo "Excluded: $file"
fi
done
+
map_list=$(paste -sd, maps_output.txt)
echo "Maps: $map_list"
echo "maps={\"paths\":[$map_list]}" >> "$GITHUB_OUTPUT"
+
+ echo "map_config<> "$GITHUB_OUTPUT"
+ cat map_configs.txt >> "$GITHUB_OUTPUT"
+ echo "EOF" >> "$GITHUB_OUTPUT"
- name: Find Alternate Tests
id: alternate_test_finder
run: |
diff --git a/.github/workflows/perform_regular_version_tests.yml b/.github/workflows/perform_regular_version_tests.yml
index 724db11f7df..fee5d249b6e 100644
--- a/.github/workflows/perform_regular_version_tests.yml
+++ b/.github/workflows/perform_regular_version_tests.yml
@@ -6,6 +6,9 @@ on:
maps:
required: true
type: string
+ map_config:
+ required: true
+ type: string
max_required_byond_client:
required: true
type: string
@@ -21,4 +24,5 @@ jobs:
with:
map: ${{ matrix.map }}
+ map_config: ${{ inputs.map_config }}
max_required_byond_client: ${{ inputs.max_required_byond_client }}
diff --git a/.github/workflows/run_integration_tests.yml b/.github/workflows/run_integration_tests.yml
index 2c00db5caf2..320a49f8dcc 100644
--- a/.github/workflows/run_integration_tests.yml
+++ b/.github/workflows/run_integration_tests.yml
@@ -8,6 +8,9 @@ on:
map:
required: true
type: string
+ map_config:
+ required: false
+ type: string
major:
required: false
type: string
@@ -60,7 +63,7 @@ jobs:
id: run_tests
run: |
source $HOME/BYOND/byond/bin/byondsetup
- bash tools/ci/run_server.sh ${{ inputs.map }}
+ bash tools/ci/run_server.sh "${{ inputs.map }}" "${{ inputs.map_config }}"
- name: Upload screenshot tests
if: always()
uses: actions/upload-artifact@v7
diff --git a/code/modules/unit_tests/create_and_destroy.dm b/code/modules/unit_tests/create_and_destroy.dm
index 76feb7b8b01..ed232a6c3ee 100644
--- a/code/modules/unit_tests/create_and_destroy.dm
+++ b/code/modules/unit_tests/create_and_destroy.dm
@@ -20,14 +20,13 @@ GLOBAL_VAR_INIT(running_create_and_destroy, FALSE)
// This code is responsible for splitting up create & destroy across multiple integration tests.
var/total_amount_to_check = length(type_paths_to_check)
- var/runner_count = length(config.maplist)
+ var/runner_count = max(length(config.maplist), 1)
var/split_up_amount = floor(total_amount_to_check / runner_count)
var/what_map_index_are_we = 1
- for(var/map_name, _map_config in config.maplist)
- var/datum/map_config/map_config = _map_config
- if(SSmapping.current_map.map_name == map_config.map_name)
+ for(var/map_name in config.maplist)
+ if(SSmapping.current_map.map_name == map_name)
break
what_map_index_are_we++
@@ -39,7 +38,7 @@ GLOBAL_VAR_INIT(running_create_and_destroy, FALSE)
type_paths_to_check = type_paths_to_check.Copy(start_index, end_index + 1)
log_world("Running create and destroy on [length(type_paths_to_check)] atoms out of the [total_amount_to_check] total")
- log_world("([start_index] [type_paths_to_check[1]]) - ([end_index] [type_paths_to_check[length(type_paths_to_check)]])")
+ log_world("([start_index + 1] [type_paths_to_check[1]]) - ([end_index] [type_paths_to_check[length(type_paths_to_check)]])")
for(var/type_path in type_paths_to_check)
if(ispath(type_path, /turf))
diff --git a/code/modules/unit_tests/unit_test.dm b/code/modules/unit_tests/unit_test.dm
index 0b922c77e01..2b59f15cdf6 100644
--- a/code/modules/unit_tests/unit_test.dm
+++ b/code/modules/unit_tests/unit_test.dm
@@ -378,7 +378,7 @@ GLOBAL_VAR_INIT(focused_tests, focused_tests())
primary_unit_test_map = map_config
if(!LAZYLEN(map_config.skipped_tests) && !found_secondary_unit_test_map)
found_secondary_unit_test_map = TRUE
- if(SSmapping.current_map.map_name == map_config.map_name)
+ if(SSmapping.current_map.map_name == map_name)
is_secondary_unit_test_map = TRUE
var/list/tests_to_run = list()
@@ -386,7 +386,10 @@ GLOBAL_VAR_INIT(focused_tests, focused_tests())
for (var/datum/unit_test/potential_test as anything in subtypesof(/datum/unit_test))
// If the test has [UNIT_TEST_DEBUG_MAP_ONLY] and we aren't the primary unit test map, skip it.
// HOWEVER, some unit tests are incompatible with the primary testing map, so we must offload them a secondary one with no blacklisted tests.
- if((potential_test::test_flags & UNIT_TEST_DEBUG_MAP_ONLY) && !SSmapping.current_map.is_unit_test_map && \
+ // If we didn't find a primary unit test map then we are likely a solo runner.
+ if((potential_test::test_flags & UNIT_TEST_DEBUG_MAP_ONLY) && \
+ !isnull(primary_unit_test_map) && \
+ !SSmapping.current_map.is_unit_test_map && \
!(primary_unit_test_map.skipped_tests?.Find(potential_test) && is_secondary_unit_test_map) \
)
continue
diff --git a/config/maps.txt b/config/maps.txt
index d9d967b5477..5d28fffeb27 100644
--- a/config/maps.txt
+++ b/config/maps.txt
@@ -15,8 +15,6 @@ Format:
webmap_url (link to the a webmap to see the map in the user's browser)
endmap
-# When adding or removing maps be sure to also add/remove from ci_config_maps.txt
-
# Production-level maps.
map deltastation
diff --git a/tools/ci/ci_config_maps.txt b/tools/ci/ci_config_maps.txt
deleted file mode 100644
index b9dc69d4e68..00000000000
--- a/tools/ci/ci_config_maps.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-map deltastation
-endmap
-
-map icebox
-endmap
-
-map catwalkstation
-endmap
-
-map metastation
-endmap
-
-map tramstation
-endmap
-
-map nebulastation
-endmap
-
-map wawastation
-endmap
-
-map gateway_test
-endmap
-
-map multiz_debug
-endmap
-
-map runtimestation
-endmap
-
-map runtimestation_minimal
-endmap
diff --git a/tools/ci/run_server.sh b/tools/ci/run_server.sh
index e55b9a987ee..0240a6deb26 100644
--- a/tools/ci/run_server.sh
+++ b/tools/ci/run_server.sh
@@ -2,6 +2,7 @@
set -euo pipefail
MAP=$1
+MAP_CONFIG=${2:-""}
echo Testing $MAP
@@ -11,7 +12,9 @@ mkdir -p ci_test/data
#test config
cp tools/ci/ci_config.txt ci_test/config/config.txt
-cp tools/ci/ci_config_maps.txt ci_test/config/maps.txt
+if [ -n "$MAP_CONFIG" ]; then
+ echo "$MAP_CONFIG" > ci_test/config/maps.txt
+fi
#set the map
cp _maps/$MAP.json ci_test/data/next_map.json