6666jobs :
6767 build-win64 :
6868 name : Build win64
69- runs-on : ubuntu-22.04
69+ runs-on : windows-2022
7070 steps :
71- - name : Install dependencies
71+ - name : Install build dependencies
7272 run : |
73- sudo apt-get update
74- sudo apt-get install ccache
73+ choco install sccache
74+ pip install Jinja2
75+ - name : Install doc dependencies
76+ if : inputs.docs
77+ run : |
78+ pip install sphinx
7579 - name : Clone DFHack
7680 uses : actions/checkout@v4
7781 with :
@@ -108,49 +112,82 @@ jobs:
108112 ref : main
109113 ssh-key : ${{ secrets.DFHACK_3RDPARTY_TOKEN }}
110114 path : depends/steam
115+ - name : Prepare output directories
116+ run : |
117+ mkdir output
118+ mkdir pdb
119+ - name : Get sccache path
120+ run : echo ("SCCACHE_DIR=" + $env:LOCALAPPDATA + "\Mozilla\sccache\cache") >> $env:GITHUB_ENV
111121 - name : Fetch ccache
112122 if : inputs.platform-files
113123 uses : actions/cache/restore@v4
114124 with :
115- path : build/win64-cross/ccache
125+ path : ${{ env.SCCACHE_DIR }}
116126 key : win-msvc-${{ inputs.cache-id }}-${{ github.sha }}
117127 restore-keys : |
118128 win-msvc-${{ inputs.cache-id }}
119129 win-msvc
120- - name : Cross-compile
130+ - uses : ilammy/msvc-dev-cmd@v1
131+ - name : Configure DFHack
132+ run : |
133+ cmake `
134+ -S . `
135+ -B build `
136+ -GNinja `
137+ -DDFHACK_BUILD_ARCH=64 `
138+ -DCMAKE_BUILD_TYPE=Release `
139+ -DCMAKE_INSTALL_PREFIX=output `
140+ -DCMAKE_C_COMPILER_LAUNCHER=sccache `
141+ -DCMAKE_CXX_COMPILER_LAUNCHER=sccache `
142+ -DBUILD_PDBS:BOOL=${{ inputs.cache-id == 'release' }} `
143+ -DDFHACK_RUN_URL='https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' `
144+ -DBUILD_LIBRARY=${{ inputs.platform-files }} `
145+ -DBUILD_PLUGINS:BOOL=${{ inputs.platform-files && inputs.plugins }} `
146+ -DBUILD_STONESENSE:BOOL=${{ inputs.stonesense }} `
147+ -DBUILD_DOCS:BOOL=${{ inputs.docs }} `
148+ -DBUILD_DOCS_NO_HTML:BOOL=${{ !inputs.html }} `
149+ -DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} `
150+ -DBUILD_DFLAUNCH:BOOL=${{ inputs.launchdf }} `
151+ -DBUILD_TESTS:BOOL=${{ inputs.tests }} `
152+ -DBUILD_XMLDUMP:BOOL=${{ inputs.xml-dump-type-sizes }} `
153+ ${{ inputs.xml-dump-type-sizes && '-DINSTALL_XMLDUMP:BOOL=1' || '' }}
154+ - name : Build DFHack
121155 env :
122- CMAKE_EXTRA_ARGS : -DBUILD_PDBS:BOOL=${{ inputs.cache-id == 'release' }} -DDFHACK_RUN_URL='https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' -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' || '' }}
156+ SCCACHE_CACHE_SIZE : 500M
123157 run : |
124- cd build
125- bash -x build-win64-from-linux.sh
158+ ninja install -C build
126159 - name : Finalize cache
127160 run : |
128161 cd build
129- ccache -d win64-cross/ccache --show-stats --verbose
130- ccache -d win64-cross/ccache --max-size ${{ inputs.cache-id == 'release' && '500M' || '150M' }}
131- ccache -d win64-cross/ccache --cleanup
132- ccache -d win64-cross/ccache --max-size ${{ inputs.cache-id == 'release' && '2G' || '500M' }}
133- ccache -d win64-cross/ccache --zero-stats
162+ sccache --show-stats
163+ sccache --zero-stats
134164 - name : Save ccache
135165 if : inputs.platform-files && !inputs.cache-readonly
136166 uses : actions/cache/save@v4
137167 with :
138- path : build/win64-cross/ccache
168+ path : ${{ env.SCCACHE_DIR }}
139169 key : win-msvc-${{ inputs.cache-id }}-${{ github.sha }}
140170 - name : Format artifact name
141171 if : inputs.artifact-name
142172 id : artifactname
143173 run : |
144- if test "false" = "${{ inputs.append-date-and-hash }}"; then
145- echo name=${{ inputs.artifact-name }} >> $GITHUB_OUTPUT
146- else
147- echo name=${{ inputs.artifact-name }}-$(date +%Y%m%d)-$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT
148- fi
174+ if ("${{ inputs.append-date-and-hash }}" -eq "false") {
175+ "name=${{ inputs.artifact-name }}" | Out-File -Append $env:GITHUB_OUTPUT
176+ } else {
177+ $date = Get-Date -Format "yyyMMdd"
178+ $hash = git rev-parse --short HEAD
179+ "name=${{ inputs.artifact-name}}-$date-$hash" | Out-File -Append $env:GITHUB_OUTPUT
180+ }
181+ - name : Prep pdbs
182+ if : inputs.artifact-name && inputs.cache-id == 'release'
183+ run : |
184+ Get-ChildItem -Recurse -File -Path "build" -Filter *.pdb |
185+ Copy-Item -Destination "pdb"
149186 - name : Prep artifact
150- if : inputs.artifact-name
151187 run : |
152- cd build/win64-cross/output
153- tar cjf ../../../${{ steps.artifactname.outputs.name }}.tar.bz2 .
188+ cd output
189+ 7z a -ttar -so -an . |
190+ 7z a -si -tbzip2 ../${{ steps.artifactname.outputs.name }}.tar.bz2
154191 - name : Upload artifact
155192 if : inputs.artifact-name
156193 uses : actions/upload-artifact@v4
@@ -162,4 +199,4 @@ jobs:
162199 uses : actions/upload-artifact@v4
163200 with :
164201 name : ${{ steps.artifactname.outputs.name }}_pdb
165- path : build/win64-cross/ pdb
202+ path : pdb
0 commit comments