Skip to content

Commit c38a3d2

Browse files
MarkSuckerbergMrMelbertsan7890PowerfulBaconCyberboss
authored
Opendream-detected Errors, More Harddels, Slight CI Improvements (shiptest-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]>
1 parent 05242e0 commit c38a3d2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+454
-183
lines changed

.github/workflows/autowiki.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
sudo apt update || true
4444
sudo apt install -o APT::Immediate-configure=false libssl-dev:i386
4545
bash tools/ci/install_rust_g.sh
46-
46+
4747
- name: Cache dependencies
4848
if: steps.secrets_set.outputs.SECRETS_ENABLED
4949
uses: actions/cache@v3

.github/workflows/ci_suite.yml

+96-44
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,34 @@ on:
33
push:
44
branches:
55
- master
6+
- "project/**"
67
pull_request:
78
branches:
89
- master
10+
- "project/**"
911
merge_group:
1012
branches:
1113
- master
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
1219
jobs:
20+
start_gate:
21+
if: ( !contains(github.event.head_commit.message, '[ci skip]') )
22+
name: Start Gate
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Mandatory Empty Step
26+
run: exit 0
27+
1328
run_linters:
14-
if: ${{ ! contains(github.event.head_commit.message, '[ci skip]') }}
1529
name: Run Linters
30+
needs: start_gate
1631
runs-on: ubuntu-22.04
32+
timeout-minutes: 5
33+
1734
steps:
1835
- uses: actions/checkout@v3
1936
with:
@@ -53,40 +70,62 @@ jobs:
5370
run: |
5471
pip3 install setuptools
5572
bash tools/ci/install_node.sh
56-
bash tools/ci/install_spaceman_dmm.sh dreamchecker
5773
cargo install ripgrep --features pcre2
5874
tools/bootstrap/python -c ''
5975
60-
- name: Run Linters
76+
- name: Give Linters A Go
77+
id: linter-setup
78+
run: exit 0
79+
- name: Run Grep Checks
80+
if: steps.linter-setup.conclusion == 'success' && !cancelled()
81+
run: bash tools/ci/check_grep.sh
82+
- name: Run DreamChecker
83+
if: steps.linter-setup.conclusion == 'success' && !cancelled()
84+
run: ~/dreamchecker 2>&1 | bash tools/ci/annotate_dm.sh
85+
- name: Run Map Checks
86+
if: steps.linter-setup.conclusion == 'success' && !cancelled()
6187
run: |
62-
tools/bootstrap/python -m tools.maplint.source --github
63-
tools/build/build --ci lint tgui-test
64-
bash tools/ci/check_filedirs.sh shiptest.dme
65-
bash tools/ci/check_changelogs.sh
66-
bash tools/ci/check_misc.sh
67-
bash tools/ci/check_grep.sh
68-
tools/bootstrap/python -m dmi.test
6988
tools/bootstrap/python -m mapmerge2.dmm_test
70-
~/dreamchecker > ${GITHUB_WORKSPACE}/output-annotations.txt 2>&1
71-
72-
- name: Annotate Lints
73-
if: always()
74-
uses: yogstation13/DreamAnnotate@v2
75-
with:
76-
outputFile: output-annotations.txt
77-
78-
- name: Run Check Regex
89+
tools/bootstrap/python -m tools.maplint.source
90+
- name: Run DMI Tests
91+
if: steps.linter-setup.conclusion == 'success' && !cancelled()
92+
run: tools/bootstrap/python -m dmi.test
93+
- name: Check File Directories
94+
if: steps.linter-setup.conclusion == 'success' && !cancelled()
95+
run: bash tools/ci/check_filedirs.sh shiptest.dme
96+
- name: Check Changelogs
97+
if: steps.linter-setup.conclusion == 'success' && !cancelled()
98+
run: bash tools/ci/check_changelogs.sh
99+
- name: Check Miscellaneous Files
100+
if: steps.linter-setup.conclusion == 'success' && !cancelled()
101+
run: bash tools/ci/check_misc.sh
102+
- name: Run TGUI Checks
103+
if: steps.linter-setup.conclusion == 'success' && !cancelled()
104+
run: tools/build/build --ci lint tgui-test
105+
- name: Run Regex Checks
106+
if: steps.linter-setup.conclusion == 'success' && !cancelled()
79107
run: |
80108
tools/bootstrap/python -m ci.check_regex --log-changes-only --github-actions
109+
cat check_regex_output.txt
110+
111+
- name: Install OpenDream
112+
uses: robinraju/[email protected]
113+
with:
114+
repository: "OpenDreamProject/OpenDream"
115+
tag: "latest"
116+
fileName: "DMCompiler_linux-x64.tar.gz"
117+
extract: true
81118

82-
- name: Annotate Regex Matches
119+
- name: Run OpenDream Linter
83120
run: |
84-
cat check_regex_output.txt
121+
./DMCompiler_linux-x64/DMCompiler shiptest.dme --suppress-unimplemented --define=CIBUILDING | bash tools/ci/annotate_od.sh
85122
86123
compile_all_maps:
87-
if: ${{ ! contains(github.event.head_commit.message, '[ci skip]') }}
88124
name: Compile Maps
125+
needs: start_gate
89126
runs-on: ubuntu-latest
127+
timeout-minutes: 5
128+
90129
steps:
91130
- uses: actions/checkout@v3
92131

@@ -106,39 +145,41 @@ jobs:
106145
tools/build/build --ci dm -DCIBUILDING -DCITESTING -DALL_MAPS -DFULL_INIT
107146
108147
run_all_tests:
109-
if: ${{ ! contains(github.event.head_commit.message, '[ci skip]') }}
110148
name: Integration Tests
149+
needs: start_gate
111150
strategy:
112151
fail-fast: false
113152
matrix:
114-
arg: [
115-
"BASIC_TESTS",
116-
"CREATE_AND_DESTROY_TEST",
117-
"PLANET_GEN_TEST",
118-
"RUIN_PLACEMENT_TEST",
119-
"SHIP_PLACEMENT_TEST"
120-
]
153+
arg:
154+
[
155+
"BASIC_TESTS",
156+
"CREATE_AND_DESTROY_TEST",
157+
"PLANET_GEN_TEST",
158+
"RUIN_PLACEMENT_TEST",
159+
"SHIP_PLACEMENT_TEST",
160+
]
121161
uses: ./.github/workflows/run_integration_tests.yml
122162
with:
123163
arg: ${{ matrix.arg }}
124164

125-
# run_alternate_tests:
126-
# if: "!contains(github.event.head_commit.message, '[ci skip]')"
127-
# name: Alternate Tests
128-
# strategy:
129-
# fail-fast: false
130-
# matrix:
131-
# major: [515]
132-
# minor: [1614]
133-
# uses: ./.github/workflows/run_integration_tests.yml
134-
# with:
135-
# major: ${{ matrix.major }}
136-
# minor: ${{ matrix.minor }}
165+
# run_alternate_tests:
166+
# if: "!contains(github.event.head_commit.message, '[ci skip]')"
167+
# name: Alternate Tests
168+
# strategy:
169+
# fail-fast: false
170+
# matrix:
171+
# major: [515]
172+
# minor: [1614]
173+
# uses: ./.github/workflows/run_integration_tests.yml
174+
# with:
175+
# major: ${{ matrix.major }}
176+
# minor: ${{ matrix.minor }}
137177

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

@@ -163,7 +204,18 @@ jobs:
163204
bash tools/deploy.sh ./deploy
164205
165206
- name: Deploy artifact
166-
uses: actions/upload-artifact@v3
207+
uses: actions/upload-artifact@v4
167208
with:
168209
name: deploy
169210
path: deploy
211+
212+
completion_gate: # Serves as a non-moving target for branch rulesets
213+
if: always() && !cancelled()
214+
name: Completion Gate
215+
needs: [test_windows, compile_all_maps, run_linters, run_all_tests]
216+
runs-on: ubuntu-latest
217+
steps:
218+
- name: Decide whether the needed jobs succeeded or failed
219+
uses: re-actors/alls-green@release/v1
220+
with:
221+
jobs: ${{ toJSON(needs) }}

.github/workflows/codeowner_reviews.yml

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on: pull_request_target
66
jobs:
77
assign-users:
88
runs-on: ubuntu-latest
9+
timeout-minutes: 5
910

1011
steps:
1112
# Checks-out your repository under $GITHUB_WORKSPACE, so the job can access it

.github/workflows/rerun_flaky_tests.yml

+17-17
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
workflow_run:
44
workflows: [Checks]
55
types:
6-
- completed
6+
- completed
77

88
permissions:
99
actions: write
@@ -15,23 +15,23 @@ jobs:
1515
runs-on: ubuntu-latest
1616
if: ${{ github.event.workflow_run.conclusion == 'failure' && github.event.workflow_run.run_attempt == 1 }}
1717
steps:
18-
- name: Checkout
19-
uses: actions/checkout@v3
20-
- name: Rerun flaky tests
21-
uses: actions/github-script@v6
22-
with:
23-
script: |
24-
const { rerunFlakyTests } = await import('${{ github.workspace }}/tools/pull_request_hooks/rerunFlakyTests.js')
25-
await rerunFlakyTests({ github, context })
18+
- name: Checkout
19+
uses: actions/checkout@v3
20+
- name: Rerun flaky tests
21+
uses: actions/github-script@v6
22+
with:
23+
script: |
24+
const { rerunFlakyTests } = await import('${{ github.workspace }}/tools/pull_request_hooks/rerunFlakyTests.js')
25+
await rerunFlakyTests({ github, context })
2626
report_flaky_tests:
2727
runs-on: ubuntu-latest
2828
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.run_attempt == 2 }}
2929
steps:
30-
- name: Checkout
31-
uses: actions/checkout@v3
32-
- name: Report flaky tests
33-
uses: actions/github-script@v6
34-
with:
35-
script: |
36-
const { reportFlakyTests } = await import('${{ github.workspace }}/tools/pull_request_hooks/rerunFlakyTests.js')
37-
await reportFlakyTests({ github, context })
30+
- name: Checkout
31+
uses: actions/checkout@v3
32+
- name: Report flaky tests
33+
uses: actions/github-script@v6
34+
with:
35+
script: |
36+
const { reportFlakyTests } = await import('${{ github.workspace }}/tools/pull_request_hooks/rerunFlakyTests.js')
37+
await reportFlakyTests({ github, context })

.github/workflows/run_integration_tests.yml

+2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ on:
1414
required: false
1515
default: ALL_TESTS
1616
type: string
17+
1718
jobs:
1819
run_integration_tests:
1920
runs-on: ubuntu-latest
21+
timeout-minutes: 15
2022
services:
2123
mysql:
2224
image: mysql:latest

.github/workflows/tgs_test.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ on:
33
push:
44
branches:
55
- master
6+
- 'project/**'
67
- 'gh-readonly-queue/master/**'
8+
- 'gh-readonly-queue/project/**'
79
paths:
810
- '.tgs.yml'
911
- '.github/workflows/tgs_test.yml'
@@ -12,11 +14,13 @@ on:
1214
- 'code/__DEFINES/tgs.dm'
1315
- 'code/game/world.dm'
1416
- 'code/modules/tgs/**'
17+
- 'tools/bootstrap/**'
1518
- 'tools/tgs_scripts/**'
1619
- 'tools/tgs_test/**'
1720
pull_request:
1821
branches:
1922
- master
23+
- 'project/**'
2024
paths:
2125
- '.tgs.yml'
2226
- '.github/workflows/tgs_test.yml'
@@ -25,6 +29,7 @@ on:
2529
- 'code/__DEFINES/tgs.dm'
2630
- 'code/game/world.dm'
2731
- 'code/modules/tgs/**'
32+
- 'tools/bootstrap/**'
2833
- 'tools/tgs_scripts/**'
2934
- 'tools/tgs_test/**'
3035
merge_group:
@@ -54,12 +59,12 @@ jobs:
5459
- 5000:5000 #Can't use env here for some reason
5560
steps:
5661
- name: Setup dotnet
57-
uses: actions/setup-dotnet@v2
62+
uses: actions/setup-dotnet@v4
5863
with:
5964
dotnet-version: 8.0.x
6065

6166
- name: Checkout Repository
62-
uses: actions/checkout@v3
67+
uses: actions/checkout@v4
6368

6469
- name: Test TGS Integration
6570
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 }}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
*.lk
2121
*.int
2222
*.backup
23+
/shiptest.json
2324
### https://raw.github.com/github/gitignore/cc542de017c606138a87ee4880e5f06b3a306def/Global/Linux.gitignore
2425

2526
*~

__odlint.dm

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// This file is included right at the start of the DME.
2+
// Its purpose is to enable multiple lints (pragmas) that are supported by OpenDream to better validate the codebase
3+
// These are essentially nitpicks the DM compiler should pick up on but doesnt
4+
5+
#if !defined(SPACEMAN_DMM) && defined(OPENDREAM)
6+
// This is in a separate file as a hack to avoid SpacemanDMM
7+
// evaluating the #pragma lines, even if its outside a block it cares about
8+
// (Also so people can code-own it. Shoutout to AA)
9+
#include "tools/ci/od_lints.dm"
10+
#endif

check_regex.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ standards:
5757

5858
- no_more:
5959
[
60-
34,
60+
32,
6161
"indentions inside defines",
6262
'^(\s*)#define (\w*)( {2,}| ?\t+)(?!(\/\/|\/\*))',
6363
]

code/__DEFINES/misc.dm

+4
Original file line numberDiff line numberDiff line change
@@ -447,3 +447,7 @@ GLOBAL_LIST_INIT(ghost_others_options, list(GHOST_OTHERS_SIMPLE, GHOST_OTHERS_DE
447447
#define ROUND_END_NOT_DELAYED 0
448448
#define ROUND_END_DELAYED 1
449449
#define ROUND_END_TGS 2
450+
451+
/// A null statement to guard against EmptyBlock lint without necessitating the use of pass()
452+
/// Used to avoid proc-call overhead. But use sparingly. Probably pointless in most places.
453+
#define EMPTY_BLOCK_GUARD ;

code/__HELPERS/_logging.dm

+10-2
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,22 @@
1010
#define WRITE_LOG(log, text) rustg_log_write(log, text, "true")
1111
#define WRITE_LOG_NO_FORMAT(log, text) rustg_log_write(log, text, "false")
1212

13-
//print a warning message to world.log
13+
#ifdef UNIT_TESTS
14+
#define WARNING(MSG) log_world("::warning file=[__FILE__],line=[__LINE__]::[MSG] src: [UNLINT(src)] usr: [usr].")
15+
#else
1416
#define WARNING(MSG) warning("[MSG] in [__FILE__] at line [__LINE__] src: [UNLINT(src)] usr: [usr].")
17+
#endif
18+
/// Print a warning message to world.log
1519
/proc/warning(msg)
1620
msg = "## WARNING: [msg]"
1721
log_world(msg)
1822

19-
//not an error or a warning, but worth to mention on the world log, just in case.
23+
#ifdef UNIT_TESTS
24+
#define NOTICE(MSG) log_world("::notice file=[__FILE__],line=[__LINE__]::[MSG] src: [UNLINT(src)] usr: [usr].")
25+
#else
2026
#define NOTICE(MSG) notice(MSG)
27+
#endif
28+
///not an error or a warning, but worth to mention on the world log, just in case.
2129
/proc/notice(msg)
2230
msg = "## NOTICE: [msg]"
2331
log_world(msg)

0 commit comments

Comments
 (0)