diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 245a968..1116f90 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -114,7 +114,7 @@ jobs: with: install-dir: "${{ matrix.install-dir }}" - - name: Check working directory + - name: Check install directory run: | if [[ "$(cygpath -aw /)" == '${{ matrix.install-dir }}' ]]; then echo "Installed in $(cygpath -aw /)" @@ -133,6 +133,31 @@ jobs: env: SHELLOPTS: igncr + symlink-test: + runs-on: windows-latest + name: 'Check symlink type control' + + strategy: + matrix: + include: + - symlink-type: native + - symlink-type: sys + - symlink-type: wsl + + env: + CYGWIN: winsymlinks:${{ matrix.symlink-type }} + + steps: + - run: git config --global core.autocrlf input + + - uses: actions/checkout@v2 + + - name: Install Cygwin + uses: ./ + + - name: Check symlink + run: bash tests/symlink.sh + time-machine: runs-on: windows-latest strategy: diff --git a/README.md b/README.md index 2ae9c9f..2a9a8d8 100644 --- a/README.md +++ b/README.md @@ -72,13 +72,16 @@ or, Symlinks -------- -Unfortunately, Cygwin's `setup` doesn't (currently) honour -`CYGWIN=winsymlinks:native` or offer an option to control the kind of symlinks -created, so some executables (e.g. `python`) are created as Cygwin-style -symlinks. Since CMD and PowerShell don't understand those symlinks, you cannot -run those executables directly in a `run:` in your workflow. Execute them via +Cygwin's `setup` creates Cygwin-style symlinks by default, and some +executables (e.g. `python`) are symlinks. + +Since CMD and PowerShell don't understand those symlinks, you cannot run +those executables directly in a `run:` in your workflow. Execute them via `bash` or `env` instead. +Alternatively, putting e.g. `CYGWIN=winsymlinks:native` into the workflow's +environment works, since setup now honours that. + Mirrors and signatures ---------------------- diff --git a/action.yml b/action.yml index 80a29bd..c039af1 100644 --- a/action.yml +++ b/action.yml @@ -22,7 +22,6 @@ inputs: site: description: Download site URL required: false - default: http://mirrors.kernel.org/sourceware/cygwin/ runs: using: "composite" @@ -37,17 +36,26 @@ runs: exit 1 } Invoke-WebRequest https://cygwin.com/setup-$platform.exe -OutFile C:\setup.exe - shell: powershell - - run: | $packages = '${{ inputs.packages }}' $pkg_list = $packages.Split('', [System.StringSplitOptions]::RemoveEmptyEntries) $pkg_list = $pkg_list | % { $_.Trim() } $pkg_list = $pkg_list | % { $_.Trim(',') } + # default site if not specified + if (! '${{ inputs.site }}' ) { + if ($platform -eq 'x86') { + $site = 'http://mirrors.kernel.org/sourceware/cygwin-archive/20221123' + } else { + $site = 'http://mirrors.kernel.org/sourceware/cygwin/' + } + } else { + $site = '${{ inputs.site }}' + } + $args = @( '-qgnO', - '-s', '${{ inputs.site }}', + '-s', $site, '-l', 'C:\cygwin-packages', '-R', '${{ inputs.install-dir }}' ) @@ -61,6 +69,10 @@ runs: $args += '-X' } + if ($platform -eq 'x86') { + $args += '--allow-unsupported-windows' + } + # because setup is a Windows GUI app, make it part of a pipeline to make # PowerShell wait for it to exit & C:\setup.exe $args | Out-Default diff --git a/tests/symlink.sh b/tests/symlink.sh new file mode 100644 index 0000000..7ccff67 --- /dev/null +++ b/tests/symlink.sh @@ -0,0 +1,27 @@ +#!/usr/bin/bash + +TEST_FILE="/usr/bin/apropos" +echo "cygpath -w ${TEST_FILE} returns $(cygpath -w ${TEST_FILE})" +# don't convert using cygpath -w, as that canonicalizes symlinks ?!? +TEST_FILE_W="C:\cygwin\bin\apropos" + +# check the symlink we're going to do checks on exists +if [ ! -L ${TEST_FILE} ]; then + echo "This test assumes ${TEST_FILE} exists and is a symlink" + exit 1 +fi + +# check the symlink was created in the way expected +case ${CYGWIN} in + *sys*) + cmd /c "dir /AS ${TEST_FILE_W}" | grep "21" + ;; + + *native*) + cmd /c "dir /AL ${TEST_FILE_W}" | grep "" + ;; + + *wsl*) + fsutil reparsepoint query ${TEST_FILE_W} | grep "0xa000001d" + ;; +esac