BSD-3-Clause licensed and maintained by Jens Petersen
This version can be pinned in stack with:stack-all-0.6.4@sha256:6c74da51189aa1350a5110ae427b255894a1c0b130efe4891d29c6595a02fc94,2493

Module documentation for 0.6.4

There are no documented modules for this package.

stack-all

A CLI tool for building Haskell projects easily over several Stackage major versions.

I use this to do Haskell build CI for projects locally with stack.

Usage

stack-all by default runs stack build over Stackage Nightly and LTS major versions (the current default range is nightly & major LTS versions back to lts-18) corresponding to latest major ghc minor versions, using appropriate stack --resolver options.

Note that stack only works in a project if a stack.yaml file exists. If no stack.yaml file is found in a .cabal project, stack-all will create one if there is a .cabal or “package.yaml” file. Of course it may still fail to build, but this allows for quick attempts to build a package that does not include a stack.yaml file.

Since 0.6, stack-all also works outside projects, like stack itself does.

Help output

$ stack-all --version

0.6.4

$ stack-all --help

Build project over Stackage major versions

Usage: stack-all [--version] [-k|--keep-going] [-D|--debug] [--refresh-cache] 
                 [-n|--newest MAJOR] [(-o|--oldest MAJOR) | (-a|--all-lts)] 
                 [(-c|--create-config) | (-d|--default-resolver MAJOR) | 
                   (-u|--update-resolver) | (-s|--make-lts MAJOR) | 
                   [MAJORVER... COMMAND...]]

  https://github.com/juhp/stack-all#readme

Available options:
  -h,--help                Show this help text
  --version                Show version
  -k,--keep-going          Keep going even if an LTS fails
  -D,--debug               Verbose stack build output on error
  --refresh-cache          Force refresh of stackage snapshots.json cache
  -n,--newest MAJOR        Newest LTS release to build from
  -o,--oldest MAJOR        Oldest compatible LTS release
  -a,--all-lts             Try to build back to LTS 1 even
  -c,--create-config       Create a project .stack-all file
  -d,--default-resolver MAJOR
                           Set stack.yaml resolver
  -u,--update-resolver     Update stack.yaml resolver
  -s,--make-lts MAJOR      Create a stack-ltsXX.yaml file

Overriding stack.yaml

stack-all can use stack-ltsXX.yaml files to override the default stack.yaml file for particular Stackage major versions. Note that a stack-ltsXX.yaml file will also be used for older LTS major versions until another stack-ltsYY.yaml file is found. stack-nightly.yaml is also supported, but used only for nightly.

For example if you have stack-lts20.yaml and stack-lts18.yaml files in your project, then stack.yaml will be used as normal to build nightly, lts-22 and lts-21, but stack-lts20.yaml will be used for building lts-20 and lts-19, and stack-lts18.yaml will be used for lts-18, lts-16 (and older). Since stack-all overrides the exact resolver with the latest minor snapshot, the exact minor Stackage version specified in the stack*.yaml files doesn’t actually matter: stack-all always uses the latest published minor releases of Stackage major versions.

stack-ltsXX.yaml files can be easily created using stack-all --make-lts ltsXX (or -s ltsXX for short).

(Other versioned stack.yaml filenames like stack-ghc-8.8.yaml are not currently supported.)

Specifying LTS versions

You can abbreviate lts-XX args to ltsXX on the commandline. lts is also accepted and resolves to the latest major LTS version.

You can also use ghc major version aliases: eg ghc9.6 corresponds to lts22 or ghc-9.2 to lts-20.

There are --oldest and --newest options to specify the range of lts versions to build over:

You can specify the oldest major LTS to build for with eg stack-all -o lts16. Otherwise if not configured the default oldest LTS is currently lts-18.

Similarly you can specify the newest LTS version to build from with eg stack-all -n lts20. (The default is to build from nightly.)

Alternatively, one can give one or more explicit LTS major versions to build for as arguments: eg stack-all lts19 if you only wish to build that version.

Configuring the oldest and/or newest LTS to build

You can configure the oldest working LTS major version for your project by running for example stack-all -c -o lts-19 which generates a .stack-all project config file like this:

[versions]
# lts-18 too old
oldest = lts-19

(the comment line can be used to document why the older LTS doesn’t work). This specifies that the oldest LTS version to build for is lts-19.

The newest LTS to build with stack-all can similarly be configured: stack-all -c -n lts21 or setting newest = lts-21.

Running other stack commands

By default stack-all just runs the stack build command over Stackage major versions.

You can also specify a stack command to run with options on the commandline: eg

$ stack-all test --no-rerun-tests

will run stack test over the LTS versions instead.

Any stack command can be used, possibly outside a project, eg: stack-all list aeson

Happy stack building!

Install

The project is released on Hackage.

You can also build from a git clone with stack install or cabal install.

Collaboration

The project is hosted at https://github.com/juhp/stack-all under a BSD license.

Changes

Release history for stack-all

0.6.4 (2024-10-13)

  • Fix the missing stack.yaml logic to first check for a .cabal file before trying parent directory

0.6.3 (2024-06-10)

  • --update-resolver to update default resolver to latest minor
  • command option args are now handled more precisely with an ADT

0.6.2 (2024-05-21)

  • --default-resolver to update stack.yaml resolver
  • change --debug short option to -D
  • test for package.yaml if no .cabal file

0.6.1 (2024-05-20)

  • fix --create-config and --make-lts failing if no command

0.6 (2024-05-19)

  • stack-all now works outside of projects too like stack does
  • error when --make-lts combined with a command args
  • also error for --create-config with versions or command args
  • bump default oldest lts from 16 to 18 (ghc-8.10)

0.5.2 (2024-04-18)

  • fix parsing of ltsXX
  • use https for snapshots url

0.5.1 (2024-03-19)

  • update the stackage snapshots.json url

0.5 (2024-02-19)

  • support ghc-X.Y/ghcX.Y aliases for lts major versions
  • default oldest lts bumped from lts-11 (ghc8.2) to lts-16 (ghc8.8)
  • ignore .cabal file directory

0.4.2 (2023-10-01)

  • support unversioned “lts” argument
  • add –refresh-cache option to force refresh of cached snapshots.json

0.4.1 (2023-02-20)

  • ignore nightly as a base when creating a new lts file

0.4.0.1 (2022-03-27)

  • fix build with simple-cmd-0.2.4

0.4 (2022-01-24)

  • ‘lts’ alias can now be used as a commandline version argument
  • stack-nightly.yaml is now only used for building nightly
  • if creating stack.yaml use latest lts snapshot resolver from snapshot.json
  • support aeson-2.0

0.3.1 (2021-09-06)

  • newest LTS for a project can now be configured
  • use cached-json-file for snapshots.json
  • add –keep-going
  • exclude lts17 now by default

0.3 (2021-06-26)

  • use hackage.stackage.org/snapshots.json:
    • to determine the latest LTS major version
    • to resolve major LTS version to latest minor snapshot and also print it
  • cache snapshots.json locally in ~/.cache/stack-all/ for a few hours
  • new –make-lts command to generate a stack-ltsXX.yaml file from newer one

0.2.2 (2021-06-07)

  • create a stack.yaml file if only an .cabal file is found

0.2.1 (2021-04-30)

  • if stack fails, print the ~/.stack snapshot path for reference

0.2 (2021-04-03)

  • better error messages when reading snapshot option/arg (TristanCacqueray)
  • search parent dirs for stack project dir, like stack
  • snapshot options/args can now be in compact ltsXY form as well as lts-XY
  • support stack commands and options

0.1.2 (2021-02-05)

  • –create-config comment line mentions older version
  • show error for unversioned “stack-lts.yaml”
  • add lts-17

0.1.1 (2020-12-04)

  • fix ordering of stack-lts-*.yaml
  • allow –newest to override oldest lts config

0.1.0 (2020-11-14)

  • initial release with –create-config, –debug, –cmd, –newest
  • VersionSpec: –all-lts, –oldest, and lts args