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,80 @@ 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
111118 - name : Fetch ccache
112119 if : inputs.platform-files
113120 uses : actions/cache/restore@v4
114121 with :
115- path : build/win64-cross/ccache
122+ path : C:\\Users\\runneradmin\\AppData\\Local\\Mozilla\\sccache\\cache
116123 key : win-msvc-${{ inputs.cache-id }}-${{ github.sha }}
117124 restore-keys : |
118125 win-msvc-${{ inputs.cache-id }}
119126 win-msvc
127+ - uses : ilammy/msvc-dev-cmd@v1
128+ - name : Configure DFHack
129+ run : |
130+ cmake `
131+ -S . `
132+ -B build `
133+ -GNinja `
134+ -DDFHACK_BUILD_ARCH=64 `
135+ -DCMAKE_BUILD_TYPE=Release `
136+ -DCMAKE_INSTALL_PREFIX=output `
137+ -DCMAKE_C_COMPILER_LAUNCHER=sccache `
138+ -DCMAKE_CXX_COMPILER_LAUNCHER=sccache `
139+ -DBUILD_PDBS:BOOL=${{ inputs.cache-id == 'release' }} `
140+ -DDFHACK_RUN_URL='https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id}}' `
141+ -DBUILD_LIBRARY=${{ inputs.platform-files }} `
142+ -DBUILD_PLUGINS:BOOL=${{ inputs.platform-files && inputs.plugins }} `
143+ -DBUILD_STONESENSE:BOOL=${{ inputs.stonesense }} `
144+ -DBUILD_DOCS:BOOL=${{ inputs.docs }} `
145+ -DBUILD_DOCS_NO_HTML:BOOL=${{ !inputs.html }} `
146+ -DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} `
147+ -DBUILD_DFLAUNCH:BOOL=${{ inputs.launchdf }} `
148+ -DBUILD_TESTS:BOOL=${{ inputs.tests }} `
149+ -DBUILD_XMLDUMP:BOOL=${{ inputs.xml-dump-type-sizes }} `
150+ ${{ inputs.xml-dump-type-sizes && '-DINSTALL_XMLDUMP:BOOL=1' || '' }}
120151 - name : Cross-compile
121152 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' || '' }}
153+ SCCACHE_CACHE_SIZE : 500M
123154 run : |
124- cd build
125- bash -x build-win64-from-linux.sh
155+ ninja install -C build
126156 - name : Finalize cache
127157 run : |
128158 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
159+ sccache --show-stats
160+ sccache --zero-stats
134161 - name : Save ccache
135162 if : inputs.platform-files && !inputs.cache-readonly
136163 uses : actions/cache/save@v4
137164 with :
138- path : build/win64-cross/ccache
165+ path : C:\\Users\\runneradmin\\AppData\\Local\\Mozilla\\sccache\\cache
139166 key : win-msvc-${{ inputs.cache-id }}-${{ github.sha }}
140167 - name : Format artifact name
141168 if : inputs.artifact-name
142169 id : artifactname
143170 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
171+ if ("${{ inputs.append-date-and-hash }}" -eq "false") {
172+ "name=${{ inputs.artifact-name }}" | Out-File -Append $env:GITHUB_OUTPUT
173+ } else {
174+ $date = Get-Date -Format "yyyMMdd"
175+ $hash = git rev-parse --short HEAD
176+ "name=${{ inputs.artifact-name}}-$date-$hash" | Out-File -Append $env:GITHUB_OUTPUT
177+ }
178+ - name : Prep pdbs
179+ if : inputs.artifact-name && inputs.cache-id == 'release'
180+ run : |
181+ Get-ChildItem -Recurse -File -Path "build" -Filter *.pdb |
182+ Copy-Item -Destination "pdb"
149183 - name : Prep artifact
150- if : inputs.artifact-name
151184 run : |
152- cd build/win64-cross/output
153- tar cjf ../../../${{ steps.artifactname.outputs.name }}.tar.bz2 .
185+ cd output
186+ 7z a -ttar -so -an . |
187+ 7z a -si -tbzip2 ../${{ steps.artifactname.outputs.name }}.tar.bz2
154188 - name : Upload artifact
155189 if : inputs.artifact-name
156190 uses : actions/upload-artifact@v4
@@ -162,4 +196,5 @@ jobs:
162196 uses : actions/upload-artifact@v4
163197 with :
164198 name : ${{ steps.artifactname.outputs.name }}_pdb
165- path : build/win64-cross/pdb
199+ path : pdb
200+
0 commit comments