Home

Awesome

setup-haskell

Please note: This repository is currently unmaintained by a team of developers at GitHub. The repository is here and you can use it as an example, or in Actions. However please be aware that we are not going to be updating issues or pull requests on this repository.

Maintained forks:

You could also fork this code and maintain it, if you do please let us know.

To reflect this state we’ve marked this repository as Archived.

If you are having an issue or question about GitHub Actions then please contact customer support.

If you have found a security issue please submit it here.


GitHub Actions status

This action sets up a Haskell environment for use in actions by:

The GitHub runners come with pre-installed versions of GHC and Cabal. Those will be used whenever possible. For all other versions, this action utilizes ppa:hvr/ghc, ghcup, and chocolatey.

Usage

See action.yml

Minimal:

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.1
      - run: runhaskell Hello.hs

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.1
        with:
          ghc-version: '8.8' # Resolves to the latest point release of GHC 8.8
          cabal-version: '3.0.0.0' # Exact version of Cabal
      - 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.1
        with:
          ghc-version: '8.8.3' # Exact version of ghc to use
          # cabal-version: 'latest'. Omitted, but defalts to 'latest'
          enable-stack: true
          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.1
        with:
          ghc-version: ${{ matrix.ghc }}
          cabal-version: ${{ matrix.cabal }}
      - run: runhaskell Hello.hs

Inputs

NameRequiredDescriptionTypeDefault
ghc-versionGHC version to use, ex. lateststringlatest
cabal-versionCabal version to use, ex. 3.2stringlatest
stack-versionStack version to use, ex. latest. Stack will only be installed if enable-stack is set.stringlatest
enable-stackIf specified, will setup Stack."boolean"false
stack-no-globalIf specified, enable-stack must be set. Prevents installing GHC and Cabal globally"boolean"false
stack-setup-ghcIf specified, enable-stack must be set. Runs stack setup to install the specified GHC. (Note: setting this does not imply stack-no-global)"boolean"false

Outputs

NameDescriptionType
ghc-pathThe path of the ghc executable directorystring
cabal-pathThe path of the cabal executable directorystring
stack-pathThe path of the stack executable directorystring
cabal-storeThe path to the cabal storestring
ghc-exeThe path of the ghc executablestring
cabal-exeThe path of the cabal executablestring
stack-exeThe path of the stack executablestring

Version Support

GHC:

Suggestion: Try to support the three latest major versions of GHC.

Cabal:

Recommendation: Use the latest available version if possible.

Stack:

Recommendation: Use the latest available version if possible.

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.