diff --git a/.github/workflows/byond.yml b/.github/workflows/byond.yml new file mode 100644 index 00000000000..8e958bbfea4 --- /dev/null +++ b/.github/workflows/byond.yml @@ -0,0 +1,93 @@ +name: BYOND tests + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + lint: + if: "!contains(github.event.head_commit.message, '[ci skip]')" + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - name: Install + run: | + pip install --user -r ./tools/requirements.txt + chmod +x ./scripts/code_check.sh && ./scripts/code_check.sh $PWD + bash tools/ci/install_spaceman_dmm.sh dreamchecker + - name: Code checks + run: | + awk -f tools/indentation.awk **/*.dm + python3 tools/TagMatcher/tag-matcher.py ../.. + python3 tools/GenerateChangelog/ss13_genchangelog.py html/changelog.html html/changelogs --dry-run + python3 tools/mapmerge2/travis_mapcheck.py + echo "6a5ae087fe5bfa66e52e508655e57120 *html/changelogs/example.yml" | md5sum -c - + - name: Run dreamchecker + run: ~/dreamchecker > ${GITHUB_WORKSPACE}/output-annotations.txt 2>&1 + - name: Annotate Lints + uses: yogstation13/DreamAnnotate@v1 + if: always() + with: + outputFile: output-annotations.txt + + unit-test-linux: + if: "!contains(github.event.head_commit.message, '[ci skip]')" + strategy: + matrix: + map: [runtime, aurora, exodus] + runs-on: ubuntu-20.04 + needs: lint + services: + mariadb: + image: mariadb:latest + ports: + - 3306 + env: + MYSQL_USER: build + MYSQL_PASSWORD: build + MYSQL_DATABASE: game + MYSQL_ROOT_PASSWORD: root + steps: + - uses: actions/checkout@v2 + - name: Install BYOND + run: | + source .versions.sh + sudo dpkg --add-architecture i386 + sudo apt-get update + sudo apt-get install -y gcc-multilib libssl1.1:i386 + bash tools/ci/install_byond.sh + source $HOME/BYOND/byond/bin/byondsetup + echo "Getting rust_g from https://github.com/Aurorastation/rust-g/releases/download/${RUST_G_VERSION}/librust_g.so" + wget "https://github.com/Aurorastation/rust-g/releases/download/${RUST_G_VERSION}/librust_g.so" -O ./librust_g.so + chmod +x ./librust_g.so + ldd ./librust_g.so + - name: Install Flyway + run: | + source .versions.sh + bash scripts/install-flyway.sh + - name: Migrate database + env: + PORT: ${{ job.services.mariadb.ports[3306] }} + run: | + source .versions.sh + $HOME/flyway-$FLYWAY_BUILD/flyway migrate -user=root -password=root -url="jdbc:mariadb://localhost:$PORT/game" + - name: Build + run: | + export LD_LIBRARY_PATH=./:$PWD:$HOME/BYOND/byond/bin:/usr/local/lib:$LD_LIBRARY_PATH + scripts/dm.sh -DUNIT_TEST -M${{ matrix.map }} aurorastation.dme + grep "0 warnings" build_log.txt + - name: Run tests + env: + PORT: ${{ job.services.mariadb.ports[3306] }} + run: | + export LD_LIBRARY_PATH=./:$PWD:$HOME/BYOND/byond/bin:/usr/local/lib:$LD_LIBRARY_PATH + cp config/example/* config/ && cp config/ut/config-db.txt config/config.txt && cp config/ut/dbconfig.txt config/dbconfig.txt + echo "PORT $PORT" >> config/dbconfig.txt + $HOME/BYOND/byond/bin/DreamDaemon aurorastation.dmb -invisible -trusted -core 2>&1 | tee log.txt + grep "All Unit Tests Passed" log.txt + (! grep "runtime error:" log.txt) + diff --git a/.versions.sh b/.versions.sh new file mode 100644 index 00000000000..9a8f5561133 --- /dev/null +++ b/.versions.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +export BYOND_MAJOR=514 +export BYOND_MINOR=1560 + +export RUST_G_VERSION=v0.4.2+a3 +export FLYWAY_BUILD=5.2.4 +export SPACEMAN_DMM_VERSION=suite-1.6 diff --git a/SQL/migrate/V056__sql_admins_table.sql b/SQL/migrate/V056__sql_admins_table.sql index 70704c0eb03..8aa76809962 100644 --- a/SQL/migrate/V056__sql_admins_table.sql +++ b/SQL/migrate/V056__sql_admins_table.sql @@ -1,6 +1,6 @@ ---- ---- Adds the ss13_admins SQL table again. ---- +-- +-- Adds the ss13_admins SQL table again. +-- CREATE TABLE `ss13_admins` ( `ckey` VARCHAR(50) NOT NULL, @@ -15,4 +15,4 @@ ALTER TABLE `ss13_player` DROP COLUMN `rank`, DROP COLUMN `flags`; -DROP TABLE `ss13_admin_log`; \ No newline at end of file +DROP TABLE `ss13_admin_log`; diff --git a/SQL/migrate/V057__cargo_logging_table.sql b/SQL/migrate/V057__cargo_logging_table.sql index d1a94ec2f95..28bdddb4ac7 100644 --- a/SQL/migrate/V057__cargo_logging_table.sql +++ b/SQL/migrate/V057__cargo_logging_table.sql @@ -1,6 +1,6 @@ ---- ---- Adds the cargo logging tables ---- +-- +-- Adds the cargo logging tables +-- CREATE TABLE `ss13_cargo_orderlog` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, diff --git a/SQL/migrate/V058__autohiss_setup.sql b/SQL/migrate/V058__autohiss_setup.sql index 481001ee56f..7182495dd4a 100644 --- a/SQL/migrate/V058__autohiss_setup.sql +++ b/SQL/migrate/V058__autohiss_setup.sql @@ -1,6 +1,6 @@ ---- ---- Puts autohiss in character setup ---- +-- +-- Puts autohiss in character setup +-- ALTER TABLE `ss13_characters` ADD COLUMN `autohiss` TINYINT NOT NULL DEFAULT 0 AFTER `accent`; diff --git a/code/modules/mob/living/silicon/robot/custom_sprites.dm b/code/modules/mob/living/silicon/robot/custom_sprites.dm index a833c40e48d..8b3227234b8 100644 --- a/code/modules/mob/living/silicon/robot/custom_sprites.dm +++ b/code/modules/mob/living/silicon/robot/custom_sprites.dm @@ -11,6 +11,8 @@ var/list/robot_custom_icons return 1 /mob/living/silicon/robot/proc/set_custom_sprite() + if(!(name in robot_custom_icons)) + return var/datum/custom_synth/sprite = robot_custom_icons[name] if(istype(sprite) && sprite.synthckey == ckey) custom_sprite = 1 @@ -21,4 +23,4 @@ var/list/robot_custom_icons icon_state = "[sprite.synthicon]-Standard" else to_chat(src, SPAN_WARNING("Could not locate [sprite.synthicon]-Standard sprite.")) - icon = 'icons/mob/robots.dmi' \ No newline at end of file + icon = 'icons/mob/robots.dmi' diff --git a/config/ut/dbconfig.txt b/config/ut/dbconfig.txt index eae86ee7035..992a0467cac 100644 --- a/config/ut/dbconfig.txt +++ b/config/ut/dbconfig.txt @@ -2,10 +2,9 @@ # Server the MySQL database can be found at # Examples: localhost, 200.135.5.43, www.mysqldb.com, etc. -ADDRESS mariadb +ADDRESS 127.0.0.1 # MySQL server port (default is 3306) -PORT 3306 # Database the population, death, karma, etc. tables may be found in DATABASE game diff --git a/scripts/sourcedm.sh b/scripts/sourcedm.sh index 5737d4e6b4a..3ae8d22da4a 100755 --- a/scripts/sourcedm.sh +++ b/scripts/sourcedm.sh @@ -28,6 +28,10 @@ else then export DM='/usr/share/byond/bin/DreamMaker' return 0 + elif [[ -a "$HOME/BYOND/byond/bin/DreamMaker" ]] + then + export DM="$HOME/BYOND/byond/bin/DreamMaker" + return 0 fi fi diff --git a/tools/ci/install_byond.sh b/tools/ci/install_byond.sh new file mode 100644 index 00000000000..4d8822e6cf1 --- /dev/null +++ b/tools/ci/install_byond.sh @@ -0,0 +1,21 @@ +#!/bin/bash +set -euo pipefail + +source .versions.sh + +if [ -d "$HOME/BYOND/byond/bin" ] && grep -Fxq "${BYOND_MAJOR}.${BYOND_MINOR}" $HOME/BYOND/version.txt; +then + echo "Using cached directory." +else + echo "Setting up BYOND." + rm -rf "$HOME/BYOND" + mkdir -p "$HOME/BYOND" + cd "$HOME/BYOND" + curl "http://www.byond.com/download/build/${BYOND_MAJOR}/${BYOND_MAJOR}.${BYOND_MINOR}_byond_linux.zip" -o byond.zip + unzip byond.zip + rm byond.zip + cd byond + make here + echo "$BYOND_MAJOR.$BYOND_MINOR" > "$HOME/BYOND/version.txt" + cd ~/ +fi diff --git a/tools/ci/install_spaceman_dmm.sh b/tools/ci/install_spaceman_dmm.sh new file mode 100644 index 00000000000..9b96096343d --- /dev/null +++ b/tools/ci/install_spaceman_dmm.sh @@ -0,0 +1,19 @@ +#!/bin/bash +set -euo pipefail + +source .versions.sh + +if [ ! -f ~/$1 ]; then + mkdir -p "$HOME/SpacemanDMM" + CACHEFILE="$HOME/SpacemanDMM/$1" + + if ! [ -f "$CACHEFILE.version" ] || ! grep -Fxq "$SPACEMAN_DMM_VERSION" "$CACHEFILE.version"; then + wget -O "$CACHEFILE" "https://github.com/SpaceManiac/SpacemanDMM/releases/download/$SPACEMAN_DMM_VERSION/$1" + chmod +x "$CACHEFILE" + echo "$SPACEMAN_DMM_VERSION" >"$CACHEFILE.version" + fi + + ln -s "$CACHEFILE" ~/$1 +fi + +~/$1 --version