diff --git a/.github/scripts/bootstrap.sh b/.github/scripts/bootstrap.sh index 5f805e5e..0190802d 100644 --- a/.github/scripts/bootstrap.sh +++ b/.github/scripts/bootstrap.sh @@ -12,7 +12,10 @@ git describe --always ./scripts/bootstrap/bootstrap-haskell -[ "$(ghc --numeric-version)" = "${BOOTSTRAP_HASKELL_GHC_VERSION}" ] -# https://github.com/actions/runner-images/issues/7061 -[ "$(ghcup config | grep --color=never meta-mode)" = "meta-mode: Lax" ] +# on windows remove the carriage return +version=$(ghc --numeric-version | tr -d '\r\n') + +[ "$version" = "${BOOTSTRAP_HASKELL_GHC_VERSION}" ] +# https://github.com/actions/runner-images/issues/7061 +[ "$(ghcup config | grep --color=never meta-mode | tr -d '\r\n')" = "meta-mode: Lax" ] diff --git a/.github/scripts/env.sh b/.github/scripts/env.sh index 61fd3c65..b202f14a 100644 --- a/.github/scripts/env.sh +++ b/.github/scripts/env.sh @@ -20,9 +20,9 @@ if [ "${RUNNER_OS}" = "Windows" ] ; then # on windows use pwd to get unix style path CI_PROJECT_DIR="$(pwd)" export CI_PROJECT_DIR - export GHCUP_INSTALL_BASE_PREFIX="/c" - export GHCUP_BIN="$GHCUP_INSTALL_BASE_PREFIX/ghcup/bin" - export PATH="$GHCUP_BIN:$PATH" + # export GHCUP_INSTALL_BASE_PREFIX="/c" + # export GHCUP_BIN="$GHCUP_INSTALL_BASE_PREFIX/ghcup/bin" + # export PATH="$GHCUP_BIN:$PATH" export CABAL_DIR="C:\\Users\\runneradmin\\AppData\\Roaming\\cabal" else export CI_PROJECT_DIR="${GITHUB_WORKSPACE}" diff --git a/.github/workflows/bootstrap.yaml b/.github/workflows/bootstrap.yaml index 49b9a8b5..15936dce 100644 --- a/.github/workflows/bootstrap.yaml +++ b/.github/workflows/bootstrap.yaml @@ -57,3 +57,28 @@ jobs: Write-Host "Current Working Directory: $curDir" Set-ExecutionPolicy Bypass -Scope Process -Force;[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; try { & ([ScriptBlock]::Create((Invoke-WebRequest https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/scripts/bootstrap/bootstrap-haskell.ps1 -UseBasicParsing))) -InstallDir ${GITHUB_WORKSPACE} -BootstrapUrl ("{0}/scripts/bootstrap/bootstrap-haskell" -f $curDir) -InBash -Msys2Env "MINGW64" } catch { Write-Error $_ } shell: pwsh + + bootstrap-windows-cygwin: + name: bootstrap-windows-cygwin + runs-on: windows-latest + env: + BOOTSTRAP_HASKELL_CABAL_VERSION: 3.12.1.0 + BOOTSTRAP_HASKELL_GHC_VERSION: 9.6.7 + BOOTSTRAP_HASKELL_NONINTERACTIVE: yes + ARCH: 64 + JSON_VERSION: "0.0.7" + steps: + - run: git config --global core.autocrlf input + - name: Checkout code + uses: actions/checkout@v3 + with: + submodules: 'true' + + - name: Install cygwin + uses: cygwin/cygwin-install-action@master + with: + install-dir: 'c:\cygwin64' + + - name: Run bootstrap + run: | + sh ./.github/scripts/bootstrap.sh diff --git a/scripts/bootstrap/bootstrap-haskell b/scripts/bootstrap/bootstrap-haskell index e55efaeb..88697b8b 100755 --- a/scripts/bootstrap/bootstrap-haskell +++ b/scripts/bootstrap/bootstrap-haskell @@ -39,7 +39,9 @@ die() { exit 2 } +echo "DEBUG:START" plat="$(uname -s)" +echo "DEBUG:plat ${plat}" arch=$(uname -m) ghver="0.1.50.2" : "${GHCUP_BASE_URL:=https://downloads.haskell.org/~ghcup}" @@ -80,13 +82,20 @@ set_msys2_env_dir() { } case "${plat}" in - MSYS*|MINGW*|CYGWIN*) + MSYS*|MINGW*) : "${GHCUP_INSTALL_BASE_PREFIX:=/c}" GHCUP_DIR=$(cygpath -u "${GHCUP_INSTALL_BASE_PREFIX}/ghcup") GHCUP_BIN=$(cygpath -u "${GHCUP_INSTALL_BASE_PREFIX}/ghcup/bin") : "${GHCUP_MSYS2:=${GHCUP_DIR}/msys64}" set_msys2_env_dir ;; + CYGWIN*) + : "${GHCUP_INSTALL_BASE_PREFIX:=/cygdrive/c}" + GHCUP_DIR=$(cygpath -u "${GHCUP_INSTALL_BASE_PREFIX}/ghcup") + GHCUP_BIN=$(cygpath -u "${GHCUP_INSTALL_BASE_PREFIX}/ghcup/bin") + : "${GHCUP_MSYS2:=${GHCUP_DIR}/msys64}" + set_msys2_env_dir + ;; *) : "${GHCUP_INSTALL_BASE_PREFIX:=$HOME}" @@ -100,6 +109,9 @@ case "${plat}" in ;; esac +echo "DEBUG:GHCUP_INSTALL_BASE_PREFIX ${GHCUP_INSTALL_BASE_PREFIX}" +echo "DEBUG:GHCUP_DIR ${GHCUP_DIR}" + : "${BOOTSTRAP_HASKELL_GHC_VERSION:=recommended}" : "${BOOTSTRAP_HASKELL_CABAL_VERSION:=recommended}" : "${BOOTSTRAP_HASKELL_STACK_VERSION:=recommended}"