@@ -117,6 +117,7 @@ jobs:
117117 # prepare non-ephemeral runner environment
118118 - name : Prepare environment
119119 run : |
120+ Get-ChildItem -Force
120121 if (Test-Path -Path newlib-cygwin) {
121122 Remove-Item -Recurse -Force newlib-cygwin
122123 }
@@ -197,7 +198,7 @@ jobs:
197198 export MAKEFLAGS="V=1 -j$(nproc)"
198199 export CYGWIN=winsymlinks:sys
199200
200- mkdir build install
201+ mkdir -p build install
201202 (cd newlib-cygwin/winsup && ./autogen.sh)
202203 (cd build && ../newlib-cygwin/configure --target=${{ matrix.arch }}-pc-cygwin --prefix=$(realpath $(pwd)/../install) )
203204 make -C build
@@ -233,33 +234,53 @@ jobs:
233234 path : build.tar.bz2
234235
235236 windows-build :
236- runs-on : windows-latest
237+ runs-on : ${{ matrix.runner }}
237238 strategy :
238239 fail-fast : false
239240 matrix :
240241 include :
241- - target : x86_64-pc-cygwin
242+ - build : x86_64-pc-cygwin
243+ target : x86_64-pc-cygwin
244+ buildarch : x86_64
242245 pkgarch : x86_64
246+ runner : windows-latest
247+ - build : x86_64-pc-cygwin
248+ target : aarch64-pc-cygwin
249+ buildarch : x86_64
250+ pkgarch : aarch64
251+ runner : windows-11-arm
243252 name : Windows native ${{ matrix.pkgarch }}
244253
254+ defaults :
255+ run :
256+ shell : bash --noprofile --norc -eo pipefail -c "$(s=$(/usr/bin/cygpath '{0}') && /usr/bin/sed -i 's/\r$//' $s && echo $s)"
257+ env :
258+ GH_TOKEN : ${{ github.token }}
259+
245260 steps :
246261 # checkout action uses the native git (we can avoid this messing up line
247262 # endings, but this could still be dangerous e.g if we need symlinks in the
248263 # repo)
249- - run : git config --global core.autocrlf input
264+ - name : Configure git
265+ run : |
266+ git config --global core.autocrlf input
267+ shell : powershell
268+
250269 # remove inheritable permissions since they break assumptions testsuite
251270 # makes about file modes
252- - name : adjust permissions
271+ - name : Adjust permissions
253272 run : |
254273 icacls . /inheritance:r
255274 icacls . /grant Administrators:F
275+ shell : powershell
276+
256277 - uses : actions/checkout@v3
257278
258279 # install cygwin and build tools
259280 - name : Install Cygwin
260281 uses : cygwin/cygwin-install-action@master
261282 with :
262- platform : ${{ matrix.pkgarch }}
283+ platform : ${{ matrix.buildarch }}
263284 packages : >-
264285 autoconf,
265286 automake,
@@ -277,8 +298,8 @@ jobs:
277298 libiconv-devel,
278299 libzstd-devel,
279300 make,
280- mingw64-${{ matrix.pkgarch }}-gcc-g++,
281- mingw64-${{ matrix.pkgarch }}-zlib,
301+ mingw64-${{ matrix.buildarch }}-gcc-g++,
302+ mingw64-${{ matrix.buildarch }}-zlib,
282303 patch,
283304 perl,
284305 python39-lxml,
@@ -289,30 +310,54 @@ jobs:
289310 xmlto,
290311 zlib-devel
291312
313+ # download toolchain
314+ - name : Download toolchain
315+ if : ${{ matrix.pkgarch == 'aarch64' }}
316+ run : |
317+ export PATH=/usr/bin:$(cygpath ${SYSTEMROOT})/system32:$PATH
318+ DIGEST=$(gh api repos/${{ github.repository }}/releases/latest \
319+ --jq '.assets[] | select(.name | test("${{ matrix.target }}-toolchain.tar.xz")).digest')
320+ gh release download \
321+ --repo ${{ github.repository }} \
322+ --pattern ${{ matrix.target }}-toolchain.tar.xz
323+ sha256sum -c <<< "${DIGEST#sha256:} ${{ matrix.target }}-toolchain.tar.xz"
324+
325+ # install toolchain
326+ - name : Install toolchain
327+ if : ${{ matrix.pkgarch == 'aarch64' }}
328+ run : |
329+ mkdir -p toolchain/${{ matrix.target }}
330+ tar -xzf ${{ matrix.target }}-toolchain.tar.xz -C toolchain/${{ matrix.target }}
331+
292332 # build
293333 - name : Build Cygwin
294- run : >-
295- export PATH=/usr/bin:$(cygpath ${SYSTEMROOT})/system32 &&
296- export DESTDIR=$(realpath $(pwd)/install) &&
297- mkdir build install &&
298- (cd winsup; ./autogen.sh) &&
299- cd build &&
300- ../configure --prefix=/usr -v &&
301- export MAKEFLAGS=-j$(nproc) &&
302- make &&
303- export CYGWIN=winsymlinks:sys &&
304- make install -j1 tooldir=/usr gcc_tooldir=/usr DESTDIR=${DESTDIR} &&
305- (cd */newlib; make info man) &&
334+ run : |
335+ if [[ "${{ matrix.pkgarch }}" == "aarch64" ]]; then
336+ export PATH=$(pwd)/toolchain/${{ matrix.target }}/bin:/usr/bin:$(cygpath ${SYSTEMROOT})/system32
337+ export CXXFLAGS_FOR_TARGET="-D_WIN64 -I$(pwd)/toolchain/${{ matrix.target }}/include"
338+ export LDFLAGS_FOR_TARGET="-L$(pwd)/toolchain/${{ matrix.target }}/lib"
339+ else
340+ export PATH=/usr/bin:$(cygpath ${SYSTEMROOT})/system32
341+ fi
342+ echo PATH=$PATH
343+ export DESTDIR=$(realpath $(pwd)/install)
344+ mkdir build install
345+ (cd winsup; ./autogen.sh)
346+ cd build
347+ ../configure --prefix=/usr --build=${{ matrix.build }} --target=${{ matrix.target }} -v
348+ export MAKEFLAGS=-j$(nproc)
349+ make
350+ export CYGWIN=winsymlinks:sys
351+ make install -j1 tooldir=/usr gcc_tooldir=/usr DESTDIR=${DESTDIR}
352+ (cd */newlib; make info man)
306353 (cd */newlib; make install-info install-man tooldir=/usr gcc_tooldir=/usr DESTDIR=${DESTDIR})
307- shell : bash --noprofile --norc -eo pipefail '{0}'
308354
309355 # adjust install so it matches the physical arrangement of directories when
310356 # unpacked by setup
311357 - name : Rearrange for default mountpoints
312358 run : |
313359 mv -v install/usr/bin install/bin
314360 mv -v install/usr/lib install/lib
315- shell : bash --noprofile --norc -o igncr -eo pipefail '{0}'
316361
317362 # upload installed cygwin as an artifact, for subsequent use in
318363 # test job(s)
@@ -325,24 +370,52 @@ jobs:
325370
326371 # test
327372 - name : Test Cygwin
328- run : >-
329- export PATH=/usr/bin:$(cygpath ${SYSTEMROOT})/system32 &&
330- export MAKEFLAGS=-j$(nproc) &&
331- cd build &&
332- (export PATH=${{ matrix.target }}/winsup/testsuite/testinst/bin:${PATH} && cmd /c $(cygpath -wa ${{ matrix.target }}/winsup/cygserver/cygserver) &) &&
373+ run : |
374+ if [[ "${{ matrix.pkgarch }}" == "aarch64" ]]; then
375+ export PATH=$(pwd)/toolchain/${{ matrix.target }}/bin:/usr/bin:$(cygpath ${SYSTEMROOT})/system32
376+ else
377+ export PATH=/usr/bin:$(cygpath ${SYSTEMROOT})/system32
378+ fi
379+ export MAKEFLAGS=-j$(nproc)
380+ cd build
381+ (export PATH=${{ matrix.target }}/winsup/testsuite/testinst/bin:${PATH} && cmd /c $(cygpath -wa ${{ matrix.target }}/winsup/cygserver/cygserver) &)
333382 (cd ${{ matrix.target }}/winsup; make check AM_COLOR_TESTS=always)
334- shell : bash --noprofile --norc -eo pipefail '{0}'
383+ continue-on-error : ${{ matrix.pkgarch == 'aarch64' }}
384+
385+ # kill hanging processes
386+ - name : Kill hanging processes
387+ if : ${{ matrix.pkgarch == 'aarch64' && always() }}
388+ run : |
389+ taskkill /F /FI 'MODULES eq cygwin1.dll'
390+ if (Test-Path -Path ${{ github.workspace }}\build\${{ matrix.target }}\winsup\testsuite\testinst\tmp) {
391+ Remove-Item -Recurse -Force ${{ github.workspace }}\build\${{ matrix.target }}\winsup\testsuite\testinst\tmp
392+ }
393+ exit 0
394+ shell : powershell
335395
336396 # upload test logs to facilitate investigation of problems
337397 - name : Upload test logs
338398 uses : actions/upload-artifact@v4
339399 with :
340- name : testlogs
400+ name : testlogs-${{ matrix.pkgarch }}
341401 path : |
342402 build/${{ matrix.target }}/winsup/testsuite/**/*.log
343403 build/${{ matrix.target }}/winsup/testsuite/**/*.trs
344404 if : ${{ !cancelled() }}
345405
406+ - name : Pack build folder
407+ if : failure()
408+ run : |
409+ tar -cjf cygwin-${{ matrix.target }}-build.tar.bz2 build/
410+
411+ - name : Upload build folder
412+ if : failure()
413+ uses : actions/upload-artifact@v4
414+ with :
415+ name : cygwin-${{ matrix.target }}-build
416+ retention-days : 1
417+ path : cygwin-${{ matrix.target }}-build.tar.bz2
418+
346419 # workaround problems with actions/checkout post-run step using cygwin git
347420 - name : Avoid actions/checkout post-run step using Cygwin git
348421 run : bash -c 'rm /usr/bin/git.exe'
0 commit comments