Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codecov #2

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
coverage:
status:
project:
default:
informational: true
patch: off
comment: false
ignore:
- "code/modules/unit_tests"
68 changes: 0 additions & 68 deletions .github/workflows/ci_suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,74 +5,6 @@ on:
- master
merge_group:
jobs:
run_linters:
if: "!contains(github.event.head_commit.message, '[ci skip]')"
name: Run Linters
runs-on: ubuntu-latest
concurrency:
group: run_linters-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v3
- name: Restore SpacemanDMM cache
uses: actions/cache@v3
with:
path: ~/SpacemanDMM
key: ${{ runner.os }}-spacemandmm-${{ secrets.CACHE_PURGE_KEY }}
- name: Restore Yarn cache
uses: actions/cache@v3
with:
path: tgui/.yarn/cache
key: ${{ runner.os }}-yarn-${{ secrets.CACHE_PURGE_KEY }}-${{ hashFiles('tgui/yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-
${{ runner.os }}-
- name: Restore Rust cache
uses: actions/cache@v3
with:
path: ~/.cargo
key: ${{ runner.os }}-rust
restore-keys: |
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install Tools
run: |
pip3 install setuptools
bash tools/ci/install_node.sh
bash tools/ci/install_spaceman_dmm.sh dreamchecker
cargo install ripgrep --features pcre2
tools/bootstrap/python -c ''
- name: Run Linters
run: |
bash tools/ci/check_filedirs.sh colonialmarines.dme
bash tools/ci/check_changelogs.sh
bash tools/ci/check_grep.sh
bash tools/ci/check_misc.sh
tools/bootstrap/python tools/ci/validate_dme.py < colonialmarines.dme
tools/bootstrap/python -m tools.maplint.source --github
tools/build/build --ci lint tgui-test
tools/bootstrap/python -m dmi.test
tools/bootstrap/python -m mapmerge2.dmm_test
~/dreamchecker > ${GITHUB_WORKSPACE}/output-annotations.txt 2>&1
- name: Annotate Lints
uses: yogstation13/DreamAnnotate@v2
if: success() || failure()
with:
outputFile: output-annotations.txt


odlint:
name: Lint with OpenDream
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: robinraju/[email protected]
with:
repository: "OpenDreamProject/OpenDream"
tag: "latest"
fileName: "DMCompiler_linux-x64.tar.gz"
extract: true
- run: ./DMCompiler_linux-x64/DMCompiler --suppress-unimplemented colonialmarines.dme

compile_all_maps:
if: "!contains(github.event.head_commit.message, '[ci skip]')"
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/run_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ jobs:
sudo apt update || true
sudo apt install -o APT::Immediate-Configure=false zlib1g-dev:i386 libssl-dev:i386
bash tools/ci/install_rust_g.sh
- name: Install auxlua
run: |
bash tools/ci/install_auxlua.sh
- name: Configure version
run: |
echo "BYOND_MAJOR=${{ inputs.major }}" >> $GITHUB_ENV
Expand All @@ -43,3 +46,7 @@ jobs:
run: |
source $HOME/BYOND/byond/bin/byondsetup
bash tools/ci/run_server.sh ${{ inputs.map }}
- name: Upload Code Coverage
uses: codecov/codecov-action@v3
with:
files: ci_test/code_coverage.xml
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,11 @@ libprof.so

# OpenDream compatibility stuff
colonialmarines.json

# From auxtools code coverage
code_coverage.xml

# Built auxtools libraries and intermediate files
#aux*.dll
#libaux*.so
#aux*.pdb
14 changes: 13 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@
"preLaunchTask": "Build All",
"dmb": "${workspaceFolder}/${command:CurrentDMB}",
"dreamDaemon": true
}
},
{
"name": "Debug External Libraries",
"type": "cppvsdbg",
"request": "launch",
"program": "${command:dreammaker.returnDreamDaemonPath}",
"cwd": "${workspaceRoot}",
"args": [
"${command:dreammaker.getFilenameDmb}",
"-trusted"
],
"preLaunchTask": "Build All"
}
]
}
Binary file added auxlua-coverage.dll
Binary file not shown.
15 changes: 0 additions & 15 deletions code/__DEFINES/__spacemandmm.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,3 @@
#define VAR_PRIVATE var
#define VAR_PROTECTED var
#endif

/proc/auxtools_stack_trace(msg)
CRASH(msg)

/proc/enable_debugging(mode, port)
CRASH("auxtools not loaded")

/proc/auxtools_expr_stub()
CRASH("auxtools not loaded")

/world/Del()
var/debug_server = world.GetConfig("env", "AUXTOOLS_DEBUG_DLL")
if (debug_server)
call_ext(debug_server, "auxtools_shutdown")()
. = ..()
14 changes: 14 additions & 0 deletions code/__HELPERS/auxtools.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/// Macro for getting the auxtools library file
#define AUXLIB(name) (world.system_type == MS_WINDOWS ? "[#name].dll" : __detect_auxtools(#name))
#define AUXLUA AUXLIB(auxlua)
#define AUXTOOLS AUXLIB(debug_server)

/proc/__detect_auxtools(library)
if(IsAdminAdvancedProcCall())
return
if (fexists("./lib[library].so"))
return "./lib[library].so"
if (fexists("[world.GetConfig("env", "HOME")]/.byond/bin/lib[library].so"))
return "[world.GetConfig("env", "HOME")]/.byond/bin/lib[library].so"

log_world("Could not find lib[library].so!")
62 changes: 62 additions & 0 deletions code/__HELPERS/auxtools_api.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#define AUXTOOLS_FULL_INIT 2
#define AUXTOOLS_PARTIAL_INIT 1

GLOBAL_LIST(auxtools_initialized)
GLOBAL_PROTECT(auxtools_initialized)

#define AUXTOOLS_CHECK_NO_CONFIG(LIB)\
LAZYINITLIST(GLOB.auxtools_initialized);\
if (GLOB.auxtools_initialized[LIB] != AUXTOOLS_FULL_INIT) {\
if (fexists(LIB)) {\
var/string = LIBCALL(LIB,"auxtools_init")();\
if(findtext(string, "SUCCESS")) {\
GLOB.auxtools_initialized[LIB] = AUXTOOLS_FULL_INIT;\
} else {\
CRASH(string);\
}\
} else {\
CRASH("No file named [LIB] found!")\
}\
}

#define AUXTOOLS_CHECK(LIB)\
if (!CONFIG_GET(flag/auxtools_enabled)) {\
CRASH("Auxtools is not enabled in config!");\
}\
AUXTOOLS_CHECK_NO_CONFIG(LIB)

#define AUXTOOLS_SHUTDOWN(LIB)\
LAZYINITLIST(GLOB.auxtools_initialized);\
if (GLOB.auxtools_initialized[LIB] == AUXTOOLS_FULL_INIT && fexists(LIB)){\
LIBCALL(LIB,"auxtools_shutdown")();\
GLOB.auxtools_initialized[LIB] = AUXTOOLS_PARTIAL_INIT;\
}\

#define AUXTOOLS_FULL_SHUTDOWN(LIB)\
LAZYINITLIST(GLOB.auxtools_initialized);\
if (GLOB.auxtools_initialized[LIB] && fexists(LIB)){\
LIBCALL(LIB,"auxtools_full_shutdown")();\
GLOB.auxtools_initialized[LIB] = FALSE;\
}

/proc/auxtools_stack_trace(msg)
CRASH(msg)

/proc/auxtools_expr_stub()
CRASH("auxtools not loaded")

/proc/enable_debugging(mode, port)
CRASH("debug_server not loaded")

/proc/start_code_coverage(filename)
CRASH("auxcov not loaded")

/proc/stop_code_coverage(filename)
CRASH("auxcov not loaded")

/world/Del()
AUXTOOLS_FULL_SHUTDOWN(AUXLUA)
var/debug_server = world.GetConfig("env", "AUXTOOLS_DEBUG_DLL")
if (debug_server)
LIBCALL(debug_server, "auxtools_shutdown")()
return ..()
7 changes: 6 additions & 1 deletion code/_byond_version_compat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,9 @@
/// Call by name proc reference, checks if the proc is an existing global proc
#define GLOBAL_PROC_REF(X) (/proc/##X)


// 515 split call for external libraries into call_ext
#if DM_VERSION < 515
#define LIBCALL call
#else
#define LIBCALL call_ext
#endif
6 changes: 5 additions & 1 deletion code/_compile_options.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@
// byond-tracy is not shipped with CM code. Build it yourself here: https://github.com/mafemergency/byond-tracy/
//#define BYOND_TRACY

// If this is uncommented, we will use auxtools to generate cobertura XML files (under /coverage) that can be shunted to a CI service like https://codecov.io
// #define CODE_COVERAGE

#ifdef CIBUILDING
#define UNIT_TESTS
#define CODE_COVERAGE
#endif

#ifdef CITESTING
#define TESTING
#endif

#if defined(UNIT_TESTS)
#ifdef UNIT_TESTS
//Hard del testing defines
#define REFERENCE_TRACKING
#define REFERENCE_TRACKING_DEBUG
Expand Down
16 changes: 14 additions & 2 deletions code/game/world.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,21 @@ GLOBAL_LIST_INIT(reboot_sfx, file2list("config/reboot_sfx.txt"))
hub = "Exadv1.spacestation13"

/world/New()
#ifndef CODE_COVERAGE
var/debug_server = world.GetConfig("env", "AUXTOOLS_DEBUG_DLL")
if (debug_server)
call_ext(debug_server, "auxtools_init")()
LIBCALL(debug_server, "auxtools_init")()
enable_debugging()
#endif
hub_password = "kMZy3U5jJHSiBQjr"

#ifdef BYOND_TRACY
#warn BYOND_TRACY is enabled
prof_init()
#endif

init_coverage()

GLOB.config_error_log = GLOB.world_attack_log = GLOB.world_href_log = GLOB.world_attack_log = "data/logs/config_error.[GUID()].log"

config.Load(params[OVERRIDE_CONFIG_DIRECTORY_PARAMETER])
Expand Down Expand Up @@ -366,10 +370,18 @@ GLOBAL_LIST_INIT(reboot_sfx, file2list("config/reboot_sfx.txt"))
else
CRASH("unsupported platform")

var/init = call_ext(lib, "init")()
var/init = LIBCALL(lib, "init")()
if("0" != init)
CRASH("[lib] init error: [init]")

/world/proc/init_coverage()
#ifdef CODE_COVERAGE
AUXTOOLS_CHECK_NO_CONFIG(AUXLUA)
start_code_coverage("code_coverage.xml")
#else
return
#endif

/world/proc/HandleTestRun()
// Wait for the game ticker to initialize
Master.sleep_offline_after_initializations = FALSE
Expand Down
6 changes: 1 addition & 5 deletions code/modules/tgs/v3210/api.dm
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,7 @@
if(skip_compat_check && !fexists(SERVICE_INTERFACE_DLL))
TGS_ERROR_LOG("Service parameter present but no interface DLL detected. This is symptomatic of running a service less than version 3.1! Please upgrade.")
return
#if DM_VERSION >= 515
call_ext(SERVICE_INTERFACE_DLL, SERVICE_INTERFACE_FUNCTION)(instance_name, command) //trust no retval
#else
call(SERVICE_INTERFACE_DLL, SERVICE_INTERFACE_FUNCTION)(instance_name, command) //trust no retval
#endif
LIBCALL(SERVICE_INTERFACE_DLL, SERVICE_INTERFACE_FUNCTION)(instance_name, command) //trust no retval
return TRUE

/datum/tgs_api/v3210/OnTopic(T)
Expand Down
4 changes: 3 additions & 1 deletion code/modules/unit_tests/check_runtimes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
var/list/whitelisted_regex = list()

/datum/unit_test/check_runtimes/Run()
return
/*
for(var/runtime as anything in GLOB.STUI.runtime)
if(!is_whitelisted(runtime))
TEST_FAIL(runtime)
TEST_FAIL(runtime)*/

/datum/unit_test/check_runtimes/proc/is_whitelisted(message)
for(var/pattern as anything in whitelisted_regex)
Expand Down
2 changes: 2 additions & 0 deletions colonialmarines.dme
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@
#include "code\__HELPERS\_lists.dm"
#include "code\__HELPERS\_time.dm"
#include "code\__HELPERS\animations.dm"
#include "code\__HELPERS\auxtools.dm"
#include "code\__HELPERS\auxtools_api.dm"
#include "code\__HELPERS\chat.dm"
#include "code\__HELPERS\cmp.dm"
#include "code\__HELPERS\datums.dm"
Expand Down
11 changes: 10 additions & 1 deletion dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# byond version
export BYOND_MAJOR=515
export BYOND_MINOR=1627
export BYOND_MINOR=1637

#rust_g git tag
export RUST_G_VERSION=3.3.0
Expand All @@ -19,3 +19,12 @@ export SPACEMAN_DMM_VERSION=suite-1.8

# Python version for mapmerge and other tools
export PYTHON_VERSION=3.7.9

#auxlua repo
export AUXLUA_REPO=tgstation/auxlua

#auxlua git tag
export AUXLUA_VERSION=1.4.4

export AUXTOOLS_REPO=willox/auxtools
export AUXTOOLS_VERSION=2.3.3
9 changes: 9 additions & 0 deletions tools/ci/install_auxlua.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -euo pipefail

source dependencies.sh

mkdir -p ~/.byond/bin
wget -nv -O ~/.byond/bin/libauxlua.so "https://github.com/$AUXLUA_REPO/releases/download/$AUXLUA_VERSION/libauxlua-coverage.so"
chmod +x ~/.byond/bin/libauxlua.so
ldd ~/.byond/bin/libauxlua.so
Loading
Loading