haskell-gha: Generate a GitHub Actions workflow for a Haskell cabal project.

[ bsd3, development, library, program ] [ Propose Tags ] [ Report a vulnerability ]

Generate a GitHub Actions workflow that builds and tests a Haskell cabal project on each GHC version from tested-with.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 1.0
Change log CHANGELOG.md
Dependencies base (>=4.18 && <5), bytestring (>=0.11), Cabal (>=3.14 && <3.20), Cabal-syntax (>=3.14 && <3.20), directory (>=1.3), filepath (>=1.4), haskell-gha, optparse-applicative (>=0.17 && <0.20), parsec (>=3.1), text (>=2.0), transformers (>=0.5.6), yamlet (>=1.0 && <1.1) [details]
Tested with ghc ^>=9.6 || ^>=9.8 || ^>=9.10 || ^>=9.12 || ^>=9.14 || ^>=10.0
License BSD-3-Clause
Author Andrzej Rybczak
Maintainer andrzej@rybczak.net
Uploaded by arybczak at 2026-12-02T13:18:54Z
Category Development
Bug tracker https://github.com/arybczak/haskell-gha/issues
Source repo head: git clone https://github.com/arybczak/haskell-gha.git
Distributions
Executables haskell-gha
Downloads 3 total (3 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user [build log]
All reported builds failed as of 2026-12-02 [all 1 reports]

Readme for haskell-gha-1.0

[back to package description]

haskell-gha

CI Hackage

haskell-gha writes a GitHub Actions workflow for a Haskell cabal project. The workflow builds and tests the project on each GHC version from the tested-with field of its packages, in separate jobs. Only Linux is supported.

Features

  • A new GHC release needs no new release of the tool. GHCup installs each version, and a series, e.g. ^>= 9.12, gets its newest release.
  • The workflow builds with the project's own cabal.project, so CI uses the same settings as a local build.
  • The jobs build and test the content of the source tarballs that cabal sdist makes, so CI finds a file that the .cabal file does not list before your users do.
  • You write service containers, hook steps and extra matrix axes in plain GitHub Actions YAML, and the tool copies them to the workflow.
  • The jobs run on the runner image, or optionally in a job container.
  • A job saves a new cache only when its build plan changes.
  • Optional jobs test the oldest dependency versions that the bounds allow.
  • Optional checks with doctest, fourmolu and HLint.
  • haskell-gha --check tells whether the committed workflows are up to date.

Quick start

Install the tool from Hackage:

cabal install haskell-gha

Give each package of the project its GHC versions in tested-with. Each version is an exact release or a major series, e.g.:

tested-with: GHC == 9.6.7 || ^>= 9.10 || ^>= 9.12

In the root of your repository, generate the workflow:

haskell-gha --generate

The tool generates .github/workflows/haskell-gha.yaml. Commit this file. After a change to tested-with, to the packages of the project or to the configuration file of haskell-gha, regenerate the workflow:

haskell-gha

Example

The configuration file is .github/haskell-gha.conf.yaml, and it needs only the keys that differ from the defaults. This configuration is for a project that needs the libsodium library and whose tests use Postgres:

branches: [master]
apt: [libsodium-dev]
dependencies: both
services:
  postgres:
    image: postgres:18
    env:
      POSTGRES_PASSWORD: postgres
    ports: ['5432:5432']
    options: >-
      --health-cmd pg_isready
      --health-interval 5s
      --health-retries 10
hooks:
  after-build:
  - name: Create the test database
    run: psql -h localhost -U postgres -c 'CREATE DATABASE test'
    env:
      PGPASSWORD: postgres
doctest: {}
fourmolu:
  version: 0.21.0.0

For a package with tested-with: GHC == 9.6.7 || ^>= 9.10 || ^>= 9.12, GitHub shows these jobs:

Fourmolu
GHC 9.6.7, newest
GHC 9.6.7, oldest
GHC 9.10, newest
GHC 9.10, oldest
GHC 9.12, newest
GHC 9.12, oldest
  • The fourmolu job checks the formatting.
  • Each GHC version has two build jobs. The newest job builds with the newest dependency versions that the bounds allow, and the oldest job with the oldest ones. Each job installs libsodium-dev and starts Postgres. After the build, it creates the test database, and then it runs the tests and doctest.

The tool generates this workflow from the configuration.

Documentation

  • Configuration: each key of the configuration file.
  • Guide: the command line, the steps of the workflow, the GHC versions, the dependencies, the source tarballs, the container, the caches, common failures and known limits.