Skip to content

Commit 0798023

Browse files
committed
Sync
1 parent 07874e7 commit 0798023

File tree

118 files changed

+10875
-3912
lines changed

Some content is hidden

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

118 files changed

+10875
-3912
lines changed

.github/workflows/build-windows.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ on:
3232
platform-files:
3333
type: boolean
3434
default: true
35+
plugins:
36+
type: boolean
37+
default: true
3538
common-files:
3639
type: boolean
3740
default: true
@@ -104,7 +107,7 @@ jobs:
104107
win-msvc
105108
- name: Cross-compile
106109
env:
107-
CMAKE_EXTRA_ARGS: -DBUILD_LIBRARY=${{ inputs.platform-files }} -DBUILD_STONESENSE:BOOL=${{ inputs.stonesense }} -DBUILD_DOCS:BOOL=${{ inputs.docs }} -DBUILD_DOCS_NO_HTML:BOOL=${{ !inputs.html }} -DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} -DINSTALL_SCRIPTS:BOOL=${{ inputs.common-files }} -DBUILD_DFLAUNCH:BOOL=${{ inputs.launchdf }} -DBUILD_TESTS:BOOL=${{ inputs.tests }} -DBUILD_XMLDUMP:BOOL=${{ inputs.xml-dump-type-sizes }} ${{ inputs.xml-dump-type-sizes && '-DINSTALL_XMLDUMP:BOOL=1' || '' }}
110+
CMAKE_EXTRA_ARGS: -DBUILD_LIBRARY=${{ inputs.platform-files }} -DBUILD_PLUGINS:BOOL=${{ inputs.platform-files && inputs.plugins }} -DBUILD_STONESENSE:BOOL=${{ inputs.stonesense }} -DBUILD_DOCS:BOOL=${{ inputs.docs }} -DBUILD_DOCS_NO_HTML:BOOL=${{ !inputs.html }} -DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} -DINSTALL_SCRIPTS:BOOL=${{ inputs.common-files }} -DBUILD_DFLAUNCH:BOOL=${{ inputs.launchdf }} -DBUILD_TESTS:BOOL=${{ inputs.tests }} -DBUILD_XMLDUMP:BOOL=${{ inputs.xml-dump-type-sizes }} ${{ inputs.xml-dump-type-sizes && '-DINSTALL_XMLDUMP:BOOL=1' || '' }}
108111
run: |
109112
cd build
110113
bash -x build-win64-from-linux.sh

.github/workflows/generate-symbols.yml

Lines changed: 128 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
required: true
99
default: master
1010
version:
11-
description: DF version
11+
description: DF version (can be "auto" if channel is steam)
1212
required: true
1313
platform:
1414
description: Target OS platform
@@ -44,7 +44,7 @@ on:
4444
type: string
4545

4646
jobs:
47-
package:
47+
package-linux:
4848
uses: ./.github/workflows/build-linux.yml
4949
if: inputs.platform == 'all' || inputs.platform == 'linux'
5050
with:
@@ -57,12 +57,25 @@ jobs:
5757
plugins: false
5858
secrets: inherit
5959

60+
package-win64:
61+
uses: ./.github/workflows/build-windows.yml
62+
if: (inputs.platform == 'all' || inputs.platform == 'windows') && inputs.version == 'auto'
63+
with:
64+
dfhack_ref: ${{ github.ref }}
65+
structures_ref: ${{ inputs.structures_ref }}
66+
artifact-name: dfhack-symbols-windows64-build
67+
append-date-and-hash: false
68+
cache-id: release
69+
cache-readonly: true
70+
plugins: false
71+
secrets: inherit
72+
6073
generate-linux:
6174
name: Generate linux64 symbols
6275
runs-on: ubuntu-latest
6376
if: inputs.platform == 'all' || inputs.platform == 'linux'
6477
needs:
65-
- package
78+
- package-linux
6679
steps:
6780
- name: Install dependencies
6881
run: |
@@ -119,11 +132,29 @@ jobs:
119132
"+app_update 975370 $BETA_PARAMS validate" \
120133
+quit
121134
tar xjf dfhack-symbols-linux64-build.tar.bz2 -C DF_steam
122-
xml/symbols_gen_linux.sh ${{ inputs.version }} STEAM DF_steam
135+
xml/symbols_gen_linux.sh ${{ inputs.version == 'auto' && '50.0' || inputs.version }} STEAM DF_steam
136+
if [ "${{ inputs.version }}" = "auto" ]; then
137+
while pgrep dwarfort; do
138+
echo "waiting for DF to exit"
139+
sleep 0.5
140+
done
141+
cp xml/symbols.xml DF_steam/hack
142+
cd DF_steam
143+
DFHACK_DISABLE_CONSOLE=1 ./dfhack &
144+
while ! ./dfhack-run lua 'print(scr)' | fgrep 'viewscreen_titlest' 2>/dev/null; do
145+
echo "waiting for DF to start"
146+
sleep 0.5
147+
done
148+
df_ver=`./dfhack-run lua 'print(dfhack.gui.getDFViewscreen(true).str_version)' | ansifilter`
149+
echo "Found version string: '$df_ver'"
150+
echo "DETECTED_DF_VER=$df_ver" >>$GITHUB_ENV
151+
sed -i "s/v0.50.0 linux64 STEAM/v0.$df_ver linux64 STEAM/" ../xml/symbols.xml
152+
./dfhack-run die || true
153+
fi
123154
124155
# Itch
125156
- name: Generate Itch symbols
126-
if: inputs.channel == 'all' || inputs.channel == 'itch'
157+
if: (inputs.channel == 'all' || inputs.channel == 'itch') && inputs.version != 'auto'
127158
env:
128159
DISPLAY: :0
129160
ITCH_API_KEY: ${{ secrets.ITCH_API_KEY }}
@@ -139,7 +170,7 @@ jobs:
139170
140171
# Classic
141172
- name: Generate Classic symbols
142-
if: inputs.channel == 'all' || inputs.channel == 'classic'
173+
if: (inputs.channel == 'all' || inputs.channel == 'classic') && inputs.version != 'auto'
143174
env:
144175
DISPLAY: :0
145176
run: |
@@ -164,7 +195,7 @@ jobs:
164195
- name: Commit symbol updates
165196
uses: stefanzweifel/git-auto-commit-action@v5
166197
with:
167-
commit_message: Auto-update symbols
198+
commit_message: Auto-update symbols for Linux DF version ${{ env.DETECTED_DF_VER || inputs.version }}
168199
repository: xml
169200
commit_user_name: DFHack-Urist via GitHub Actions
170201
commit_user_email: [email protected]
@@ -227,11 +258,11 @@ jobs:
227258
+login $STEAM_USERNAME \
228259
"+app_update 975370 $BETA_PARAMS validate" \
229260
+quit
230-
xml/symbols_gen_windows.sh ${{ inputs.version }} STEAM DF_steam
261+
xml/symbols_gen_windows.sh ${{ inputs.version == 'auto' && '50.0' || inputs.version }} STEAM DF_steam
231262
232263
# Itch
233264
- name: Generate Itch symbols
234-
if: inputs.channel == 'all' || inputs.channel == 'itch'
265+
if: (inputs.channel == 'all' || inputs.channel == 'itch') && inputs.version != 'auto'
235266
env:
236267
ITCH_API_KEY: ${{ secrets.ITCH_API_KEY }}
237268
run: |
@@ -245,7 +276,7 @@ jobs:
245276
246277
# Classic
247278
- name: Generate Classic symbols
248-
if: inputs.channel == 'all' || inputs.channel == 'classic'
279+
if: (inputs.channel == 'all' || inputs.channel == 'classic') && inputs.version != 'auto'
249280
run: |
250281
mkdir DF_classic
251282
minor=$(echo "${{ inputs.version }}" | cut -d. -f1)
@@ -267,7 +298,86 @@ jobs:
267298
- name: Commit symbol updates
268299
uses: stefanzweifel/git-auto-commit-action@v5
269300
with:
270-
commit_message: Auto-update symbols
301+
commit_message: Auto-update symbols for Windows DF version ${{ inputs.version }}
302+
repository: xml
303+
commit_user_name: DFHack-Urist via GitHub Actions
304+
commit_user_email: [email protected]
305+
306+
auto-ver-windows:
307+
name: Autodetect DF version string (Windows)
308+
if: (inputs.platform == 'all' || inputs.platform == 'windows') && (inputs.channel == 'all' || inputs.channel == 'steam') && inputs.version == 'auto'
309+
needs:
310+
- package-win64
311+
- generate-windows
312+
runs-on: windows-latest
313+
steps:
314+
- name: Clone structures
315+
uses: actions/checkout@v4
316+
with:
317+
repository: DFHack/df-structures
318+
ref: ${{ inputs.structures_ref }}
319+
token: ${{ secrets.DFHACK_GITHUB_TOKEN }}
320+
path: xml
321+
- name: Download DFHack
322+
uses: actions/download-artifact@v4
323+
with:
324+
name: dfhack-symbols-windows64-build
325+
- name: Setup steamcmd
326+
id: steamcmd
327+
uses: CyberAndrii/setup-steamcmd@v1
328+
- name: Update DF version string
329+
env:
330+
STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }}
331+
STEAM_CONFIG_VDF: ${{ secrets.STEAM_CONFIG_VDF }}
332+
STEAM_DF_TESTING: ${{ secrets.STEAM_DF_TESTING }}
333+
STEAM_DF_ADVENTURE_TEST: ${{ secrets.STEAM_DF_ADVENTURE_TEST }}
334+
shell: bash
335+
run: |
336+
mkdir DF_steam
337+
echo "$STEAM_CONFIG_VDF" | base64 -d >${{ steps.steamcmd.outputs.directory }}/config/config.vdf
338+
echo "DF steam branch: ${{ inputs.df_steam_branch }}"
339+
if [ "${{ inputs.df_steam_branch }}" = "default" ]; then
340+
BETA_PARAMS=""
341+
elif [ "${{ inputs.df_steam_branch }}" = "testing" ]; then
342+
BETA_PARAMS="-beta testing -betapassword $STEAM_DF_TESTING"
343+
elif [ "${{ inputs.df_steam_branch }}" = "adventure_test" ]; then
344+
BETA_PARAMS="-beta adventure_test -betapassword $STEAM_DF_ADVENTURE_TEST"
345+
else
346+
BETA_PARAMS="-beta ${{ inputs.df_steam_branch }}"
347+
fi
348+
${{ steps.steamcmd.outputs.executable }} \
349+
+@ShutdownOnFailedCommand 1 \
350+
+@sSteamCmdForcePlatformType windows \
351+
+force_install_dir $PWD/DF_steam \
352+
+login $STEAM_USERNAME \
353+
"+app_update 975370 $BETA_PARAMS validate" \
354+
+quit
355+
tar xjf dfhack-symbols-windows64-build.tar.bz2 -C DF_steam
356+
cp xml/symbols.xml DF_steam/hack
357+
cd DF_steam
358+
"./Dwarf Fortress.exe" &
359+
while ! ./dfhack-run.exe lua 'print(scr)' | fgrep 'viewscreen_titlest' 2>/dev/null; do
360+
echo "waiting for DF to start"
361+
sleep 0.5
362+
done
363+
df_ver=`./dfhack-run.exe lua 'print(dfhack.gui.getDFViewscreen(true).str_version)'`
364+
echo "Found version string: '$df_ver'"
365+
echo "DETECTED_DF_VER=$df_ver" >>$GITHUB_ENV
366+
sed -i "s/v0.50.0 win64 STEAM/v0.$df_ver win64 STEAM/" ../xml/symbols.xml
367+
./dfhack-run.exe die || true
368+
- name: Merge updates
369+
shell: bash
370+
run: |
371+
cd xml
372+
if ! git diff --exit-code; then
373+
git stash
374+
git pull
375+
git stash pop
376+
fi
377+
- name: Commit symbol updates
378+
uses: stefanzweifel/git-auto-commit-action@v5
379+
with:
380+
commit_message: Auto-update Windows DF version to ${{ env.DETECTED_DF_VER }} in symbols
271381
repository: xml
272382
commit_user_name: DFHack-Urist via GitHub Actions
273383
commit_user_email: [email protected]
@@ -277,28 +387,32 @@ jobs:
277387
runs-on: ubuntu-latest
278388
needs:
279389
- generate-linux
280-
- generate-windows
390+
- auto-ver-windows
281391
if: ${{ ! failure() }}
282392
steps:
283393
- name: Clone DFHack
284394
uses: actions/checkout@v4
285395
with:
286396
token: ${{ secrets.DFHACK_GITHUB_TOKEN }}
287397
- name: Update ref
398+
shell: bash
288399
run: |
289400
git submodule update --init --no-single-branch library/xml
290401
cd library/xml
291402
git checkout ${{ inputs.structures_ref }}
292403
git pull
404+
df_ver=`grep -E 'symbol-table.*STEAM' symbols.xml | head -n1 | sed -r "s/.*name='v0.([^ ]+) .*/\1/"`
405+
echo "using DF version: $df_ver"
406+
echo "DETECTED_DF_VER=$df_ver" >>$GITHUB_ENV
293407
- name: Commit ref update
294408
uses: stefanzweifel/git-auto-commit-action@v5
295409
with:
296-
commit_message: Auto-update structures ref
410+
commit_message: Auto-update structures ref for ${{ env.DETECTED_DF_VER }}
297411
commit_user_name: DFHack-Urist via GitHub Actions
298412
commit_user_email: [email protected]
299413
- name: Launch steam-deploy
300414
if: inputs.steam_branch
301415
shell: bash
302416
env:
303417
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
304-
run: gh workflow run steam-deploy.yml -R DFHack/dfhack -r ${{ github.ref }} -f version=${{ inputs.version }} -f steam_branch=${{ inputs.steam_branch }}
418+
run: gh workflow run steam-deploy.yml -R DFHack/dfhack -r ${{ github.ref }} -f version=${{ env.DETECTED_DF_VER }} -f steam_branch=${{ inputs.steam_branch }}

.github/workflows/steam-deploy.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,15 @@ jobs:
7474
rm ${name}-depot.tar.bz2
7575
cd ..
7676
done
77+
- name: Get short SHA of commit
78+
run: echo "SHORT_SHA=`echo ${{ github.sha }} | cut -c1-8`" >>$GITHUB_ENV
7779
- name: Steam deploy
7880
uses: game-ci/steam-deploy@v3
7981
with:
8082
username: ${{ secrets.STEAM_USERNAME }}
8183
configVdf: ${{ secrets.STEAM_CONFIG_VDF}}
8284
appId: 2346660
83-
buildDescription: ${{ github.event.inputs && github.event.inputs.version || github.ref_name }}
85+
buildDescription: ${{ github.event.inputs && github.event.inputs.version || github.ref_name }} (${{ env.SHORT_SHA }})
8486
rootPath: .
8587
depot1Path: common-depot
8688
depot2Path: win64-depot

.github/workflows/watch-df-steam.yml

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,27 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
# dfhack_ref: leave blank if no structures update is desired
18-
# structures_ref: leave blank to default to master
19-
# steam_branch: leave blank if no steam push is desired
17+
# df_steam_branch: which DF Steam branch to watch
2018
# platform: leave blank to default to all
21-
# channel: leave blank to default to all; should usually be steam
19+
# structures_ref: leave blank to default to master
20+
# dfhack_ref: leave blank if no structures update is desired
21+
# steam_branch: leave blank if no DFHack steam push is desired
2222
include:
2323
- df_steam_branch: public
24-
version: public
2524
- df_steam_branch: beta
26-
version: 51.01-beta
27-
channel: steam
28-
dfhack_ref: adv-beta
2925
structures_ref: adv-beta
26+
dfhack_ref: adv-beta
3027
steam_branch: adventure-beta
3128
- df_steam_branch: testing
32-
version: testing
33-
channel: steam
34-
dfhack_ref: testing
3529
structures_ref: testing
30+
dfhack_ref: testing
3631
steps:
3732
- name: Fetch state
3833
uses: actions/cache/restore@v4
3934
with:
4035
path: state
41-
key: watchstate-${{ matrix.version }}
42-
restore-keys: watchstate-${{ matrix.version }}
36+
key: watchstate-${{ matrix.df_steam_branch }}
37+
restore-keys: watchstate-${{ matrix.df_steam_branch }}
4338
- name: Compare branch metadata
4439
uses: nick-fields/retry@v3
4540
with:
@@ -77,14 +72,14 @@ jobs:
7772
-R DFHack/dfhack \
7873
-r ${{ matrix.dfhack_ref }} \
7974
-f structures_ref=${{ matrix.structures_ref }} \
80-
-f version=${{ matrix.version }} \
75+
-f version=auto \
8176
-f platform=${{ matrix.platform }} \
82-
-f channel=${{ matrix.channel }} \
77+
-f channel=steam \
8378
-f df_steam_branch=${{ matrix.df_steam_branch }} \
8479
-f steam_branch=${{ matrix.steam_branch }}
8580
- name: Save state
8681
uses: actions/cache/save@v4
8782
if: env.TIMESTAMP
8883
with:
8984
path: state
90-
key: watchstate-${{ matrix.version }}-${{ env.TIMESTAMP }}
85+
key: watchstate-${{ matrix.df_steam_branch }}-${{ env.TIMESTAMP }}

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ci:
44
repos:
55
# shared across repos:
66
- repo: https://github.com/pre-commit/pre-commit-hooks
7-
rev: v4.6.0
7+
rev: v5.0.0
88
hooks:
99
- id: check-added-large-files
1010
- id: check-case-conflict
@@ -20,7 +20,7 @@ repos:
2020
args: ['--fix=lf']
2121
- id: trailing-whitespace
2222
- repo: https://github.com/python-jsonschema/check-jsonschema
23-
rev: 0.29.2
23+
rev: 0.30.0
2424
hooks:
2525
- id: check-github-workflows
2626
- repo: https://github.com/Lucas-C/pre-commit-hooks

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ endif()
5656

5757
if(WIN32)
5858
set(MSVC_MIN_VER 1930)
59-
set(MSVC_MAX_VER 1941)
59+
set(MSVC_MAX_VER 1942)
6060
if(NOT MSVC)
6161
message(SEND_ERROR "No MSVC found! MSVC 2022 version ${MSVC_MIN_VER} to ${MSVC_MAX_VER} is required.")
6262
elseif((MSVC_VERSION LESS MSVC_MIN_VER) OR (MSVC_VERSION GREATER MSVC_MAX_VER))

build/build-win64-from-linux.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ if [[ $(id -u) -eq 0 ]]; then
3232
chown -R $builder_uid win64-cross
3333
fi
3434

35-
# Assumes you built a container image called dfhack-build-msvc from
36-
# https://github.com/BenLubar/build-env/tree/master/msvc, see
37-
# docs/dev/compile/Compile.rst.
35+
# Pulls the MSVC build env container from the GitHub registry
3836
#
3937
# NOTE: win64-cross is mounted in /src/build due to the hardcoded `cmake ..` in
4038
# the Dockerfile
@@ -44,7 +42,7 @@ if ! docker run --rm -i -v "$srcdir":/src -v "$srcdir/build/win64-cross/":/src/b
4442
-e steam_username \
4543
-e steam_password \
4644
--name dfhack-win \
47-
ghcr.io/dfhack/build-env:msvc \
45+
ghcr.io/dfhack/build-env:master \
4846
bash -c "cd /src/build && dfhack-configure windows 64 Release -DCMAKE_INSTALL_PREFIX=/src/build/output -DBUILD_DOCS=1 $CMAKE_EXTRA_ARGS && dfhack-make -j$jobs install" \
4947
; then
5048
echo

data/base_command_counts.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
"gui/mechanisms": 1,
9999
"gui/pathable": 1,
100100
"hotkeys": 1,
101-
"infiniteSky": 1,
101+
"infinite-sky": 1,
102102
"force": 1,
103103
"hermit": 1,
104104
"strangemood": 1,

0 commit comments

Comments
 (0)