This patch adds functionality to * Test cabal build and cabal run in the CI workflow * Test GHC 7.10.3 on Linux and ensures that it works * On Linux, try hvr's PPA before ghcup
setup-haskell
This action installs a specified version of GHC and Cabal. It can also install Stack.
Currently only Linux comes with pre-installed versions of GHC and Cabal. Those will be used whenever possible.
For all other versions and for Windows and macOS, this action utilizes ghcup and chocolatey.
Usage
See action.yml
Basic:
on: [push]
name: build
jobs:
runhaskell:
name: Hello World
runs-on: ubuntu-latest # or macOS-latest, or windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-haskell@v1
with:
ghc-version: '8.8.3' # Exact version of ghc to use
cabal-version: '3.0.0.0'
- run: runhaskell Hello.hs
Basic with Stack:
on: [push]
name: build
jobs:
runhaskell:
name: Hello World
runs-on: ubuntu-latest # or macOS-latest, or windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-haskell@v1
with:
ghc-version: '8.8.3' # Exact version of ghc to use
cabal-version: '3.0.0.0'
stack-version: 'latest'
- run: runhaskell Hello.hs
Matrix Testing:
on: [push]
name: build
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
ghc: ['8.6.5', '8.8.3']
cabal: ['2.4.1.0', '3.0.0.0']
os: [ubuntu-latest, macOS-latest, windows-latest]
exclude:
# GHC 8.8+ only works with cabal v3+
- ghc: 8.8.3
cabal: 2.4.1.0
name: Haskell GHC ${{ matrix.ghc }} sample
steps:
- uses: actions/checkout@v2
- name: Setup Haskell
uses: actions/setup-haskell@v1
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- run: runhaskell Hello.hs
Inputs
| Name | Required | Description | Type | Default |
|---|---|---|---|---|
ghc-version |
GHC version to use, ex. 8.8.3 |
string | 8.8.3 | |
cabal-version |
Cabal version to use, ex. 3.0.0.0 |
string | 3.0.0.0 | |
stack-version |
Stack version to use, ex. latest. Stack will only be installed if this option is set |
string | ||
stack-no-global |
If specified, stack-version must be set. Prevents installing GHC and Cabal globally | "boolean" | ||
stack-setup-ghc |
If specified, stack-version must be set. Runs stack setup to install the specified GHC. (Note: setting this does not imply stack-no-global) |
"boolean" | 3.0.0.0 |
Version Support
GHC:
8.8.3(default)8.8.28.8.18.6.58.6.48.6.38.6.28.6.18.4.48.4.38.4.28.4.18.2.28.0.27.10.3
Cabal:
3.0.0.0(default)2.4.1.02.4.0.02.2.0.0
Recommendation: Cabal is almost always fully backwards compatible and so for most purposes, using the latest available version is sufficient
Stack:
latest(recommended) -- follows the latest release automatically.2.1.32.1.11.9.3.11.9.1.11.7.11.6.51.6.3.11.6.1.11.5.11.5.0
Recommendation: Stack follows SemVer, and additionally attempts to remain backwards compatible across major versions whenever reasonable. Using the latest available version is almost always sufficient
The full list of available versions of GHC, Cabal, and Stack are as follows:
Note: There are technically some descrepencies here. For example, "8.10.1-alpha1" will work for a ghc version for windows but not for Linux and macOS. For your sanity, I suggest sticking with the version lists above which are supported across all three operating systems.
License
The scripts and documentation in this project are released under the MIT License.
Contributions
Contributions are welcome! See the Contributor's Guide.