Skip to content

Commit

Permalink
Opendream-detected Errors, More Harddels, Slight CI Improvements (shi…
Browse files Browse the repository at this point in the history
…ptest-ss13#3572)

<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request
I didn't get them all in my last PR, apparently. Also throws in some
minor tweaks for ambiguity and such detected by the OpenDream parser
since I was messing around with that at the time.

Also adds OpenDream linting to CI because why not.

Ports:
tgstation/tgstation#81892 (which is in turn from Para and Goon)
tgstation/tgstation#82029
BeeStation/BeeStation-Hornet#11464

tgstation/tgstation#86510
tgstation/tgstation#83255
tgstation/tgstation#78225
tgstation/tgstation#78265

Fixes: shiptest-ss13#3530 

## Why It's Good For The Game
Harddels still bad, OpenDream good

<!-- Both 🆑's are required for the changelog to work! You can put
your name to the right of the first 🆑 if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->

---------

Co-authored-by: MrMelbert <[email protected]>
Co-authored-by: san7890 <[email protected]>
Co-authored-by: PowerfulBacon <[email protected]>
Co-authored-by: Jordan Dominion <[email protected]>
Co-authored-by: Jeremiah <[email protected]>
Co-authored-by: distributivgesetz <[email protected]>
Co-authored-by: Aleksej Komarov <[email protected]>
  • Loading branch information
8 people authored Oct 25, 2024
1 parent 05242e0 commit c38a3d2
Show file tree
Hide file tree
Showing 69 changed files with 454 additions and 183 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/autowiki.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
sudo apt update || true
sudo apt install -o APT::Immediate-configure=false libssl-dev:i386
bash tools/ci/install_rust_g.sh
- name: Cache dependencies
if: steps.secrets_set.outputs.SECRETS_ENABLED
uses: actions/cache@v3
Expand Down
140 changes: 96 additions & 44 deletions .github/workflows/ci_suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,34 @@ on:
push:
branches:
- master
- "project/**"
pull_request:
branches:
- master
- "project/**"
merge_group:
branches:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
start_gate:
if: ( !contains(github.event.head_commit.message, '[ci skip]') )
name: Start Gate
runs-on: ubuntu-latest
steps:
- name: Mandatory Empty Step
run: exit 0

run_linters:
if: ${{ ! contains(github.event.head_commit.message, '[ci skip]') }}
name: Run Linters
needs: start_gate
runs-on: ubuntu-22.04
timeout-minutes: 5

steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -53,40 +70,62 @@ jobs:
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
- name: Give Linters A Go
id: linter-setup
run: exit 0
- name: Run Grep Checks
if: steps.linter-setup.conclusion == 'success' && !cancelled()
run: bash tools/ci/check_grep.sh
- name: Run DreamChecker
if: steps.linter-setup.conclusion == 'success' && !cancelled()
run: ~/dreamchecker 2>&1 | bash tools/ci/annotate_dm.sh
- name: Run Map Checks
if: steps.linter-setup.conclusion == 'success' && !cancelled()
run: |
tools/bootstrap/python -m tools.maplint.source --github
tools/build/build --ci lint tgui-test
bash tools/ci/check_filedirs.sh shiptest.dme
bash tools/ci/check_changelogs.sh
bash tools/ci/check_misc.sh
bash tools/ci/check_grep.sh
tools/bootstrap/python -m dmi.test
tools/bootstrap/python -m mapmerge2.dmm_test
~/dreamchecker > ${GITHUB_WORKSPACE}/output-annotations.txt 2>&1
- name: Annotate Lints
if: always()
uses: yogstation13/DreamAnnotate@v2
with:
outputFile: output-annotations.txt

- name: Run Check Regex
tools/bootstrap/python -m tools.maplint.source
- name: Run DMI Tests
if: steps.linter-setup.conclusion == 'success' && !cancelled()
run: tools/bootstrap/python -m dmi.test
- name: Check File Directories
if: steps.linter-setup.conclusion == 'success' && !cancelled()
run: bash tools/ci/check_filedirs.sh shiptest.dme
- name: Check Changelogs
if: steps.linter-setup.conclusion == 'success' && !cancelled()
run: bash tools/ci/check_changelogs.sh
- name: Check Miscellaneous Files
if: steps.linter-setup.conclusion == 'success' && !cancelled()
run: bash tools/ci/check_misc.sh
- name: Run TGUI Checks
if: steps.linter-setup.conclusion == 'success' && !cancelled()
run: tools/build/build --ci lint tgui-test
- name: Run Regex Checks
if: steps.linter-setup.conclusion == 'success' && !cancelled()
run: |
tools/bootstrap/python -m ci.check_regex --log-changes-only --github-actions
cat check_regex_output.txt
- name: Install OpenDream
uses: robinraju/[email protected]
with:
repository: "OpenDreamProject/OpenDream"
tag: "latest"
fileName: "DMCompiler_linux-x64.tar.gz"
extract: true

- name: Annotate Regex Matches
- name: Run OpenDream Linter
run: |
cat check_regex_output.txt
./DMCompiler_linux-x64/DMCompiler shiptest.dme --suppress-unimplemented --define=CIBUILDING | bash tools/ci/annotate_od.sh
compile_all_maps:
if: ${{ ! contains(github.event.head_commit.message, '[ci skip]') }}
name: Compile Maps
needs: start_gate
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- uses: actions/checkout@v3

Expand All @@ -106,39 +145,41 @@ jobs:
tools/build/build --ci dm -DCIBUILDING -DCITESTING -DALL_MAPS -DFULL_INIT
run_all_tests:
if: ${{ ! contains(github.event.head_commit.message, '[ci skip]') }}
name: Integration Tests
needs: start_gate
strategy:
fail-fast: false
matrix:
arg: [
"BASIC_TESTS",
"CREATE_AND_DESTROY_TEST",
"PLANET_GEN_TEST",
"RUIN_PLACEMENT_TEST",
"SHIP_PLACEMENT_TEST"
]
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]')"
# name: Alternate Tests
# strategy:
# fail-fast: false
# matrix:
# major: [515]
# minor: [1614]
# uses: ./.github/workflows/run_integration_tests.yml
# with:
# major: ${{ matrix.major }}
# minor: ${{ matrix.minor }}
# run_alternate_tests:
# if: "!contains(github.event.head_commit.message, '[ci skip]')"
# name: Alternate Tests
# strategy:
# fail-fast: false
# matrix:
# major: [515]
# minor: [1614]
# uses: ./.github/workflows/run_integration_tests.yml
# with:
# major: ${{ matrix.major }}
# minor: ${{ matrix.minor }}

test_windows:
if: ${{ ! contains(github.event.head_commit.message, '[ci skip]') }}
name: Windows Build
needs: start_gate
runs-on: windows-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v3

Expand All @@ -163,7 +204,18 @@ jobs:
bash tools/deploy.sh ./deploy
- name: Deploy artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: deploy
path: deploy

completion_gate: # Serves as a non-moving target for branch rulesets
if: always() && !cancelled()
name: Completion Gate
needs: [test_windows, compile_all_maps, run_linters, run_all_tests]
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
1 change: 1 addition & 0 deletions .github/workflows/codeowner_reviews.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on: pull_request_target
jobs:
assign-users:
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so the job can access it
Expand Down
34 changes: 17 additions & 17 deletions .github/workflows/rerun_flaky_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
workflow_run:
workflows: [Checks]
types:
- completed
- completed

permissions:
actions: write
Expand All @@ -15,23 +15,23 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' && github.event.workflow_run.run_attempt == 1 }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Rerun flaky tests
uses: actions/github-script@v6
with:
script: |
const { rerunFlakyTests } = await import('${{ github.workspace }}/tools/pull_request_hooks/rerunFlakyTests.js')
await rerunFlakyTests({ github, context })
- name: Checkout
uses: actions/checkout@v3
- name: Rerun flaky tests
uses: actions/github-script@v6
with:
script: |
const { rerunFlakyTests } = await import('${{ github.workspace }}/tools/pull_request_hooks/rerunFlakyTests.js')
await rerunFlakyTests({ github, context })
report_flaky_tests:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.run_attempt == 2 }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Report flaky tests
uses: actions/github-script@v6
with:
script: |
const { reportFlakyTests } = await import('${{ github.workspace }}/tools/pull_request_hooks/rerunFlakyTests.js')
await reportFlakyTests({ github, context })
- name: Checkout
uses: actions/checkout@v3
- name: Report flaky tests
uses: actions/github-script@v6
with:
script: |
const { reportFlakyTests } = await import('${{ github.workspace }}/tools/pull_request_hooks/rerunFlakyTests.js')
await reportFlakyTests({ github, context })
2 changes: 2 additions & 0 deletions .github/workflows/run_integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ on:
required: false
default: ALL_TESTS
type: string

jobs:
run_integration_tests:
runs-on: ubuntu-latest
timeout-minutes: 15
services:
mysql:
image: mysql:latest
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/tgs_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ on:
push:
branches:
- master
- 'project/**'
- 'gh-readonly-queue/master/**'
- 'gh-readonly-queue/project/**'
paths:
- '.tgs.yml'
- '.github/workflows/tgs_test.yml'
Expand All @@ -12,11 +14,13 @@ on:
- 'code/__DEFINES/tgs.dm'
- 'code/game/world.dm'
- 'code/modules/tgs/**'
- 'tools/bootstrap/**'
- 'tools/tgs_scripts/**'
- 'tools/tgs_test/**'
pull_request:
branches:
- master
- 'project/**'
paths:
- '.tgs.yml'
- '.github/workflows/tgs_test.yml'
Expand All @@ -25,6 +29,7 @@ on:
- 'code/__DEFINES/tgs.dm'
- 'code/game/world.dm'
- 'code/modules/tgs/**'
- 'tools/bootstrap/**'
- 'tools/tgs_scripts/**'
- 'tools/tgs_test/**'
merge_group:
Expand Down Expand Up @@ -54,12 +59,12 @@ jobs:
- 5000:5000 #Can't use env here for some reason
steps:
- name: Setup dotnet
uses: actions/setup-dotnet@v2
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Test TGS Integration
run: dotnet run -c Release --project tools/tgs_test ${{ github.repository }} /tgs_instances/tgstation ${{ env.TGS_API_PORT }} ${{ github.event.pull_request.head.sha || github.sha }} ${{ secrets.GITHUB_TOKEN }} ${{ env.PR_NUMBER }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*.lk
*.int
*.backup
/shiptest.json
### https://raw.github.com/github/gitignore/cc542de017c606138a87ee4880e5f06b3a306def/Global/Linux.gitignore

*~
Expand Down
10 changes: 10 additions & 0 deletions __odlint.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// This file is included right at the start of the DME.
// Its purpose is to enable multiple lints (pragmas) that are supported by OpenDream to better validate the codebase
// These are essentially nitpicks the DM compiler should pick up on but doesnt

#if !defined(SPACEMAN_DMM) && defined(OPENDREAM)
// This is in a separate file as a hack to avoid SpacemanDMM
// evaluating the #pragma lines, even if its outside a block it cares about
// (Also so people can code-own it. Shoutout to AA)
#include "tools/ci/od_lints.dm"
#endif
2 changes: 1 addition & 1 deletion check_regex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ standards:

- no_more:
[
34,
32,
"indentions inside defines",
'^(\s*)#define (\w*)( {2,}| ?\t+)(?!(\/\/|\/\*))',
]
4 changes: 4 additions & 0 deletions code/__DEFINES/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -447,3 +447,7 @@ GLOBAL_LIST_INIT(ghost_others_options, list(GHOST_OTHERS_SIMPLE, GHOST_OTHERS_DE
#define ROUND_END_NOT_DELAYED 0
#define ROUND_END_DELAYED 1
#define ROUND_END_TGS 2

/// A null statement to guard against EmptyBlock lint without necessitating the use of pass()
/// Used to avoid proc-call overhead. But use sparingly. Probably pointless in most places.
#define EMPTY_BLOCK_GUARD ;
12 changes: 10 additions & 2 deletions code/__HELPERS/_logging.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,22 @@
#define WRITE_LOG(log, text) rustg_log_write(log, text, "true")
#define WRITE_LOG_NO_FORMAT(log, text) rustg_log_write(log, text, "false")

//print a warning message to world.log
#ifdef UNIT_TESTS
#define WARNING(MSG) log_world("::warning file=[__FILE__],line=[__LINE__]::[MSG] src: [UNLINT(src)] usr: [usr].")
#else
#define WARNING(MSG) warning("[MSG] in [__FILE__] at line [__LINE__] src: [UNLINT(src)] usr: [usr].")
#endif
/// Print a warning message to world.log
/proc/warning(msg)
msg = "## WARNING: [msg]"
log_world(msg)

//not an error or a warning, but worth to mention on the world log, just in case.
#ifdef UNIT_TESTS
#define NOTICE(MSG) log_world("::notice file=[__FILE__],line=[__LINE__]::[MSG] src: [UNLINT(src)] usr: [usr].")
#else
#define NOTICE(MSG) notice(MSG)
#endif
///not an error or a warning, but worth to mention on the world log, just in case.
/proc/notice(msg)
msg = "## NOTICE: [msg]"
log_world(msg)
Expand Down
Loading

0 comments on commit c38a3d2

Please sign in to comment.