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+ - name : Install doc dependencies
75+ if : inputs.docs
76+ run : |
77+ pip install sphinx
7578 - name : Clone DFHack
7679 uses : actions/checkout@v4
7780 with :
@@ -108,49 +111,82 @@ jobs:
108111 ref : main
109112 ssh-key : ${{ secrets.DFHACK_3RDPARTY_TOKEN }}
110113 path : depends/steam
114+ - name : Prepare output directories
115+ run : |
116+ mkdir output
117+ mkdir pdb
118+ - name : Get sccache path
119+ run : echo ("SCCACHE_DIR=" + $env:LOCALAPPDATA + "\Mozilla\sccache\cache") >> $env:GITHUB_ENV
111120 - name : Fetch ccache
112121 if : inputs.platform-files
113122 uses : actions/cache/restore@v4
114123 with :
115- path : build/win64-cross/ccache
124+ path : ${{ env.SCCACHE_DIR }}
116125 key : win-msvc-${{ inputs.cache-id }}-${{ github.sha }}
117126 restore-keys : |
118127 win-msvc-${{ inputs.cache-id }}
119128 win-msvc
120- - name : Cross-compile
129+ - uses : ilammy/msvc-dev-cmd@v1
130+ - name : Configure DFHack
131+ run : |
132+ cmake `
133+ -S . `
134+ -B build `
135+ -GNinja `
136+ -DDFHACK_BUILD_ARCH=64 `
137+ -DCMAKE_BUILD_TYPE=Release `
138+ -DCMAKE_INSTALL_PREFIX=output `
139+ -DCMAKE_C_COMPILER_LAUNCHER=sccache `
140+ -DCMAKE_CXX_COMPILER_LAUNCHER=sccache `
141+ -DBUILD_PDBS:BOOL=${{ inputs.cache-id == 'release' }} `
142+ -DDFHACK_RUN_URL='https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' `
143+ -DBUILD_LIBRARY=${{ inputs.platform-files }} `
144+ -DBUILD_PLUGINS:BOOL=${{ inputs.platform-files && inputs.plugins }} `
145+ -DBUILD_STONESENSE:BOOL=${{ inputs.stonesense }} `
146+ -DBUILD_DOCS:BOOL=${{ inputs.docs }} `
147+ -DBUILD_DOCS_NO_HTML:BOOL=${{ !inputs.html }} `
148+ -DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} `
149+ -DBUILD_DFLAUNCH:BOOL=${{ inputs.launchdf }} `
150+ -DBUILD_TESTS:BOOL=${{ inputs.tests }} `
151+ -DBUILD_XMLDUMP:BOOL=${{ inputs.xml-dump-type-sizes }} `
152+ ${{ inputs.xml-dump-type-sizes && '-DINSTALL_XMLDUMP:BOOL=1' || '' }}
153+ - name : Build DFHack
121154 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' || '' }}
155+ SCCACHE_CACHE_SIZE : 500M
123156 run : |
124- cd build
125- bash -x build-win64-from-linux.sh
157+ ninja install -C build
126158 - name : Finalize cache
127159 run : |
128160 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
161+ sccache --show-stats
162+ sccache --zero-stats
134163 - name : Save ccache
135164 if : inputs.platform-files && !inputs.cache-readonly
136165 uses : actions/cache/save@v4
137166 with :
138- path : build/win64-cross/ccache
167+ path : ${{ env.SCCACHE_DIR }}
139168 key : win-msvc-${{ inputs.cache-id }}-${{ github.sha }}
140169 - name : Format artifact name
141170 if : inputs.artifact-name
142171 id : artifactname
143172 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
173+ if ("${{ inputs.append-date-and-hash }}" -eq "false") {
174+ "name=${{ inputs.artifact-name }}" | Out-File -Append $env:GITHUB_OUTPUT
175+ } else {
176+ $date = Get-Date -Format "yyyMMdd"
177+ $hash = git rev-parse --short HEAD
178+ "name=${{ inputs.artifact-name}}-$date-$hash" | Out-File -Append $env:GITHUB_OUTPUT
179+ }
180+ - name : Prep pdbs
181+ if : inputs.artifact-name && inputs.cache-id == 'release'
182+ run : |
183+ Get-ChildItem -Recurse -File -Path "build" -Filter *.pdb |
184+ Copy-Item -Destination "pdb"
149185 - name : Prep artifact
150- if : inputs.artifact-name
151186 run : |
152- cd build/win64-cross/output
153- tar cjf ../../../${{ steps.artifactname.outputs.name }}.tar.bz2 .
187+ cd output
188+ 7z a -ttar -so -an . |
189+ 7z a -si -tbzip2 ../${{ steps.artifactname.outputs.name }}.tar.bz2
154190 - name : Upload artifact
155191 if : inputs.artifact-name
156192 uses : actions/upload-artifact@v4
@@ -162,4 +198,4 @@ jobs:
162198 uses : actions/upload-artifact@v4
163199 with :
164200 name : ${{ steps.artifactname.outputs.name }}_pdb
165- path : build/win64-cross/ pdb
201+ path : pdb
0 commit comments