---
 .github/workflows/cygwin.yml | 67 +++++++++++++++++++++++++++++++++---
 1 file changed, 62 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/cygwin.yml b/.github/workflows/cygwin.yml
index 53dd06d3c..79abf3d0f 100644
--- a/.github/workflows/cygwin.yml
+++ b/.github/workflows/cygwin.yml
@@ -148,16 +148,34 @@ jobs:
     - name: Build Cygwin
       run: >-
         export PATH=/usr/bin:$(cygpath ${SYSTEMROOT})/system32 &&
+        export DESTDIR=$(realpath $(pwd)/install) &&
         mkdir build install &&
         (cd winsup; ./autogen.sh) &&
         cd build &&
-        ../configure --prefix=$(realpath $(pwd)/../install) -v &&
+        ../configure --prefix=/usr -v &&
         export MAKEFLAGS=-j$(nproc) &&
         make &&
-        make install &&
+        make install tooldir=/usr gcc_tooldir=/usr DESTDIR=${DESTDIR} &&
         (cd */newlib; make info man) &&
-        (cd */newlib; make install-info install-man)
-      shell: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}'
+        (cd */newlib; make install-info install-man tooldir=/usr 
gcc_tooldir=/usr DESTDIR=${DESTDIR})
+      shell: bash --noprofile --norc -eo pipefail '{0}'
+
+    # adjust install so it matches the physical arrangement of directories when
+    # unpacked by setup
+    - name: Rearrange for default mountpoints
+      run: |
+        mv -v install/usr/bin install/bin
+        mv -v install/usr/lib install/lib
+      shell: bash --noprofile --norc -o igncr -eo pipefail '{0}'
+
+    # upload installed cygwin as an artifact, for subsequent use in
+    # test job(s)
+    - name: Make Cygwin installation artifact
+      uses: actions/upload-artifact@v4
+      with:
+        name: cygwin-install-${{ matrix.pkgarch }}
+        path: |
+          install
 
     # test
     - name: Test Cygwin
@@ -167,7 +185,7 @@ jobs:
         cd build &&
         (export PATH=${{ matrix.target 
}}/winsup/testsuite/testinst/bin:${PATH} && cmd /c $(cygpath -wa ${{ 
matrix.target }}/winsup/cygserver/cygserver) &) &&
         (cd ${{ matrix.target }}/winsup; make check AM_COLOR_TESTS=always)
-      shell: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}'
+      shell: bash --noprofile --norc -eo pipefail '{0}'
 
     # upload test logs to facilitate investigation of problems
     - name: Upload test logs
@@ -182,3 +200,42 @@ jobs:
     # workaround problems with actions/checkout post-run step using cygwin git
     - name: Avoid actions/checkout post-run step using Cygwin git
       run: bash -c 'rm /usr/bin/git.exe'
+
+  windows-test:
+    needs: windows-build
+
+    runs-on: windows-latest
+    strategy:
+      fail-fast: false
+      matrix:
+        include:
+        - target: x86_64-pc-cygwin
+          pkgarch: x86_64
+    name: Windows tests ${{ matrix.pkgarch }}
+
+    steps:
+    # install cygwin
+    - name: Install Cygwin
+      uses: cygwin/cygwin-install-action@master
+      with:
+        platform: ${{ matrix.pkgarch }}
+
+    # fetch the just-built cygwin installation artifact
+    - name: Unpack just-built Cygwin artifact
+      uses: actions/download-artifact@v4
+      with:
+        name: cygwin-install-${{ matrix.pkgarch }}
+        # the path specified here should match the install-dir of
+        # cygwin-install-action above, so we unpack the artifact over it
+        path: 'D:\cygwin'
+
+    # This isn't quite right, as it just overwrites existing files, it doesn't
+    # remove anything which is no longer provided. Ideally, we'd make a cygwin
+    # package of the just-built cygwin version and install it here, but tools
+    # don't exist (yet) to let us do that...
+
+    # run tests
+    - name: Run tests
+      run: |
+        uname -a
+      shell: bash --noprofile --norc -o igncr -eo pipefail '{0}'
-- 
2.45.1

Reply via email to