From 642dcfa8a413d0a6c9ea80339c3c5946d5c6e789 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Sat, 11 Jan 2025 18:10:41 +0100 Subject: [PATCH] Adding Windows native support. --- .github/workflows/Pipeline.yml | 24 ++++++++--------- action.yml | 49 ++++++++++++++++++++++++++++------ 2 files changed, 53 insertions(+), 20 deletions(-) diff --git a/.github/workflows/Pipeline.yml b/.github/workflows/Pipeline.yml index 49f0ada..c1e6b7d 100644 --- a/.github/workflows/Pipeline.yml +++ b/.github/workflows/Pipeline.yml @@ -13,19 +13,19 @@ jobs: matrix: os: - {'icon': '🐧', 'name': 'Ubuntu', 'image': 'ubuntu-24.04', 'runtime': '', 'backend': 'mcode'} - - {'icon': '🐧', 'name': 'Ubuntu', 'image': 'ubuntu-24.04', 'runtime': '', 'backend': 'llvm'} - - {'icon': '🐧', 'name': 'Ubuntu', 'image': 'ubuntu-24.04', 'runtime': '', 'backend': 'llvm-jit'} - - {'icon': '🐧', 'name': 'Ubuntu', 'image': 'ubuntu-24.04', 'runtime': '', 'backend': 'gcc'} - - {'icon': '🍎', 'name': 'macOS', 'image': 'macos-13', 'runtime': '', 'backend': 'mcode'} - - {'icon': '🍎', 'name': 'macOS', 'image': 'macos-13', 'runtime': '', 'backend': 'llvm'} - - {'icon': '🍏', 'name': 'macOS', 'image': 'macos-14', 'runtime': '', 'backend': 'llvm'} +# - {'icon': '🐧', 'name': 'Ubuntu', 'image': 'ubuntu-24.04', 'runtime': '', 'backend': 'llvm'} +# - {'icon': '🐧', 'name': 'Ubuntu', 'image': 'ubuntu-24.04', 'runtime': '', 'backend': 'llvm-jit'} +# - {'icon': '🐧', 'name': 'Ubuntu', 'image': 'ubuntu-24.04', 'runtime': '', 'backend': 'gcc'} +# - {'icon': '🍎', 'name': 'macOS', 'image': 'macos-13', 'runtime': '', 'backend': 'mcode'} +# - {'icon': '🍎', 'name': 'macOS', 'image': 'macos-13', 'runtime': '', 'backend': 'llvm'} +# - {'icon': '🍏', 'name': 'macOS', 'image': 'macos-14', 'runtime': '', 'backend': 'llvm'} - {'icon': '🪟', 'name': 'Windows', 'image': 'windows-2022', 'runtime': '', 'backend': 'mcode'} - - {'icon': '🪟🟦', 'name': 'Windows', 'image': 'windows-2022', 'runtime': 'mingw64', 'backend': 'mcode'} - - {'icon': '🪟🟦', 'name': 'Windows', 'image': 'windows-2022', 'runtime': 'mingw64', 'backend': 'llvm'} - - {'icon': '🪟🟦', 'name': 'Windows', 'image': 'windows-2022', 'runtime': 'mingw64', 'backend': 'llvm-jit'} - - {'icon': '🪟🟨', 'name': 'Windows', 'image': 'windows-2022', 'runtime': 'ucrt64', 'backend': 'mcode'} - - {'icon': '🪟🟨', 'name': 'Windows', 'image': 'windows-2022', 'runtime': 'ucrt64', 'backend': 'llvm'} - - {'icon': '🪟🟨', 'name': 'Windows', 'image': 'windows-2022', 'runtime': 'ucrt64', 'backend': 'llvm-jit'} +# - {'icon': '🪟🟦', 'name': 'Windows', 'image': 'windows-2022', 'runtime': 'mingw64', 'backend': 'mcode'} +# - {'icon': '🪟🟦', 'name': 'Windows', 'image': 'windows-2022', 'runtime': 'mingw64', 'backend': 'llvm'} +# - {'icon': '🪟🟦', 'name': 'Windows', 'image': 'windows-2022', 'runtime': 'mingw64', 'backend': 'llvm-jit'} +# - {'icon': '🪟🟨', 'name': 'Windows', 'image': 'windows-2022', 'runtime': 'ucrt64', 'backend': 'mcode'} +# - {'icon': '🪟🟨', 'name': 'Windows', 'image': 'windows-2022', 'runtime': 'ucrt64', 'backend': 'llvm'} +# - {'icon': '🪟🟨', 'name': 'Windows', 'image': 'windows-2022', 'runtime': 'ucrt64', 'backend': 'llvm-jit'} defaults: run: shell: bash diff --git a/action.yml b/action.yml index 5da8bec..676150b 100644 --- a/action.yml +++ b/action.yml @@ -49,13 +49,6 @@ runs: nightly-version-msys2=5.0.0.dev-1 EOF - - name: Debugging - id: debug - shell: bash - run: | - echo "runner.os: ${{ runner.os }}" - echo "runner.arch: ${{ runner.arch }}" - - name: Download and install GHDL on Ubuntu 2024.04 (x86-64) id: ubuntu if: runner.os == 'Linux' && runner.arch == 'X64' @@ -212,7 +205,47 @@ runs: if: runner.os == 'Windows' && runner.arch == 'X64' && inputs.runtime == '' shell: powershell run: | - curl -L "https://github.com/ghdl/ghdl/releases/download/${VERSION_IN_URL}/mingw-w64-ucrt-x86_64-ghdl-mcode-5.0.0.dev-1-any.pkg.tar.zst" -o ghdl.pkg.tar.zst + # Download and install GHDL on Windows (native) + $BACKEND = "mcode" + $RUNTIME = "ucrt64" + + if ( "${{ inputs.version }}" -eq "nightly" ) { + $VERSION_IN_URL = "nightly" + $VERSION_IN_FILE = "${{ steps.variables.outputs.nightly-version }}" + + echo "Version: nightly (${VERSION_IN_FILE})" + } elseif ( "${{ inputs.version }}" -match '^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}$' ) { + $VERSION_IN_URL = "${{ inputs.version }}" + $VERSION_IN_FILE = "${{ inputs.version }}" + + echo "Version: ${{ inputs.version }}" + } else { + echo "::error title=setup-ghdl::Unsupported GHDL version '${{ inputs.version }}'." + exit 1 + } + + if ( "${{ inputs.backend }}" -eq "mcode" ) { + echo "Backend: ${{ inputs.backend }}" + } else { + echo "::error title=setup-ghdl::Unsupported GHDL backend '${{ inputs.backend }}'." + exit 1 + } + + echo "Creating installation directory '${{ inputs.install-directory }}' ..." + mkdir "${{ inputs.install-directory }}" | Out-Null + cd "${{ inputs.install-directory }}" + + $DOWNLOAD_URL = "https://github.com/ghdl/ghdl/releases/download/${VERSION_IN_URL}/ghdl-${BACKEND}-${VERSION_IN_FILE}-${RUNTIME}.zip" + echo "Downloading asset from '${DOWNLOAD_URL}' ..." + curl "${DOWNLOAD_URL}" -o ghdl.zip + + ls + + echo "Extracting zip file 'ghdl.zip' ..." + Expand-Archive "ghdl.zip" + + ls + - name: Download and install GHDL on Windows + MSYS2 (x86-64)