github-actions-0.1.1.0: Github Actions
Copyright(c) 2025 Bellroy Pty Ltd
LicenseBSD-3-Clause
MaintainerBellroy Tech Team <haskell@bellroy.com>
Safe HaskellNone
LanguageHaskell2010

Language.Github.Actions.Job.Strategy

Description

This module provides the JobStrategy type for configuring matrix strategies that allow jobs to run multiple times with different configurations.

Matrix strategies are useful for testing across multiple: * Operating systems (Ubuntu, Windows, macOS) * Language versions (Node 16, 18, 20) * Database versions (PostgreSQL 12, 13, 14) * Or any other configurable parameters

For more information about GitHub Actions matrix strategies, see: https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/running-variations-of-jobs-in-a-workflow

Synopsis

Documentation

data JobStrategy Source #

Matrix strategy configuration for running job variations.

Matrix strategies define how to run a job multiple times with different configurations. The matrix creates a cross-product of all variable combinations, with options to include additional combinations or exclude specific ones.

Example usage:

import Language.Github.Actions.Job.Strategy
import qualified Data.Map as Map
import qualified Data.Aeson as Aeson

-- Simple OS and Node version matrix
nodeMatrix :: JobStrategy
nodeMatrix = JobStrategy
 { exclude = Nothing
 , failFast = Just False
 , include = Nothing
 , maxParallel = Just 3
 , otherVariables = Just $ Map.fromList
     [ ("os", Aeson.toJSON ["ubuntu-latest", "windows-latest", "macos-latest"])
     , ("node-version", Aeson.toJSON ["16", "18", "20"])
     ]
 }

-- Matrix with exclusions and includes
complexMatrix :: JobStrategy
complexMatrix = JobStrategy
 { exclude = Just ["{ "os": "windows-latest", "node-version": "16" }"]
 , failFast = Just True
 , include = Just ["{ "os": "ubuntu-latest", "node-version": "21", "experimental": true }"]
 , maxParallel = Nothing
 , otherVariables = Just $ Map.fromList
     [ ("os", Aeson.toJSON ["ubuntu-latest", "windows-latest"])
     , ("node-version", Aeson.toJSON ["18", "20"])
     ]
 }

For more details, see: https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/running-variations-of-jobs-in-a-workflow

Constructors

JobStrategy 

Fields

Instances

Instances details
FromJSON JobStrategy Source # 
Instance details

Defined in Language.Github.Actions.Job.Strategy

ToJSON JobStrategy Source # 
Instance details

Defined in Language.Github.Actions.Job.Strategy

Generic JobStrategy Source # 
Instance details

Defined in Language.Github.Actions.Job.Strategy

Associated Types

type Rep JobStrategy 
Instance details

Defined in Language.Github.Actions.Job.Strategy

type Rep JobStrategy = D1 ('MetaData "JobStrategy" "Language.Github.Actions.Job.Strategy" "github-actions-0.1.1.0-BjHhRMO6iQ17qdsNXwhDab" 'False) (C1 ('MetaCons "JobStrategy" 'PrefixI 'True) ((S1 ('MetaSel ('Just "exclude") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe [Text])) :*: S1 ('MetaSel ('Just "failFast") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Bool))) :*: (S1 ('MetaSel ('Just "include") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe [Text])) :*: (S1 ('MetaSel ('Just "maxParallel") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Int)) :*: S1 ('MetaSel ('Just "otherVariables") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (Map Text Value)))))))
Show JobStrategy Source # 
Instance details

Defined in Language.Github.Actions.Job.Strategy

Eq JobStrategy Source # 
Instance details

Defined in Language.Github.Actions.Job.Strategy

Ord JobStrategy Source # 
Instance details

Defined in Language.Github.Actions.Job.Strategy

type Rep JobStrategy Source # 
Instance details

Defined in Language.Github.Actions.Job.Strategy

type Rep JobStrategy = D1 ('MetaData "JobStrategy" "Language.Github.Actions.Job.Strategy" "github-actions-0.1.1.0-BjHhRMO6iQ17qdsNXwhDab" 'False) (C1 ('MetaCons "JobStrategy" 'PrefixI 'True) ((S1 ('MetaSel ('Just "exclude") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe [Text])) :*: S1 ('MetaSel ('Just "failFast") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Bool))) :*: (S1 ('MetaSel ('Just "include") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe [Text])) :*: (S1 ('MetaSel ('Just "maxParallel") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Int)) :*: S1 ('MetaSel ('Just "otherVariables") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (Map Text Value)))))))