Skip to content

Commit ec4a202

Browse files
committed
v1.0
2 parents e80a399 + 1a87047 commit ec4a202

File tree

4 files changed

+183
-44
lines changed

4 files changed

+183
-44
lines changed

.github/workflows/Pipeline.yml

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
# The MIT License (MIT)
2+
#
3+
# Copyright © 2024 The GHDL Developers
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
6+
# documentation files (the “Software”), to deal in the Software without restriction, including without limitation the
7+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
8+
# persons to whom the Software is furnished to do so, subject to the following conditions:
9+
#
10+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
11+
# Software.
12+
#
13+
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
14+
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
15+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16+
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
117
name: Verification of setup-ghdl
218

319
on:
@@ -6,12 +22,12 @@ on:
622

723
jobs:
824
Setup-GHDL-Nightly:
9-
name: ${{ matrix.os.icon }} Setup GHDL ${{ matrix.os.backend }} on ${{ matrix.os.name }}
10-
runs-on: ${{ matrix.os.image }}
25+
name: ${{ matrix.icon }} Setup GHDL ${{ matrix.backend }} on ${{ matrix.name }}
26+
runs-on: ${{ matrix.image }}
1127
strategy:
1228
fail-fast: false
1329
matrix:
14-
os:
30+
include:
1531
- {'icon': '🐧', 'name': 'Ubuntu', 'image': 'ubuntu-24.04', 'runtime': '', 'backend': 'mcode'}
1632
- {'icon': '🐧', 'name': 'Ubuntu', 'image': 'ubuntu-24.04', 'runtime': '', 'backend': 'llvm'}
1733
- {'icon': '🐧', 'name': 'Ubuntu', 'image': 'ubuntu-24.04', 'runtime': '', 'backend': 'llvm-jit'}
@@ -31,28 +47,37 @@ jobs:
3147
shell: bash
3248

3349
steps:
34-
- name: 🟦 Setup MSYS2 for ${{ matrix.os.runtime }}
50+
- name: 🟦 Setup MSYS2 for ${{ matrix.runtime }}
3551
uses: msys2/setup-msys2@v2
36-
if: matrix.os.runtime != ''
52+
if: matrix.runtime != ''
3753
with:
38-
msystem: ${{ matrix.os.runtime }}
54+
msystem: ${{ matrix.runtime }}
3955
update: true
4056

41-
- name: Setup GHDL ${{ matrix.os.backend }}
42-
uses: paebbels/setup-ghdl@main
57+
- name: Setup GHDL ${{ matrix.backend }}
58+
uses: ghdl/setup-ghdl@main
4359
with:
4460
version: nightly
45-
backend: ${{ matrix.os.backend }}
46-
runtime: ${{ matrix.os.runtime }}
61+
backend: ${{ matrix.backend }}
62+
runtime: ${{ matrix.runtime }}
4763
investigate: true
4864

49-
- name: Verify on Linux and macOS
50-
if: matrix.os.name == 'Ubuntu' || matrix.os.name == 'macOS'
65+
- name: Verify on Linux or macOS
66+
if: matrix.name == 'Ubuntu' || matrix.name == 'macOS'
5167
run: |
68+
which ghdl
69+
ghdl --version
70+
71+
- name: Verify on Windows (native)
72+
if: matrix.name == 'Windows' && matrix.runtime == ''
73+
shell: powershell
74+
run: |
75+
echo $(Get-Command ghdl).Source
5276
ghdl --version
5377
5478
- name: Verify on Windows + MSYS2
55-
if: matrix.os.name == 'Windows' && matrix.os.runtime != ''
79+
if: matrix.name == 'Windows' && matrix.runtime != ''
5680
shell: 'msys2 {0}'
5781
run: |
82+
which ghdl
5883
ghdl --version

LICENSE.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# The MIT License (MIT)
2+
3+
Copyright © 2024 The GHDL Developers
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
6+
documentation files (the “Software”), to deal in the Software without restriction, including without limitation the
7+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
8+
persons to whom the Software is furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
11+
Software.
12+
13+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
14+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
15+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 41 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22

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

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

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

1315
## Usage
1416

@@ -18,7 +20,7 @@ jobs:
1820
runs-on: ubuntu-24.04
1921
steps:
2022
- name: Run VHDL Simulation
21-
uses: paebbels/setup-ghdl@v1
23+
uses: ghdl/setup-ghdl@v1
2224
with:
2325
version: nightly
2426
backend: mcode
@@ -28,7 +30,7 @@ jobs:
2830
runs-on: macOS-14
2931
steps:
3032
- name: Run VHDL Simulation
31-
uses: paebbels/setup-ghdl@v1
33+
uses: ghdl/setup-ghdl@v1
3234
with:
3335
version: nightly
3436
backend: llvm
@@ -37,7 +39,7 @@ jobs:
3739
runs-on: windows-2022
3840
steps:
3941
- name: Run VHDL Simulation
40-
uses: paebbels/setup-ghdl@v1
42+
uses: ghdl/setup-ghdl@v1
4143
with:
4244
version: nightly
4345
backend: mcode
@@ -52,7 +54,7 @@ jobs:
5254
update: true
5355

5456
- name: Run VHDL Simulation
55-
uses: paebbels/setup-ghdl@v1
57+
uses: ghdl/setup-ghdl@v1
5658
with:
5759
version: nightly
5860
backend: mcode
@@ -64,7 +66,7 @@ jobs:
6466
6567
| Parameter | Required | Default | Description |
6668
|---------------------|:--------:|-------------|---------------------------------------------------------------------------------------------------------------------------------------------|
67-
| `version` | no | `'nightly'` | A tagged GHDL version starting at `v5.0.0` or `nightly`. |
69+
| `version` | no | `'nightly'` | A tagged GHDL version starting at `v5.0.0`, `latest` or `nightly`. |
6870
| `backend` | no | `'mcode'` | GHDL backend: `llvm`, `llvm-jit`, `mcode`, `gcc`. |
6971
| `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). |
7072
| `install-directory` | no | `'install'` | Local installation directory, in case an archive asset is downloaded and extracted. |
@@ -79,28 +81,36 @@ jobs:
7981
| `ghdl-lib-directory` | tbd |
8082

8183

82-
## Dependencies
84+
## Behavior and Dependencies
8385

8486
### On Linux (Ubuntu)
8587

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

9094
### On macOS
9195

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

95101
### On Windows (native)
96102

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

99108
### On Windows + MSYS2
100109

101-
* Download GHDL asset as `*.pkg.tar.zst` installation package for pacman.
102-
* Install package and further dependencies (listed in the package) via pacman.
103-
110+
* Download GHDL asset from https://github.com/ghdl/ghdl/releases as `*.pkg.tar.zst` installation package for pacman.
111+
* Install this package.
112+
* Further dependencies get automatically installed by pacman, as listed as dependencies in the package.
113+
* No need to modify `PATH`, because GHDL got installed into the MSYS2 system.
104114

105115
## Contributors
106116

@@ -109,5 +119,15 @@ jobs:
109119

110120
### Credits
111121

112-
This GitHub Action replaces `setup-ghdl-ci`, a Javascript Action developed by Umarcor, with a composite action using
113-
simples instructions (`curl`, `tar`, `apt-get`) written in Bash.
122+
This GitHub Action replaces `setup-ghdl-ci`, a Javascript Action developed by
123+
[Unai Martinez-Corral](https://GitHub.com/umarcor), with a composite action using simples instructions (`curl`, `tar`,
124+
`apt-get`) written in Bash or Powershell.
125+
126+
127+
## License
128+
129+
This GitHub Composite Action (source code) licensed under [The MIT License](LICENSE.md).
130+
131+
---
132+
133+
SPDX-License-Identifier: MIT

action.yml

Lines changed: 88 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
# The MIT License (MIT)
2+
#
3+
# Copyright © 2024 The GHDL Developers
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
6+
# documentation files (the “Software”), to deal in the Software without restriction, including without limitation the
7+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
8+
# persons to whom the Software is furnished to do so, subject to the following conditions:
9+
#
10+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
11+
# Software.
12+
#
13+
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
14+
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
15+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16+
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
117
name: Setup GHDL
218
branding:
319
icon: play
@@ -45,17 +61,12 @@ runs:
4561
shell: bash
4662
run: |
4763
tee "${GITHUB_OUTPUT}" <<EOF
64+
latest-version=5.0.0
65+
latest-version-msys2=5.0.0-1
4866
nightly-version=5.0.0-dev
4967
nightly-version-msys2=5.0.0.dev-1
5068
EOF
5169
52-
- name: Debugging
53-
id: debug
54-
shell: bash
55-
run: |
56-
echo "runner.os: ${{ runner.os }}"
57-
echo "runner.arch: ${{ runner.arch }}"
58-
5970
- name: Download and install GHDL on Ubuntu 2024.04 (x86-64)
6071
id: ubuntu
6172
if: runner.os == 'Linux' && runner.arch == 'X64'
@@ -79,6 +90,11 @@ runs:
7990
VERSION_IN_FILE="${{ steps.variables.outputs.nightly-version }}"
8091
8192
printf "Version: %s\n" "nightly (${VERSION_IN_FILE})"
93+
elif [[ "${{ inputs.version }}" == "latest" ]]; then
94+
VERSION_IN_URL="${{ steps.variables.outputs.nightly-version }}"
95+
VERSION_IN_FILE="${{ steps.variables.outputs.nightly-version }}"
96+
97+
printf "Version: %s\n" "latest (${VERSION_IN_FILE})"
8298
elif [[ "${{ inputs.version }}" =~ ^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}$ ]]; then
8399
VERSION_IN_URL="${{ inputs.version }}"
84100
VERSION_IN_FILE="${{ inputs.version }}"
@@ -157,6 +173,11 @@ runs:
157173
VERSION_IN_FILE="${{ steps.variables.outputs.nightly-version }}"
158174
159175
printf "Version: %s\n" "nightly (${VERSION_IN_FILE})"
176+
elif [[ "${{ inputs.version }}" == "latest" ]]; then
177+
VERSION_IN_URL="${{ steps.variables.outputs.nightly-version }}"
178+
VERSION_IN_FILE="${{ steps.variables.outputs.nightly-version }}"
179+
180+
printf "Version: %s\n" "latest (${VERSION_IN_FILE})"
160181
elif [[ "${{ inputs.version }}" =~ ^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}$ ]]; then
161182
VERSION_IN_URL="${{ inputs.version }}"
162183
VERSION_IN_FILE="${{ inputs.version }}"
@@ -212,15 +233,65 @@ runs:
212233
if: runner.os == 'Windows' && runner.arch == 'X64' && inputs.runtime == ''
213234
shell: powershell
214235
run: |
215-
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
236+
# Download and install GHDL on Windows (native)
237+
$BACKEND = "mcode"
238+
$RUNTIME = "ucrt64"
239+
240+
if ( "${{ inputs.version }}" -eq "nightly" ) {
241+
$VERSION_IN_URL = "nightly"
242+
$VERSION_IN_FILE = "${{ steps.variables.outputs.nightly-version }}"
243+
244+
echo "Version: nightly (${VERSION_IN_FILE})"
245+
} elseif ( "${{ inputs.version }}" -eq "latest" ) {
246+
$VERSION_IN_URL = "${{ steps.variables.outputs.nightly-version }}"
247+
$VERSION_IN_FILE = "${{ steps.variables.outputs.nightly-version }}"
248+
249+
echo "Version: nightly (${VERSION_IN_FILE})"
250+
} elseif ( "${{ inputs.version }}" -match '^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}$' ) {
251+
$VERSION_IN_URL = "${{ inputs.version }}"
252+
$VERSION_IN_FILE = "${{ inputs.version }}"
253+
254+
echo "Version: ${{ inputs.version }}"
255+
} else {
256+
echo "::error title=setup-ghdl::Unsupported GHDL version '${{ inputs.version }}'."
257+
exit 1
258+
}
259+
260+
if ( "${{ inputs.backend }}" -eq "mcode" ) {
261+
echo "Backend: ${{ inputs.backend }}"
262+
} else {
263+
echo "::error title=setup-ghdl::Unsupported GHDL backend '${{ inputs.backend }}'."
264+
exit 1
265+
}
266+
267+
echo "Creating installation directory '${{ inputs.install-directory }}' ..."
268+
mkdir "${{ inputs.install-directory }}" | Out-Null
269+
cd "${{ inputs.install-directory }}"
216270
271+
$DOWNLOAD_URL = "https://github.com/ghdl/ghdl/releases/download/${VERSION_IN_URL}/ghdl-${BACKEND}-${VERSION_IN_FILE}-${RUNTIME}.zip"
272+
echo "Downloading asset from '${DOWNLOAD_URL}' ..."
273+
curl "${DOWNLOAD_URL}" -o ghdl.zip
274+
275+
echo "Extracting zip file 'ghdl.zip' ..."
276+
Expand-Archive -Path "ghdl.zip" -DestinationPath "."
277+
278+
echo "Removing zip file 'ghdl.zip' ..."
279+
rm "ghdl.zip"
280+
281+
echo "Setting environment variable 'GHDL_PREFIX' ..."
282+
echo "GHDL_PREFIX=$($(pwd).Path)\lib\ghdl" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
283+
284+
echo "Adding GHDL to 'PATH' ..."
285+
echo "$($(pwd).Path)\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
217286
218287
- name: Download and install GHDL on Windows + MSYS2 (x86-64)
219288
id: MSYS2
220289
if: runner.os == 'Windows' && runner.arch == 'X64' && ( inputs.runtime == 'mingw64' || inputs.runtime == 'ucrt64' )
221290
shell: 'msys2 {0}'
222291
run: |
223292
# Download and install GHDL on Windows + MSYS2 (x86-64)
293+
ANSI_LIGHT_RED=$'\x1b[91m'
294+
ANSI_LIGHT_GREEN=$'\x1b[92m'
224295
ANSI_LIGHT_BLUE="\e[94m"
225296
ANSI_NOCOLOR=$'\x1b[0m'
226297
@@ -238,6 +309,11 @@ runs:
238309
VERSION_IN_URL="nightly"
239310
VERSION_IN_FILE="${{ steps.variables.outputs.nightly-version-msys2 }}"
240311
312+
printf "Version: %s\n" "nightly (${VERSION_IN_FILE})"
313+
elif [[ "${{ inputs.version }}" == "latest" ]]; then
314+
VERSION_IN_URL="${{ steps.variables.outputs.nightly-version }}"
315+
VERSION_IN_FILE="${{ steps.variables.outputs.nightly-version-msys2 }}"
316+
241317
printf "Version: %s\n" "nightly (${VERSION_IN_FILE})"
242318
elif [[ "${{ inputs.version }}" =~ ^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}$ ]]; then
243319
VERSION_IN_URL="${{ inputs.version }}"
@@ -274,5 +350,7 @@ runs:
274350
printf "::warning title=%s::%s\n" "setup-ghdl" "Failed to remove 'ghdl.pkg.tar.zst'."
275351
fi
276352
277-
echo "GHDL_PREFIX=$(realpath $(dirname $(which ghdl))/../lib/ghdl) >> $GITHUB_ENV"
278-
echo "GHDL_PREFIX=$(realpath $(dirname $(which ghdl))/../lib/ghdl)" >> $GITHUB_ENV
353+
printf "Setting environment variable 'GHDL_PREFIX' ...\n"
354+
tee "${GITHUB_ENV}" <<EOF
355+
GHDL_PREFIX=$(realpath $(dirname $(which ghdl))/../lib/ghdl)
356+
EOF

0 commit comments

Comments
 (0)