Skip to content

Commit

Permalink
v1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Paebbels committed Jan 11, 2025
2 parents e80a399 + 1a87047 commit f0a3fb3
Show file tree
Hide file tree
Showing 4 changed files with 178 additions and 39 deletions.
49 changes: 37 additions & 12 deletions .github/workflows/Pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# The MIT License (MIT)
#
# Copyright © 2024 The GHDL Developers
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the “Software”), to deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
name: Verification of setup-ghdl

on:
Expand All @@ -6,12 +22,12 @@ on:

jobs:
Setup-GHDL-Nightly:
name: ${{ matrix.os.icon }} Setup GHDL ${{ matrix.os.backend }} on ${{ matrix.os.name }}
runs-on: ${{ matrix.os.image }}
name: ${{ matrix.icon }} Setup GHDL ${{ matrix.backend }} on ${{ matrix.name }}
runs-on: ${{ matrix.image }}
strategy:
fail-fast: false
matrix:
os:
include:
- {'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'}
Expand All @@ -31,28 +47,37 @@ jobs:
shell: bash

steps:
- name: 🟦 Setup MSYS2 for ${{ matrix.os.runtime }}
- name: 🟦 Setup MSYS2 for ${{ matrix.runtime }}
uses: msys2/setup-msys2@v2
if: matrix.os.runtime != ''
if: matrix.runtime != ''
with:
msystem: ${{ matrix.os.runtime }}
msystem: ${{ matrix.runtime }}
update: true

- name: Setup GHDL ${{ matrix.os.backend }}
- name: Setup GHDL ${{ matrix.backend }}
uses: paebbels/setup-ghdl@main
with:
version: nightly
backend: ${{ matrix.os.backend }}
runtime: ${{ matrix.os.runtime }}
backend: ${{ matrix.backend }}
runtime: ${{ matrix.runtime }}
investigate: true

- name: Verify on Linux and macOS
if: matrix.os.name == 'Ubuntu' || matrix.os.name == 'macOS'
- name: Verify on Linux or macOS
if: matrix.name == 'Ubuntu' || matrix.name == 'macOS'
run: |
which ghdl
ghdl --version
- name: Verify on Windows (native)
if: matrix.name == 'Windows' && matrix.runtime == ''
shell: powershell
run: |
echo $(Get-Command ghdl).Source
ghdl --version
- name: Verify on Windows + MSYS2
if: matrix.os.name == 'Windows' && matrix.os.runtime != ''
if: matrix.name == 'Windows' && matrix.runtime != ''
shell: 'msys2 {0}'
run: |
which ghdl
ghdl --version
16 changes: 16 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# The MIT License (MIT)

Copyright © 2024 The GHDL Developers

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the “Software”), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
54 changes: 37 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

This composite action, installs GHDL in a GitHub Action's workflow job.

> [!IMPORTANT]
> This GitHub Action replaces [`setup-ghdl-ci`](https://github.com/ghdl/setup-ghdl-ci).
## Features

* Select GHDL version (tagged release or nightly build).
* Select GHDL backend (LLVM, LLVM-JIT, mcode, GCC)
* Activate an investigation mode (check and show GHDL installation, ...)
* Supported runner OS' (automatically detected): Ubuntu 2024.04, macOS (x86-64), macOS (aarch64), Windows
* Select GHDL version (tagged release like `5.0.0`, `latest` (stable) release or `nightly` release (rolling release)).
* Select GHDL backend (LLVM, LLVM-JIT, mcode, GCC).
* Activate an investigation mode (check and show GHDL installation, ...).
* Supported runner OS' (automatically detected): Ubuntu 2024.04, macOS (x86-64), macOS (aarch64), Windows.

## Usage

Expand Down Expand Up @@ -64,7 +66,7 @@ jobs:
| Parameter | Required | Default | Description |
|---------------------|:--------:|-------------|---------------------------------------------------------------------------------------------------------------------------------------------|
| `version` | no | `'nightly'` | A tagged GHDL version starting at `v5.0.0` or `nightly`. |
| `version` | no | `'nightly'` | A tagged GHDL version starting at `v5.0.0`, `latest` or `nightly`. |
| `backend` | no | `'mcode'` | GHDL backend: `llvm`, `llvm-jit`, `mcode`, `gcc`. |
| `runtime` | no | `''` | If runner OS is Windows, a MSYS2 runtime can be selected (`mingw64`, `ucrt64`). If not set, Windows native is used (not MSYS2 environment). |
| `install-directory` | no | `'install'` | Local installation directory, in case an archive asset is downloaded and extracted. |
Expand All @@ -79,28 +81,36 @@ jobs:
| `ghdl-lib-directory` | tbd |


## Dependencies
## Behavior and Dependencies

### On Linux (Ubuntu)

* Download GHDL asset as `*.tar.gz` and extract files to `install-directory`.
* Further dependencies will be installed using `apt-get`.
* GHDL will be added to `PATH`.
* Download GHDL asset from https://github.com/ghdl/ghdl/releases as `*.tar.gz` and extract files into
`install-directory`.
* Further dependencies will be installed using `apt-get` and reading the embedded `ubuntu.requirements`
file.
* GHDL's `bin` directory will be added to `PATH`.

### On macOS

* Download GHDL asset as `*.tar.gz` and extract files to `install-directory`.
* GHDL will be added to `PATH`.
* Download GHDL asset from https://github.com/ghdl/ghdl/releases as `*.tar.gz` and extract files into
`install-directory`.
* All dependencies are contained within the archive, thus no further dependencies need to be installed.
* GHDL's `bin` directory will be added to `PATH`.

### On Windows (native)

*tbd*
* Download GHDL asset from https://github.com/ghdl/ghdl/releases as `*.zip` into `install-directory`.
* The archive is extracted into the same directory.
* All dependencies are contained within the archive, thus no further dependencies need to be installed.
* GHDL's `bin` directory will be added to `PATH`.

### On Windows + MSYS2

* Download GHDL asset as `*.pkg.tar.zst` installation package for pacman.
* Install package and further dependencies (listed in the package) via pacman.

* Download GHDL asset from https://github.com/ghdl/ghdl/releases as `*.pkg.tar.zst` installation package for pacman.
* Install this package.
* Further dependencies get automatically installed by pacman, as listed as dependencies in the package.
* No need to modify `PATH`, because GHDL got installed into the MSYS2 system.

## Contributors

Expand All @@ -109,5 +119,15 @@ jobs:

### Credits

This GitHub Action replaces `setup-ghdl-ci`, a Javascript Action developed by Umarcor, with a composite action using
simples instructions (`curl`, `tar`, `apt-get`) written in Bash.
This GitHub Action replaces `setup-ghdl-ci`, a Javascript Action developed by
[Unai Martinez-Corral](https://GitHub.com/umarcor), with a composite action using simples instructions (`curl`, `tar`,
`apt-get`) written in Bash or Powershell.


## License

This GitHub Composite Action (source code) licensed under [The MIT License](LICENSE.md).

---

SPDX-License-Identifier: MIT
98 changes: 88 additions & 10 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# The MIT License (MIT)
#
# Copyright © 2024 The GHDL Developers
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the “Software”), to deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
name: Setup GHDL
branding:
icon: play
Expand Down Expand Up @@ -45,17 +61,12 @@ runs:
shell: bash
run: |
tee "${GITHUB_OUTPUT}" <<EOF
latest-version=5.0.0
latest-version-msys2=5.0.0-1
nightly-version=5.0.0-dev
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'
Expand All @@ -79,6 +90,11 @@ runs:
VERSION_IN_FILE="${{ steps.variables.outputs.nightly-version }}"
printf "Version: %s\n" "nightly (${VERSION_IN_FILE})"
elif [[ "${{ inputs.version }}" == "latest" ]]; then
VERSION_IN_URL="${{ steps.variables.outputs.nightly-version }}"
VERSION_IN_FILE="${{ steps.variables.outputs.nightly-version }}"
printf "Version: %s\n" "latest (${VERSION_IN_FILE})"
elif [[ "${{ inputs.version }}" =~ ^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}$ ]]; then
VERSION_IN_URL="${{ inputs.version }}"
VERSION_IN_FILE="${{ inputs.version }}"
Expand Down Expand Up @@ -157,6 +173,11 @@ runs:
VERSION_IN_FILE="${{ steps.variables.outputs.nightly-version }}"
printf "Version: %s\n" "nightly (${VERSION_IN_FILE})"
elif [[ "${{ inputs.version }}" == "latest" ]]; then
VERSION_IN_URL="${{ steps.variables.outputs.nightly-version }}"
VERSION_IN_FILE="${{ steps.variables.outputs.nightly-version }}"
printf "Version: %s\n" "latest (${VERSION_IN_FILE})"
elif [[ "${{ inputs.version }}" =~ ^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}$ ]]; then
VERSION_IN_URL="${{ inputs.version }}"
VERSION_IN_FILE="${{ inputs.version }}"
Expand Down Expand Up @@ -212,15 +233,65 @@ 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 }}" -eq "latest" ) {
$VERSION_IN_URL = "${{ steps.variables.outputs.nightly-version }}"
$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
echo "Extracting zip file 'ghdl.zip' ..."
Expand-Archive -Path "ghdl.zip" -DestinationPath "."
echo "Removing zip file 'ghdl.zip' ..."
rm "ghdl.zip"
echo "Setting environment variable 'GHDL_PREFIX' ..."
echo "GHDL_PREFIX=$($(pwd).Path)\lib\ghdl" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "Adding GHDL to 'PATH' ..."
echo "$($(pwd).Path)\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Download and install GHDL on Windows + MSYS2 (x86-64)
id: MSYS2
if: runner.os == 'Windows' && runner.arch == 'X64' && ( inputs.runtime == 'mingw64' || inputs.runtime == 'ucrt64' )
shell: 'msys2 {0}'
run: |
# Download and install GHDL on Windows + MSYS2 (x86-64)
ANSI_LIGHT_RED=$'\x1b[91m'
ANSI_LIGHT_GREEN=$'\x1b[92m'
ANSI_LIGHT_BLUE="\e[94m"
ANSI_NOCOLOR=$'\x1b[0m'
Expand All @@ -238,6 +309,11 @@ runs:
VERSION_IN_URL="nightly"
VERSION_IN_FILE="${{ steps.variables.outputs.nightly-version-msys2 }}"
printf "Version: %s\n" "nightly (${VERSION_IN_FILE})"
elif [[ "${{ inputs.version }}" == "latest" ]]; then
VERSION_IN_URL="${{ steps.variables.outputs.nightly-version }}"
VERSION_IN_FILE="${{ steps.variables.outputs.nightly-version-msys2 }}"
printf "Version: %s\n" "nightly (${VERSION_IN_FILE})"
elif [[ "${{ inputs.version }}" =~ ^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}$ ]]; then
VERSION_IN_URL="${{ inputs.version }}"
Expand Down Expand Up @@ -274,5 +350,7 @@ runs:
printf "::warning title=%s::%s\n" "setup-ghdl" "Failed to remove 'ghdl.pkg.tar.zst'."
fi
echo "GHDL_PREFIX=$(realpath $(dirname $(which ghdl))/../lib/ghdl) >> $GITHUB_ENV"
echo "GHDL_PREFIX=$(realpath $(dirname $(which ghdl))/../lib/ghdl)" >> $GITHUB_ENV
printf "Setting environment variable 'GHDL_PREFIX' ...\n"
tee "${GITHUB_ENV}" <<EOF
GHDL_PREFIX=$(realpath $(dirname $(which ghdl))/../lib/ghdl)
EOF

0 comments on commit f0a3fb3

Please sign in to comment.