[MIRROR] Adds Juke Build (#9006)

Co-authored-by: Heroman3003 <31296024+Heroman3003@users.noreply.github.com>
Co-authored-by: Kashargul <KashL@t-online.de>
Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
CHOMPStation2
2024-09-23 17:30:54 -07:00
committed by GitHub
parent ff417ea090
commit 95a4a5c1dd
42 changed files with 477 additions and 155 deletions

View File

@@ -10,23 +10,16 @@ env:
jobs:
run_linters:
if: ( !contains(github.event.head_commit.message, '[ci skip]') )
name: Run Linters
runs-on: ubuntu-22.04
concurrency:
group: run_linters-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- name: Ensure +x on CI directory
run: |
chmod -R +x ./tools/ci
- name: Restore SpacemanDMM cache
uses: actions/cache@v4
with:
path: ~/SpacemanDMM
key: ${{ runner.os }}-spacemandmm-${{ hashFiles('_dependencies.sh') }}
restore-keys: |
${{ runner.os }}-spacemandmm-
# Caches
- name: Restore Yarn cache
uses: actions/cache@v4
with:
@@ -38,7 +31,7 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.nvm
key: ${{ runner.os }}-node-${{ hashFiles('_dependencies.sh') }}
key: ${{ runner.os }}-node-${{ hashFiles('dependencies.sh') }}
restore-keys: |
${{ runner.os }}-node-
- name: Restore Bootstrap cache
@@ -48,29 +41,65 @@ jobs:
key: ${{ runner.os }}-bootstrap-${{ hashFiles('tools/requirements.txt') }}
restore-keys: |
${{ runner.os }}-bootstrap-
- name: Restore Rust cache
uses: actions/cache@v4
with:
path: ~/.cargo
key: ${{ runner.os }}-rust-${{ hashFiles('tools/ci/ci_dependencies.sh')}}
restore-keys: |
${{ runner.os }}-rust-
- name: Restore Cutter cache
uses: actions/cache@v4
with:
path: tools/icon_cutter/cache
key: ${{ runner.os }}-cutter-${{ hashFiles('_dependencies.sh') }}
key: ${{ runner.os }}-cutter-${{ hashFiles('dependencies.sh') }}
# End Caches
- name: Install Tools
run: |
pip3 install setuptools
bash tools/ci/install_build_deps.sh
bash tools/ci/install_spaceman_dmm.sh dreamchecker
bash tools/ci/install_node.sh
bash tools/ci/install_ripgrep.sh
tools/bootstrap/python -c ''
- name: Run Tests
run: |
tools/ci/validate_files.sh
- name: Run DreamChecker
shell: bash
run: ~/dreamchecker 2>&1 | bash tools/ci/annotate_dm.sh
- name: Run Grep Checks
run: tools/ci/validate_files.sh
- name: Run TGUI Checks
run: tools/build/build --ci lint tgui-test
dreamchecker:
name: DreamChecker
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Cache SpacemanDMM
uses: actions/cache@v4
with:
path: ~/SpacemanDMM
key: ${{ runner.os }}-dreamchecker-${{ hashFiles('dependencies.sh')}}
restore-keys: ${{ runner.os }}-dreamchecker
- name: Install Dependencies
run: |
tools/ci/install_spaceman_dmm.sh dreamchecker
- name: Run Linter
id: linter
run: |
~/dreamchecker > ${GITHUB_WORKSPACE}/output-annotations.txt 2>&1
- name: Annotate Linter
uses: yogstation13/DreamAnnotate@v2
if: always()
with:
outputFile: output-annotations.txt
unit_tests:
timeout-minutes: 30
if: ( !contains(github.event.head_commit.message, '[ci skip]') )
strategy:
matrix:
map: ['southern_cross']
# name: Integration Tests (${{ matrix.map }})
name: Integration Tests
# needs: ['run_linters', 'dreamchecker']
runs-on: ubuntu-22.04
@@ -88,7 +117,6 @@ jobs:
run: |
sudo dpkg --add-architecture i386
sudo apt update || true
sudo apt install gcc-multilib
sudo apt install zlib1g-dev:i386 libssl-dev:i386
ldd librust_g.so
- name: Unit Tests
@@ -98,15 +126,9 @@ jobs:
env:
TEST_DEFINE: "UNIT_TEST"
TEST_FILE: "code/_unit_tests.dm"
MAP: ${{ matrix.map }}
REPLACE: true
RUN: "1"
- name: Compile away missions
run: |
tools/ci/install_byond.sh
tools/ci/compile_and_run.sh
env:
TEST_DEFINE: "AWAY_MISSION_TEST"
TEST_FILE: "code/_away_mission_tests.dm"
RUN: "0"
- name: Compile POIs
run: |
tools/ci/install_byond.sh
@@ -114,12 +136,24 @@ jobs:
env:
TEST_DEFINE: "MAP_TEST"
TEST_FILE: "code/_map_tests.dm"
MAP: ${{ matrix.map }}
REPLACE: false
RUN: "0"
- name: Compile away missions
run: |
tools/ci/install_byond.sh
tools/ci/compile_and_run.sh
env:
TEST_DEFINE: "AWAY_MISSION_TEST"
TEST_FILE: "code/_away_mission_tests.dm"
MAP: ${{ matrix.map }}
REPLACE: false
RUN: "0"
tests_successful:
if: ( !contains(github.event.head_commit.message, '[ci skip]') )
name: Integration Tests
needs: ['run_linters', 'unit_tests']
needs: ['run_linters', 'dreamchecker', 'unit_tests']
runs-on: ubuntu-20.04
steps:
- name: Report Success

View File

@@ -35,7 +35,7 @@ jobs:
uses: actions/cache@v4
with:
path: ~/SpacemanDMM
key: ${{ runner.os }}-spacemandmm-${{ hashFiles('_build_dependencies.sh') }}
key: ${{ runner.os }}-spacemandmm-${{ hashFiles('dependencies.sh') }}
restore-keys: |
${{ runner.os }}-spacemandmm-
- name: Install Tools

View File

@@ -6,7 +6,7 @@ on:
paths:
- '.tgs.yml'
- '.github/workflows/tgs_test.yml'
- '_build_dependencies.sh'
- 'dependencies.sh'
- 'code/__DEFINES/tgs.config.dm'
- 'code/__DEFINES/tgs.dm'
- 'code/game/world.dm'
@@ -19,7 +19,7 @@ on:
paths:
- '.tgs.yml'
- '.github/workflows/tgs_test.yml'
- '_build_dependencies.sh'
- 'dependencies.sh'
- 'code/__DEFINES/tgs.config.dm'
- 'code/__DEFINES/tgs.dm'
- 'code/game/world.dm'

View File

@@ -3,7 +3,7 @@
version: 1
# The BYOND version to use (kept in sync with dependencies.sh by the "TGS Test Suite" CI job)
# Must be interpreted as a string, keep quoted
byond: "515.1642"
byond: "515.1637"
# Folders to create in "<instance_path>/Configuration/GameStaticFiles/"
static_files:
# Config directory should be static

62
.vscode/launch.json vendored
View File

@@ -4,13 +4,59 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "byond",
"request": "launch",
"name": "Launch DreamDaemon",
"preLaunchTask": "Build All",
"dmb": "${workspaceFolder}/${command:CurrentDMB}",
"dreamDaemon": true
}
{
"type": "byond",
"request": "launch",
"name": "Launch DreamSeeker",
"preLaunchTask": "Build All",
"dmb": "${workspaceFolder}/${command:CurrentDMB}"
},
{
"type": "byond",
"request": "launch",
"name": "Launch DreamSeeker (low memory mode)",
"preLaunchTask": "Build All (low memory mode)",
"dmb": "${workspaceFolder}/${command:CurrentDMB}"
},
{
"type": "byond",
"request": "launch",
"name": "Launch DreamDaemon",
"preLaunchTask": "Build All",
"dmb": "${workspaceFolder}/${command:CurrentDMB}",
"dreamDaemon": true
},
{
"type": "byond",
"request": "launch",
"name": "Launch DreamDaemon (low memory mode)",
"preLaunchTask": "Build All (low memory mode)",
"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"
},
{
"name": "Debug External Libraries (low memory mode)",
"type": "cppvsdbg",
"request": "launch",
"program": "${command:dreammaker.returnDreamDaemonPath}",
"cwd": "${workspaceRoot}",
"args": [
"${command:dreammaker.getFilenameDmb}",
"-trusted"
],
"preLaunchTask": "Build All (low memory mode)"
}
]
}

29
.vscode/tasks.json vendored
View File

@@ -24,6 +24,30 @@
"dependsOn": "dm: reparse",
"label": "Build All"
},
{
"type": "process",
"command": "tools/build/build",
"args": ["-DLOWMEMORYMODE"],
"windows": {
"command": ".\\tools\\build\\build.bat",
"args": ["-DLOWMEMORYMODE"]
},
"options": {
"env": {
"DM_EXE": "${config:dreammaker.byondPath}"
}
},
"problemMatcher": [
"$dreammaker",
"$tsc",
"$eslint-stylish"
],
"group": {
"kind": "build"
},
"dependsOn": "dm: reparse",
"label": "Build All (low memory mode)"
},
{
"type": "dreammaker",
"dme": "vorestation.dme",
@@ -33,6 +57,11 @@
"group": "build",
"label": "dm: build - vorestation.dme"
},
{
"command": "${command:dreammaker.reparse}",
"group": "build",
"label": "dm: reparse"
},
{
"type": "shell",
"command": "bin/tgui-build",

View File

@@ -37,9 +37,9 @@ RUN apt-get install -y --no-install-recommends \
&& git init \
&& git remote add origin https://github.com/tgstation/rust-g
COPY _build_dependencies.sh .
COPY dependencies.sh .
RUN /bin/bash -c "source _build_dependencies.sh \
RUN /bin/bash -c "source dependencies.sh \
&& git fetch --depth 1 origin \$RUST_G_VERSION" \
&& git checkout FETCH_HEAD \
&& ~/.cargo/bin/cargo build --release

View File

@@ -52,7 +52,11 @@ This will take a while to download, but it provides an easier method for updatin
First-time installation should be fairly straightforward. First, you'll need BYOND installed. You can get it from [here](http://www.byond.com/).
Run BUILD.cmd (or bin/build.cmd) to build both the DM and TGUI code required for the server to function correctly.
**The quick way**. Find `bin/server.cmd` in this folder and double click it to automatically build and host the server on port 1337.
**The long way**. Find `bin/build.cmd` in this folder, and double click it to initiate the build. It consists of multiple steps and might take around 1-5 minutes to compile. If it closes, it means it has finished its job. You can then [setup the server](.github/guides/RUNNING_A_SERVER.md) normally by opening `tgstation.dmb` in DreamDaemon.
**Building vorestation in DreamMaker directly is deprecated and might produce errors**, such as `'tgui.bundle.js': cannot find file`.
If you see any errors or warnings, something has gone wrong - possibly a corrupt download or the files extracted wrong, or a code issue on the main repo. Ask on IRC.

2
build.cmd Normal file
View File

@@ -0,0 +1,2 @@
@echo off
call "%~dp0\tools\build\build.bat" --wait-on-error build %*

View File

@@ -200,7 +200,7 @@ SUBSYSTEM_DEF(media_tracks)
sort_tracks()
return
to_chat(C, "<span class='warning>Couldn't find a track matching the specified parameters.</span>")
to_chat(C, "<span class='warning'>Couldn't find a track matching the specified parameters.</span>")
/datum/controller/subsystem/media_tracks/proc/add_track(var/mob/user, var/new_url, var/new_title, var/new_duration, var/new_artist, var/new_genre, var/new_secret, var/new_lobby)
if(!check_rights(R_DEBUG|R_FUN))

View File

@@ -41,7 +41,7 @@
to_chat(usr,"<span class='notice'>You bind the sack, none can make off with it now!</span> ")
else
anchored = 0
to_chat(usr,"<span class='You unbind the sack, you can now drag it off. But so can anyone else!</span> ")
to_chat(usr,"<span class='notice'>You unbind the sack, you can now drag it off. But so can anyone else!</span> ")
else
to_chat(usr, span("warning", "Only Santa can bind and unbind his sack!"))
return
@@ -71,4 +71,4 @@
var/santa_log = "[T.ckey] playing as [T.name] got a present!"
nice_list_log[++nice_list_log.len] = santa_log
ckey_log[user.ckey] = TRUE
//Currently doesnt have an ingame way to show. Can only be viewed through View-Variables, to ensure theres no chance of players ckeys exposed - Jack
//Currently doesnt have an ingame way to show. Can only be viewed through View-Variables, to ensure theres no chance of players ckeys exposed - Jack

View File

@@ -443,7 +443,7 @@
qdel(T)
return
to_chat(C, "<span class='warning>Couldn't find a track matching the specified parameters.</span>")
to_chat(C, "<span class='warning'>Couldn't find a track matching the specified parameters.</span>")
/obj/machinery/media/jukebox/ghost/vv_get_dropdown()
. = ..()

View File

@@ -77,7 +77,7 @@
string += "-\a [CI.container.label(null, CI.combine_target)], [report_progress(CI)]</br>"
return string
else
to_chat(user, "<span class='notice>'It is empty.</span>")
to_chat(user, "<span class='notice'>It is empty.</span>")
/obj/machinery/appliance/proc/report_progress_tgui(datum/cooking_item/CI)
if(!CI || !CI.max_cookwork)
@@ -812,4 +812,4 @@
return
food_safety = !food_safety
to_chat(usr, "<span class = 'notice'>You flip \the [src]'s safe mode switch. Safe mode is now [food_safety ? "on" : "off"].</span>")
to_chat(usr, "<span class = 'notice'>You flip \the [src]'s safe mode switch. Safe mode is now [food_safety ? "on" : "off"].</span>")

35
dependencies.sh Normal file
View File

@@ -0,0 +1,35 @@
#!/bin/sh
#Project dependencies file
#Final authority on what's required to fully build the project
# byond version
export BYOND_MAJOR=515
export BYOND_MINOR=1637
export MACRO_COUNT=8
#rust_g git tag
export RUST_G_VERSION=3.4.0
#node version
export NODE_VERSION_LTS=20.13.0
# compatiblility mode MUST work with windows 7
export NODE_VERSION_COMPAT=20.2.0
# SpacemanDMM git tag
export SPACEMAN_DMM_VERSION=suite-1.8
# Python version for mapmerge and other tools
export PYTHON_VERSION=3.9.0
#dreamluau repo
export DREAMLUAU_REPO="tgstation/dreamluau"
#dreamluau git tag
export DREAMLUAU_VERSION=0.1.2
#hypnagogic repo
export CUTTER_REPO=spacestation13/hypnagogic
#hypnagogic git tag
export CUTTER_VERSION=v4.0.0

View File

@@ -318,7 +318,6 @@
master_tag = "aerostat_n_n_airlock";
pixel_x = 24;
pixel_y = 24;
tag = "aerostat_n_n_sensint"
},
/turf/simulated/floor/tiled/techfloor,
/area/offmap/aerostat/inside/airlock/north)
@@ -924,7 +923,6 @@
master_tag = "aerostat_s_s_airlock";
pixel_x = -24;
pixel_y = -24;
tag = "aerostat_s_s_sensint"
},
/turf/simulated/floor/tiled/techfloor,
/area/offmap/aerostat/inside/airlock/south)
@@ -1969,7 +1967,6 @@
dir = 8;
master_tag = "aerostat_n_e_airlock";
pixel_x = 32;
tag = "aerostat_n_e_sensint"
},
/turf/simulated/floor/tiled/techfloor,
/area/offmap/aerostat/inside/airlock/north)
@@ -8673,7 +8670,6 @@
dir = 8;
master_tag = "aerostat_s_e_airlock";
pixel_x = 24;
tag = "aerostat_s_e_sensint"
},
/turf/simulated/floor/tiled/techfloor,
/area/offmap/aerostat/inside/airlock/south)
@@ -11336,7 +11332,6 @@
dir = 4;
master_tag = "aerostat_n_w_airlock";
pixel_x = -32;
tag = "aerostat_n_w_sensint"
},
/turf/simulated/floor/tiled/techfloor,
/area/offmap/aerostat/inside/airlock/north)
@@ -13479,7 +13474,6 @@
dir = 4;
master_tag = "aerostat_s_w_airlock";
pixel_x = -24;
tag = "aerostat_s_w_sensint"
},
/turf/simulated/floor/tiled/techfloor,
/area/offmap/aerostat/inside/airlock/south)

View File

@@ -6178,7 +6178,6 @@
pixel_x = -5;
pixel_y = -26;
req_one_access = list();
step_x = 0
},
/turf/simulated/floor/plating/eris/under/airless,
/area/tether_away/guttersite/docking)

View File

@@ -200,7 +200,6 @@
frequency = 1380;
id_tag = "adminshuttle_docker";
pixel_x = -30;
tag = ""
},
/turf/simulated/shuttle/floor/voidcraft/light,
/area/shuttle/adminshuttle)
@@ -2854,7 +2853,6 @@
frequency = 1380;
id_tag = "adminshuttle_bay";
pixel_x = 30;
tag = ""
},
/turf/simulated/floor/tiled/techfloor,
/area/ship/adminships/engine_bay)

View File

@@ -6178,7 +6178,6 @@
pixel_x = -5;
pixel_y = -26;
req_one_access = list();
step_x = 0
},
/turf/simulated/floor/plating/eris/under/airless,
/area/tether_away/guttersite/docking)

View File

@@ -35,10 +35,10 @@ If you are using the tooling provided in this repo, everything is included! Feel
However, if you want finer control over the installation or build process, you will need these:
- [Node v16.13+](https://nodejs.org/en/download/)
- [Node v20.2+](https://nodejs.org/en/download/)
- **LTS** release is recommended instead of latest
- **DO NOT install Chocolatey if Node installer asks you to!**
- [Yarn v1.22.4+](https://yarnpkg.com/getting-started/install)
- [Yarn v4.1.1+](https://yarnpkg.com/getting-started/install)
- You can run `npm install -g yarn` to install it.
## Usage
@@ -143,12 +143,13 @@ together, and can reveal certain layout bugs which are not normally visible.
## Browser Developer Tools
To debug TGUI interfaces with browser-style developer tools, there exists a utility
that Microsoft bundles with Windows to debug any Internet Explorer/Trident-using interface,
that Microsoft bundles with Windows called IEChooser/F12 to debug any Internet Explorer/Trident-using interface,
which BYOND uses.
This provides invaluable tools such as a local console, a DOM viewer, an interactive debugger, and more.
The 64-bit version that we use is located at `%windir%\SysWOW64\F12\IEChooser.exe`.
You can access the `IEChooser.exe` by pressing <kbd>Win + R</kbd>, then typing `f12`, then pressing enter.
To manually go there: 64-bit version that we use is located at `%windir%\SysWOW64\F12\IEChooser.exe`.
There's also a 32-bit one in `system32\`.
Simply launch the application after you've opened a TGUI window, and choose the .html name.

View File

@@ -16,9 +16,9 @@ if [ "$TG_BOOTSTRAP_CACHE" ]; then
fi
OldPWD="$PWD"
cd "$Bootstrap/../.."
. ./_build_dependencies.sh # sets NODE_VERSION_PRECISE
. ./dependencies.sh # sets NODE_VERSION_PRECISE
cd "$OldPWD"
NodeVersion="$NODE_VERSION_PRECISE"
NodeVersion="$NODE_VERSION_LTS"
NodeFullVersion="node-v$NodeVersion-win-x64"
NodeDir="$Cache/$NodeFullVersion"
NodeExe="$NodeDir/node.exe"

View File

@@ -30,7 +30,19 @@ $Cache = "$BaseDir\.cache"
if ($Env:TG_BOOTSTRAP_CACHE) {
$Cache = $Env:TG_BOOTSTRAP_CACHE
}
$NodeVersion = Extract-Variable -Path "$BaseDir\..\..\_build_dependencies.sh" -Key "NODE_VERSION_PRECISE"
# Get OS version
[int]$OSMajor = (Get-WmiObject -Class Win32_OperatingSystem).Version.Split(".")[0]
# Set Node version based on OS version
if ($OSMajor -lt 10) {
# Anything under Windows 10
$NodeVersion = Extract-Variable -Path "$BaseDir\..\..\dependencies.sh" -Key "NODE_VERSION_COMPAT"
}
else {
$NodeVersion = Extract-Variable -Path "$BaseDir\..\..\dependencies.sh" -Key "NODE_VERSION_LTS"
}
$NodeSource = "https://nodejs.org/download/release/v$NodeVersion/win-x64/node.exe"
$NodeTargetDir = "$Cache\node-v$NodeVersion-x64"
$NodeTarget = "$NodeTargetDir\node.exe"

View File

@@ -18,7 +18,7 @@ if [ "$TG_BOOTSTRAP_CACHE" ]; then
fi
OldPWD="$PWD"
cd "$Bootstrap/../.."
. ./_build_dependencies.sh # sets PYTHON_VERSION
. ./dependencies.sh # sets PYTHON_VERSION
cd "$OldPWD"
PythonVersion="$PYTHON_VERSION"
PythonDir="$Cache/python-$PythonVersion"

View File

@@ -31,7 +31,7 @@ $Cache = "$Bootstrap/.cache"
if ($Env:TG_BOOTSTRAP_CACHE) {
$Cache = $Env:TG_BOOTSTRAP_CACHE
}
$PythonVersion = ExtractVersion -Path "$Bootstrap/../../_build_dependencies.sh" -Key "PYTHON_VERSION"
$PythonVersion = ExtractVersion -Path "$Bootstrap/../../dependencies.sh" -Key "PYTHON_VERSION"
$PythonDir = "$Cache/python-$PythonVersion"
$PythonExe = "$PythonDir/python.exe"
$Log = "$Cache/last-command.log"

54
tools/build/README.md Normal file
View File

@@ -0,0 +1,54 @@
# /tg/station build script
This build script is the recommended way to compile the game, including not only the DM code but also the JavaScript and any other dependencies.
- VSCode:
a) Press `Ctrl+Shift+B` to build.
b) Press `F5` to build and run with debugger attached.
- Windows:
a) Double-click `BUILD.bat` in the repository root to build (will wait for a key press before it closes).
b) Double-click `tools/build/build.bat` to build (will exit as soon as it finishes building).
- Linux:
a) Run `tools/build/build` from the repository root.
The script will skip build steps whose inputs have not changed since the last run.
## Getting list of available targets
You can get a list of all targets that you can build by running the following command:
```
tools/build/build --help
```
## Dependencies
- On Windows, `build.bat` will automatically install a private (vendored) copy of Node.
- On Linux, install Node using your package manager or from <https://nodejs.org/en/download/>.
- On Linux, unless using tgs4 or later you will need to compile rust-g on the server and obtain a .so file, for instructions see https://github.com/tgstation/rust-g
## Why?
We used to include compiled versions of the tgui JavaScript code in the Git repository so that the project could be compiled using BYOND only. These pre-compiled files tended to have merge conflicts for no good reason. Using a build script lets us avoid this problem, while keeping builds convenient for people who are not modifying tgui.
This build script is based on [Juke Build](https://github.com/stylemistake/juke-build) - follow the link to read the documentation for the project and understand how it works and how to contribute.
## Named byond versions
If you have byond installations in non-standard locations or want to use few versions at once for testing you can fill in `dm_versions.json` file in this directory.
Entries with "default" set to true will be used BEFORE byond installations in standard locations. Otherwise you need to pass `--dm-version={name}` to the build script to choose version you want to use.
Example dm_versions.json file:
```
[
{
"name": "515.1594",
"path": "C:\\Repo\\ByondVersions\\515.1594_byond\\byond\\bin\\dm.exe",
"default": false
},
{
"name": "funny_version",
"path": "D:\\Repo\\ByondVersions\\514.1589_byond\\byond\\bin\\dm.exe",
"default": true
}
]
```

View File

@@ -37,9 +37,9 @@ Juke.setup({ file: import.meta.url }).then((code) => {
const DME_NAME = 'vorestation';
const CUTTER_SUFFIX = '.png.toml'
// Stores the contents of _build_dependencies.sh as a key value pair
// Stores the contents of dependencies.sh as a key value pair
// Best way I could figure to get ahold of this stuff
const dependencies = fs.readFileSync('_build_dependencies.sh', 'utf8')
const dependencies = fs.readFileSync('dependencies.sh', 'utf8')
.split("\n")
.map((statement) => statement.replace("export", "").trim())
.filter((value) => !(value == "" || value.startsWith("#")))
@@ -77,7 +77,7 @@ export const CiParameter = new Juke.Parameter({ type: 'boolean' });
export const ForceRecutParameter = new Juke.Parameter({
type: 'boolean',
name: "force_recut",
name: "force-recut",
});
export const WarningParameter = new Juke.Parameter({
@@ -181,9 +181,9 @@ export const DmMapsIncludeTarget = new Juke.Target({
//...Juke.glob('_maps/RandomZLevels/**/*.dmm'),
//...Juke.glob('_maps/shuttles/**/*.dmm'),
//...Juke.glob('_maps/templates/**/*.dmm'),
...Juke.glob('maps/southern_sun/**/*.dmm'),
...Juke.glob('maps/southern_cross/**/*.dmm'),
...Juke.glob('maps/submap/**/*.dmm'),
];
const content = folders
.map((file) => file.replace('_maps/', ''))
@@ -202,14 +202,17 @@ export const DmTarget = new Juke.Target({
inputs: [
'_maps/map_files/generic/**',
'maps/**/*.dm',
'maps/southern_sun/**/*.dmm', // Placed here so it recompiles on map changes
'maps/southern_cross/**/*.dmm', // Placed here so it recompiles on map changes
'maps/submap/**/*.dmm', // Placed here so it recompiles on map changes
'code/**',
'html/**',
'icons/**',
'interface/**',
'sound/**',
'modular_chomp/code/**',
'modular_chomp/icons/**',
'modular_chomp/sound/**',
`${DME_NAME}.dme`,
NamedVersionFile,
],
@@ -354,8 +357,8 @@ export const TguiTarget = new Juke.Target({
'tgui/public/tgui.bundle.js',
'tgui/public/tgui-panel.bundle.css',
'tgui/public/tgui-panel.bundle.js',
//'tgui/public/tgui-say.bundle.css',
//'tgui/public/tgui-say.bundle.js',
'tgui/public/tgui-say.bundle.css',
'tgui/public/tgui-say.bundle.js',
],
executes: () => yarn('tgui:build'),
});

View File

@@ -145,15 +145,42 @@ export const DreamMaker = async (dmeFile, options = {}) => {
throw err;
}
};
const testDmVersion = async (dmPath) => {
const execReturn = await Juke.exec(dmPath, [], { silent: true, throw: false });
const version = execReturn.combined.match(`DM compiler version (\\d+)\\.(\\d+)`)
if(version == null){
Juke.logger.error(`Unexpected DreamMaker return, ensure "${dmPath}" is correct DM path.`)
throw new Juke.ExitCode(1);
}
const requiredMajorVersion = 515;
const requiredMinorVersion = 1597 // First with -D switch functionality
const major = Number(version[1]);
const minor = Number(version[2]);
if(major < requiredMajorVersion || major == requiredMajorVersion && minor < requiredMinorVersion){
Juke.logger.error(`${requiredMajorVersion}.${requiredMinorVersion} or later DM version required. Version ${major}.${minor} found at: ${dmPath}`)
throw new Juke.ExitCode(1);
}
}
await testDmVersion(dmPath);
testOutputFile(`${dmeBaseName}.dmb`);
testOutputFile(`${dmeBaseName}.rsc`);
const runWithWarningChecks = async (dmeFile, args) => {
const execReturn = await Juke.exec(dmeFile, args);
const ignoredWarningCodes = options.ignoreWarningCodes ?? [];
const reg = ignoredWarningCodes.length > 0 ? new RegExp(`\d+:warning: (?!(${ignoredWarningCodes.join('|')}))`) : /\d+:warning: /;
if (options.warningsAsErrors && execReturn.combined.match(reg)) {
Juke.logger.error(`Compile warnings treated as errors`);
throw new Juke.ExitCode(2);
const runWithWarningChecks = async (dmPath, args) => {
const execReturn = await Juke.exec(dmPath, args);
if(options.warningsAsErrors){
const ignoredWarningCodes = options.ignoreWarningCodes ?? [];
if(ignoredWarningCodes.length > 0 ){
Juke.logger.info('Ignored warning codes:', ignoredWarningCodes.join(', '));
}
const base_regex = '\\d+:warning( \\([a-z_]*\\))?:'
const with_ignores = `\\d+:warning( \\([a-z_]*\\))?:(?!(${ignoredWarningCodes.map(x => `.*${x}.*$`).join('|')}))`
const reg = ignoredWarningCodes.length > 0 ? new RegExp(with_ignores, "m") : new RegExp(base_regex,"m")
if (options.warningsAsErrors && execReturn.combined.match(reg)) {
Juke.logger.error(`Compile warnings treated as errors`);
throw new Juke.ExitCode(2);
}
}
return execReturn;
}
@@ -161,24 +188,9 @@ export const DreamMaker = async (dmeFile, options = {}) => {
const { defines } = options;
if (defines && defines.length > 0) {
Juke.logger.info('Using defines:', defines.join(', '));
try {
const injectedContent = defines
.map(x => `#define ${x}\n`)
.join('');
fs.writeFileSync(`${dmeBaseName}.m.dme`, injectedContent);
const dmeContent = fs.readFileSync(`${dmeBaseName}.dme`);
fs.appendFileSync(`${dmeBaseName}.m.dme`, dmeContent);
await runWithWarningChecks(dmPath, [`${dmeBaseName}.m.dme`]);
fs.writeFileSync(`${dmeBaseName}.dmb`, fs.readFileSync(`${dmeBaseName}.m.dmb`));
fs.writeFileSync(`${dmeBaseName}.rsc`, fs.readFileSync(`${dmeBaseName}.m.rsc`));
}
finally {
Juke.rm(`${dmeBaseName}.m.*`);
}
}
else {
await runWithWarningChecks(dmPath, [dmeFile]);
}
await runWithWarningChecks(dmPath, [...defines.map(def => `-D${def}`), dmeFile]);
};

View File

@@ -1,4 +1,4 @@
{
"private": true,
"type": "module"
"private": true,
"type": "module"
}

13
tools/ci/build_tgui.sh Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/bash
set -euo pipefail
source dependencies.sh
source ~/.nvm/nvm.sh
nvm use $NODE_VERSION_LTS
cd tgui
chmod +x bin/tgui
bin/tgui --lint
bin/tgui --test
yarn tgui:prettier
cd ..

View File

@@ -0,0 +1,6 @@
#!/bin/sh
#Project dependencies file
#Contains versions of programs that we might need to install for CI purposes - do not add anything here that is REQUIRED to run the project, this is just for CI.
export RIPGREP_VERSION=14.0.3

View File

@@ -25,13 +25,11 @@ elif grep -q '#include[[:space:]]\"maps\\groundbase\\groundbase.dm\"' $BASENAME.
fi
# Compile a copy of the codebase, and print errors as Github Actions annotations
tools/build/build --ci tgui tg-font # compile tgui bundle
DreamMaker $BASENAME.dme > compile.log
tools/build/build --ci dm -DCIBUILDING -DCITESTING
exitVal=$?
cat compile.log
if [ $exitVal -gt 0 ]; then
sed -E -n 's/^(.+?\.dm):([0-9]+):(error|warning): (.+)$/::\3 file=\1,line=\2::\4/gp' < compile.log
fi
# if [ $exitVal -gt 0 ]; then
# sed -E -n 's/^(.+?\.dm):([0-9]+):(error|warning): (.+)$/::\3 file=\1,line=\2::\4/gp'
# fi
# Compile failed on map_test
if [ $exitVal -gt 0 ] && [ $TEST_DEFINE = "MAP_TEST" ]; then

View File

@@ -1,11 +1,11 @@
#!/bin/bash
set -euo pipefail
source _build_dependencies.sh
source dependencies.sh
source ~/.nvm/nvm.sh
nvm install $NODE_VERSION
nvm use $NODE_VERSION
nvm install $NODE_VERSION_LTS
nvm use $NODE_VERSION_LTS
npm install --location=global yarn
pip install --user PyYaml -q

View File

@@ -1,7 +1,7 @@
#!/bin/bash
set -euo pipefail
source _build_dependencies.sh
source dependencies.sh
if [ -d "$HOME/BYOND/byond/bin" ] && grep -Fxq "${BYOND_MAJOR}.${BYOND_MINOR}" $HOME/BYOND/version.txt;
then

View File

@@ -1,10 +1,10 @@
#!/bin/bash
set -euo pipefail
source _build_dependencies.sh
source dependencies.sh
if [[ -e ~/.nvm/nvm.sh ]]; then
source ~/.nvm/nvm.sh
nvm install $NODE_VERSION
nvm use $NODE_VERSION
nvm install $NODE_VERSION_COMPAT
nvm use $NODE_VERSION_COMPAT
fi

View File

@@ -0,0 +1,6 @@
#!/bin/bash
set -euo pipefail
source tools/ci/ci_dependencies.sh
cargo install ripgrep --features pcre2 --version $RIPGREP_VERSION

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail
source _build_dependencies.sh
source dependencies.sh
mkdir -p ~/.byond/bin
wget -nv -O ~/.byond/bin/librust_g.so "https://github.com/tgstation/rust-g/releases/download/$RUST_G_VERSION/librust_g.so"

View File

@@ -1,7 +1,7 @@
#!/bin/bash
set -euo pipefail
source _build_dependencies.sh
source dependencies.sh
if [ ! -f ~/$1 ]; then
mkdir -p "$HOME/SpacemanDMM"
@@ -16,4 +16,4 @@ if [ ! -f ~/$1 ]; then
ln -s "$CACHEFILE" ~/$1
fi
~/$1 --version
~/$1 --version

View File

@@ -1,51 +1,86 @@
#!/bin/bash
set -euo pipefail
source _build_dependencies.sh
# nb: must be bash to support shopt globstar
shopt -s globstar extglob
source dependencies.sh
# ANSI Colors
RED='\033[0;31m'
NC='\033[0m'
GREEN="\033[0;32m"
BLUE="\033[0;34m"
NC='\033[0m' # No color
FAILED=0
# check for ripgrep
if command -v rg >/dev/null 2>&1; then
grep=rg
pcre2_support=1
if [ ! rg -P '' >/dev/null 2>&1 ] ; then
pcre2_support=0
fi
code_files="code/**/**.dm"
map_files="maps/**/**.dmm"
# shuttle_map_files="_maps/shuttles/**.dmm"
# code_x_515="code/**/!(__byond_version_compat).dm"
else
pcre2_support=0
grep=grep
code_files="-r --include=code/**/**.dm"
map_files="-r --include=maps/**/**.dmm"
# shuttle_map_files="-r --include=_maps/shuttles/**.dmm"
# code_x_515="-r --include=code/**/!(__byond_version_compat).dm"
fi
echo -e "${BLUE}Using grep provider at $(which $grep)${NC}"
part=0
section() {
echo -e "${BLUE}Checking for $1${NC}..."
part=0
}
part() {
part=$((part+1))
padded=$(printf "%02d" $part)
echo -e "${GREEN} $padded- $1${NC}"
}
section "map issues"
part "step_[xy]"
#Checking for step_x/step_y defined in any maps anywhere.
(! grep 'step_[xy]' maps/**/*.dmm)
(! $grep 'step_[xy]' $map_files)
retVal=$?
if [ $retVal -ne 0 ]; then
echo -e "${RED}The variables 'step_x' and 'step_y' are present on a map, and they 'break' movement ingame.${NC}"
FAILED=1
fi
#Checking for 'tag' set to something on maps
(! grep -Pn '( |\t|;|{)tag( ?)=' maps/**/*.dmm)
retVal=$?
if [ $retVal -ne 0 ]; then
echo -e "${RED}A map has 'tag' set on an atom. It may cause problems and should be removed.${NC}"
FAILED=1
fi
#Checking for broken HTML tags (didn't close the quote for class)
(! grep -En "<\s*span\s+class\s*=\s*('[^'>]+|[^'>]+')\s*>" **/*.dm)
retVal=$?
if [ $retVal -ne 0 ]; then
echo -e "${RED}A broken span tag class is present (check quotes).${NC}"
FAILED=1
fi
part "test map included"
#Checking for any 'checked' maps that include 'test'
(! grep 'maps\\.*test.*' *.dme)
(! $grep 'maps\\.*test.*' *.dme)
retVal=$?
if [ $retVal -ne 0 ]; then
echo -e "${RED}A map containing the word 'test' is included. This is not allowed to be committed.${NC}"
FAILED=1
fi
#Check for weird indentation in any .dm files
awk -f tools/indentation.awk **/*.dm
retVal=$?
if [ $retVal -ne 0 ]; then
echo -e "${RED}Indention testing failed. Please see results and fix indentation.${NC}"
FAILED=1
fi
section "code issues"
part "indentation"
echo -e "${RED}DISABLED"
#Check for weird indentation in any .dm files
# awk -f tools/indentation.awk $code_files
# retVal=$?
# if [ $retVal -ne 0 ]; then
# echo -e "${RED}Indention testing failed. Please see results and fix indentation.${NC}"
# FAILED=1
# fi
part "changelog"
#Checking for a change to html/changelogs/example.yml
md5sum -c - <<< "0c56937110d88f750a32d9075ddaab8b *html/changelogs_ch/example.yml" # CHOMPedit - Better changelogs
retVal=$?
@@ -54,14 +89,16 @@ if [ $retVal -ne 0 ]; then
FAILED=1
fi
part "color macros"
#Checking for color macros
(num=`grep -E '\\\\(red|blue|green|black|b|i[^mc])' **/*.dm | wc -l`; echo "$num escapes (expecting ${MACRO_COUNT} or less)"; [ $num -le ${MACRO_COUNT} ])
(num=`$grep -n '\\\\(red|blue|green|black|b|i[^mct])' $code_files | wc -l`; echo "$num escapes (expecting ${MACRO_COUNT} or less)"; [ $num -le ${MACRO_COUNT} ])
retVal=$?
if [ $retVal -ne 0 ]; then
echo -e "${RED}Do not use any byond color macros (such as \blue), they are deprecated.${NC}"
FAILED=1
fi
part "html tag matching"
#Checking for missed tags
python tools/TagMatcher/tag-matcher.py ../..
retVal=$?
@@ -70,5 +107,39 @@ if [ $retVal -ne 0 ]; then
FAILED=1
fi
if [ "$pcre2_support" -eq 1 ]; then
section "regexes requiring PCRE2"
part "tag"
#Checking for 'tag' set to something on maps
(! $grep -Pn '( |\t|;|{)tag( ?)=' $map_files)
retVal=$?
if [ $retVal -ne 0 ]; then
echo -e "${RED}A map has 'tag' set on an atom. It may cause problems and should be removed.${NC}"
FAILED=1
fi
part "broken html"
# echo -e "${RED}DISABLED"
#Checking for broken HTML tags (didn't close the quote for class)
(! $grep -Pn "<\s*span\s+class\s*=\s*('[^'>]+|[^'>]+')\s*>" $code_files)
retVal=$?
if [ $retVal -ne 0 ]; then
echo -e "${RED}A broken span tag class is present (check quotes).${NC}"
FAILED=1
fi
else
echo -e "${RED}pcre2 not supported, skipping checks requiring pcre2"
echo -e "if you want to run these checks install ripgrep with pcre2 support.${NC}"
fi
if [ $FAILED = 0 ]; then
echo
echo -e "${GREEN}No errors found using $grep!${NC}"
else
echo
echo -e "${RED}Errors found, please fix them and try again.${NC}"
fi
# Quit with our status code
exit $FAILED

View File

@@ -2,7 +2,7 @@
BASEDIR=$PWD
#Put directories to get maps from here. One per line.
mapdirs=(
"maps/southern_cross"
"maps/southern_sun"
)
#DO NOT TOUCH THIS VARIABLE. It will automatically fill with any maps in mapdirs that are form MAPNAME-n.dmm where n is the z level.
map_files=()

View File

@@ -2,7 +2,7 @@
## What is this?
This folder holds a set of cached versions of hypnagogic, our icon cutter.
This folder will hold a set of cached versions of hypnagogic, our icon cutter. We autodownload the tagged version from github on build.
## How is it used?

View File

@@ -69,10 +69,16 @@ def hash_file(path):
return (md5.hexdigest(), None, None)
path_to_us = os.path.realpath(os.path.dirname(__file__))
pass_count = 0
fail_count = 0
output_hash = {}
for cutter_template in glob.glob("..\\..\\icons\\**\*.toml", recursive = True):
files = []
if platform.system() == "Windows":
files = glob.glob(f"{path_to_us}\..\\..\\icons\\**\*.toml", recursive = True)
else:
files = glob.glob(f"{path_to_us}/../../icons/**/*.toml", recursive = True)
for cutter_template in files:
resource_name = re.sub(chop_extension, r"\1", cutter_template, count = 1)
if not os.path.isfile(resource_name):
print(f"::error template={cutter_template} exists but lacks a matching resource file ({resource_name})")
@@ -89,9 +95,9 @@ for cutter_template in glob.glob("..\\..\\icons\\**\*.toml", recursive = True):
# Execute cutter
if platform.system() == "Windows":
subprocess.run("..\\build\\build.bat --force-recut --ci icon-cutter")
subprocess.run(f"{path_to_us}\..\\build\\build.bat --force-recut --ci icon-cutter")
else:
subprocess.run("../build/build --force-recut --ci icon-cutter", shell = True)
subprocess.run(f"{path_to_us}/../build/build --force-recut --ci icon-cutter", shell = True)
for output_name in output_hash:
old_hash, old_metadata, old_icon_hash = output_hash[output_name]

View File

@@ -9,7 +9,7 @@ set -x
#need to switch to game dir for Dockerfile weirdness
original_dir=$PWD
cd "$1"
. _build_dependencies.sh
. dependencies.sh
cd "$original_dir"

View File

@@ -89,8 +89,8 @@ try
Console.WriteLine($".tgs.yml Security level: {tgsYml.Security}");
Console.WriteLine("Downloading and checking BYOND version in _build_dependencies.sh...");
var dependenciesShContent = await gitHubClient.Repository.Content.GetRawContentByRef(repoOwner, repoName, "_build_dependencies.sh", pushedCommitHash);
Console.WriteLine("Downloading and checking BYOND version in dependencies.sh...");
var dependenciesShContent = await gitHubClient.Repository.Content.GetRawContentByRef(repoOwner, repoName, "dependencies.sh", pushedCommitHash);
var dependenciesSh = Encoding.UTF8.GetString(dependenciesShContent);
var dependenciesShLines = dependenciesSh.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
@@ -112,7 +112,7 @@ try
var dependenciesByondVersion = new Version(dependenciesShByondMajor, dependenciesShByondMinor);
if(dependenciesByondVersion != targetByondVersion)
{
Console.WriteLine($".tgs.yml BYOND version does not match _build_dependencies.sh! Expected {dependenciesByondVersion} got {targetByondVersion}!");
Console.WriteLine($".tgs.yml BYOND version does not match dependencies.sh! Expected {dependenciesByondVersion} got {targetByondVersion}!");
return 5;
}